Skip to content

Remove fmt: convert I* files to std::format (part 4)#11618

Closed
brianlball wants to merge 1 commit into
developfrom
remove-fmt-part-4
Closed

Remove fmt: convert I* files to std::format (part 4)#11618
brianlball wants to merge 1 commit into
developfrom
remove-fmt-part-4

Conversation

@brianlball

@brianlball brianlball commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Purpose

Continues the remove-fmt campaign (#11553, #11588, #11592). Converts the I*
source files from EnergyPlus::format/fmt::format to C++20 std::format and
replaces the custom {:.NR} flag with standard specifiers.

Scope

File calls converted
InternalHeatGains.cc 148
IceThermalStorage.cc 7
ICEngineElectricGenerator.cc 4

0 {R}/{T} and 0 EnergyPlus::format remain in these files. The DoubleWrapper /
Fortran-format machinery in IOFiles.hh is left untouched (later PR).

Specifier mapping (the bit to sanity-check)

Following the A–H precedent, chosen to minimize regression diffs:

  • {:.NR} for |v| >= 0.1 (the common case) -> {:.Nf} — reproduces the old fixed
    output exactly, so zero diff.
  • Genuinely-tiny values (CO2 rate ~3.8e-8) -> {:.NE} — matches the old scientific
    mantissa with no truncation; avoids {:.Nf} rounding it to 0.000.
  • People counts -> {:.1f} — matches the old 1-decimal echo.

Note on {:#G}/{:G}: this PR doesn't use it, but that's not a departure from
the campaign convention. None of the I* fields are the m3/s/W sizing/flow class
that #11553's {:G} normalization targets — these are density/count echo fields
whose baseline was fixed {:.NR}, so {:.Nf}/{:.NE} reproduce them exactly while
{:#G} would reveal extra sig figs and add avoidable small diffs. (The {:#G} ->
{:.5f} revert in #11592, bd0c1a1048, is the precedent for preferring a fixed
spec where it matches and avoids platform-divergence risk.)

Verification (energyplus-regressions vs develop, local)

Indentation note

Whitespace-only line changes are clang-format v19 reflow: std::format is 7 chars
shorter than EnergyPlus::format, so wrapped calls collapse under the 150-col
limit. pre-commit run clang-format passes clean.

Question for review

Is the {:.Nf} / {:.NE} / {:.1f} mapping the approach you want for this value
class, and are the 10 half-even count-flip diffs acceptable (consistent with prior
parts)?

Convert InternalHeatGains.cc, IceThermalStorage.cc, and ICEngineElectricGenerator.cc from EnergyPlus::format to std::format and replace the custom {:.NR} flag with standard specifiers ({:.Nf} for |v|>=0.1, {:.NE} for tiny values, {:.1f} for counts). Continues the remove-fmt campaign (#11553, #11588, #11592). Display-only; numeric results byte-identical to develop.
@brianlball brianlball added the Refactoring Includes code changes that don't change the functionality of the program, just perform refactoring label Jun 4, 2026
@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown

⚠️ Regressions detected on macos-14 for commit 12654dd

Regression Summary
  • EIO: 638
  • Table Big Diffs: 10
  • Table Small Diffs: 533

@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown

⚠️ Regressions detected on ubuntu-24.04 for commit 12654dd

Regression Summary
  • EIO: 642
  • Table Big Diffs: 10
  • Table Small Diffs: 535

@brianlball brianlball closed this Jun 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Refactoring Includes code changes that don't change the functionality of the program, just perform refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants