Drop the Debug.Assert that rejects decimals like 10.0m - #115
Merged
Merged
Conversation
ParseRenderedFloat trims trailing zeros from the rendered text, so a decimal with more than one integer digit and only zeros after the point, such as 10.0m, 100.00m or -20.0m, becomes "10." with an empty fraction. The assert after the loop required an empty fraction to come with a single integer digit, which the loop does not guarantee, so Debug builds ended the process with "Unexpected format: 10." on valid input. Release builds compiled the assert out and returned the right value. The code after the assert already handles an empty fraction, so the assert goes. Fixes #112 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QK96a24CjVhUK9u1Ss2YNN
|
matt-edmondson
deleted the
claude/rendered-float-trailing-zero-assert
branch
September 27, 2026 00:19
This was referenced Sep 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Fixes #112
Summary
ParseRenderedFloattrims trailing zeros from the rendered text. A decimal with more than one integer digit and only zeros after the point (10.0m,100.00m,-20.0m) comes out of that as"10.", with an empty fraction. TheDebug.Assertafter the loop required an empty fraction to come with a single integer digit. The loop does not guarantee that, so Debug builds ended the process withUnexpected format: 10.on valid input. Release builds compiled the assert out and returned the correct value.The code after the assert already handles an empty fraction: it contributes no digits and no exponent shift. So the fix is to remove the assert.
Tests
FromDecimalWithOnlyZerosAfterThePointconverts10.0m,100.00m,-20.0mand-1200.000m, both throughToPreciseNumber()and in every generic conversion mode. It runs in the default Debug test configuration.Assertion Failed / Unexpected format: 10..This branch is independent of #113 and #114. Each PR is based on
mainalone.🤖 Generated with Claude Code
https://claude.ai/code/session_01QK96a24CjVhUK9u1Ss2YNN
Generated by Claude Code