Repository navigation
Conversation
Found while testing crates/core/src/value.rs:354-367 Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com> Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
Found while testing
crates/core/src/value.rs:354-367(no existing issue): number_to_text prints 16 digits for numbers just below 1e15 that round up to 1e15.Cause
number_to_text checked for scientific notation on the unrounded magnitude. A value just below 1e15, such as 999999999999999.9, took the fixed-point path. Rounding to 15 significant digits there produced the 16-digit text "1000000000000000".
Fix
After the existing scientific check, number_to_text now rounds the magnitude to 15 significant digits. If the rounded value reaches 1e15, it returns the scientific text. 999999999999999.9 now gives "1E+15", matching 1e15 itself.
Verified
value::tests::number_text_rounds_up_to_scientific_boundary: fails onmainwithout the fix and passes with it (cargo test -p gridcraft-core number_text_rounds_up_to_scientific_boundary).cargo xtask cipasses.Not changed
The fixed-point formatting for other values and the small-magnitude (below 1e-9) scientific handling are unchanged. I did not test values that round up across other power-of-ten boundaries.
🤖 Generated with AI by ApolloOffice, see the Co-Authored-By trailers for the models
Summary by CodeRabbit
1e15boundary to prevent rounded values from being displayed in misleading decimal notation.