Skip to content

fix(#7975): let %f terminate instead of printing why it cannot write - #7999

Merged
yegor256 merged 1 commit into
objectionary:masterfrom
HDPark95:7975
Aug 31, 2026
Merged

fix(#7975): let %f terminate instead of printing why it cannot write#7999
yegor256 merged 1 commit into
objectionary:masterfrom
HDPark95:7975

Conversation

@HDPark95

Copy link
Copy Markdown
Contributor

Closes #7975.

%f handed I to as-fixed as its cant-print fallback, so a number as-fixed refuses came back as the explanation. Measured on a built eo-runtime:

"value=%f".printf * nan -> "value=Can't write a non-finite number as a fixed-point decimal"
"%f".printf * 1.0e30 -> "Can't write a fixed-point decimal with a magnitude of 2^63 or larger"

%d terminates for both. Dropping the fallback leaves cant-print unbound, which as-fixed documents as its terminator.

The tests recover instead of using -->: a text of over one byte fails asBool as a termination does, so a --> test passed before the fix.

mvn clean test -pl :eo-runtime -Dtest=TestEOstring: 416 run, 0 failures.

@yegor256

…annot write

The %f conversion handed the identity object to as-fixed as its
cant-print fallback, so a number as-fixed refuses came back as the
explanation standing where the number was meant to be. Leaving
cant-print unbound makes the same call terminate with that reason,
the way %d already does.

The tests recover from the termination instead of declaring it with
-->, because a returned text of more than one byte fails to dataize
as a boolean exactly as a termination does, so a --> test passes
either way.
@github-actions

Copy link
Copy Markdown
Contributor

These counts changed in this branch,
while the lower each one of them, the better:

Metric master branch change
positive-tests 1806 1808 +2

They are defined in .github/workflows/counts.yml

@github-actions github-actions Bot added the counts Some counts changed in this PR label Aug 31, 2026
@sonarqubecloud

Copy link
Copy Markdown

@yegor256
yegor256 merged commit 51523e3 into objectionary:master Aug 31, 2026
23 checks passed
@0crat

0crat commented Sep 2, 2026

Copy link
Copy Markdown

@HDPark95 Thanks for the contribution! You've earned +12 points for this: +16 as a basis; -4 for too few (23) hits-of-code. Please, keep them coming. Your running score is +24; don't forget to check your Zerocracy account too).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

counts Some counts changed in this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

string.printf writes the as-fixed error message into the output for %f of a non-finite number

3 participants