Skip to content

avoid binary noise in fixed decimal text - #2995

Merged
h-a-n-a-s-h-i merged 2 commits into
storytold:mainfrom
Harrison-Booth:gc-build-g706x
Oct 31, 2026
Merged

h-a-n-a-s-h-i merged 2 commits into
storytold:mainfrom
Harrison-Booth:gc-build-g706x

Conversation

@Harrison-Booth

@Harrison-Booth Harrison-Booth commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Format the already rounded value from its shortest decimal representation, then pad the requested fractional places.
  • Add FIXED and DOLLAR regressions at 16, 20, and 127 decimal places.
  • Record the measured high precision behavior in function-parity.md.

Measured the mismatches in Windows Excel 16.0 build 20527, LCID 1033. No locale independence is claimed.

Validation

  • cargo fmt --check — passed.
  • git diff --check — passed.
  • Clippy, crate tests, and desktop app build were not run locally under the GridCraft task restriction; fork CI should run the code checks.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • FIXED and DOLLAR now format the rounded number’s shortest decimal representation, then truncate or pad fractional digits to match the requested precision. High-precision output is covered at 16, 20, and 127 decimal places.
  • Documentation
    • Updated the function parity notes with the observed FIXED and DOLLAR precision behavior and additional measured differences from Excel.

@coderabbitai

coderabbitai Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between bd8cf4e and 11d6ff1.

Files selected for processing: 1
  • docs/function-parity.md
Files skipped from review as they are similar to previous changes: 1
  • docs/function-parity.md

Limit details: You’ve used all 10 included reviews currently available.

Walkthrough

format_fixed now uses the rounded number’s shortest decimal representation, then truncates or pads fractional digits to the requested precision. Tests cover FIXED and DOLLAR at 16, 20, and 127 decimal places. The parity document records the behavior and measurement details.

Changes: FIXED and DOLLAR formatting

Layer / File(s) Summary
Precision formatting and validation
crates/functions/src/text.rs, docs/function-parity.md
format_fixed uses the shortest representation of the rounded number, then truncates or pads fractional digits. Integer formatting and optional comma grouping remain in place. Tests cover 16, 20, and 127 decimal places. The parity document records the behavior and Excel measurement context.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related issues

Suggested reviewers: echelon

Merge Risk: Minimal · up to 11d6f

No merge-blocking formatting issue was established; the change is ready for normal checks.

Architecture risk: Low · up to bd8cf

The change affects 2 systems.

Changed systems: crates, docs

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — crates (service) was modified; 1 changed file maps to changed impact.
  • observed — docs (service) was modified; 1 changed file maps to changed impact.

Before / after behavior

  • observed — Modified behavior in crates/functions/src/text.rs: format_fixed no longer formats the absolute value directly to the requested precision. It uses the value’s shortest representation, limits the fractional part to d digits, and pads it with zeros when needed; integer formatting and optional comma grouping remain in place.
  • observed — Modified behavior in crates/functions/src/text.rs: Added expected-output checks for FIXED and DOLLAR with 16, 20, and 127 decimal places.
  • observed — Modified behavior in docs/function-parity.md: The metadata now dates the review and update to 2026-10-31 and describes the FIXED and DOLLAR precision behavior and measurement environment. It replaces the prior summary of LAMBDA, number-text coercion, INDEX, SUBTOTAL, and AGGREGATE changes.
  • observed — Modified behavior in docs/function-parity.md: The revision history adds a 2026-10-31 minor entry stating that FIXED and DOLLAR format the rounded number’s shortest decimal representation before padding fractional zeroes, with examples at 16 and 20 places and the Excel measurement environment.
Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: preventing binary floating-point artifacts in fixed-decimal text formatting.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 2 functions across 1 files. (1 skipped: 1 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@h-a-n-a-s-h-i
h-a-n-a-s-h-i merged commit ae598a7 into storytold:main Oct 31, 2026
6 checks passed
@echelon

echelon commented Oct 31, 2026

Copy link
Copy Markdown
Member

Landed in main (fb1e59f). Thank you for the contribution, @Harrison-Booth!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants