Skip to content

A quantity read into a larger declared unit keeps its digits, so 350万元 under 亿元 shows 0.035 instead of 0.04 - #1398

Merged
WaylandYang merged 3 commits into
deeplethe:devfrom
rudycelekli:fix/object-value-small-quantities
Oct 27, 2026
Merged

WaylandYang merged 3 commits into
deeplethe:devfrom
rudycelekli:fix/object-value-small-quantities

Conversation

@rudycelekli

@rudycelekli rudycelekli commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Why

Unit-bearing small quantities were rounded to two decimal places: 0.035 亿元 displayed as 0.04 亿元, and 0.0003 亿元 displayed as zero.

Changes

Keep two fractional digits for compact notation. Use at most 15 significant digits for ordinary unit-bearing numbers, as requested in review. This preserves small quantities while suppressing floating-point arithmetic noise (0.1 + 0.2 displays as 0.3 kg). Add the arithmetic regression to the existing formatter tests.

Validation

  • Current head: eight production-formatter oracle cases pass, plus 15 independently checked production-source assertions. The original head reproduces the arithmetic roundoff.
  • git diff --check passes.
  • Vitest, type-check, build and browser checks were not rerun locally for this revision; dependencies are unavailable in this checkout. Earlier-head CI results do not validate this revision. Current-head CI remains required.
  • Prepared and independently reviewed with AI assistance.

Before review

  • Every commit is signed off (git commit -s)
  • For changes under web/: pnpm test passes; type-check/build pass on the current head

…元 under 亿元 shows 0.035 instead of 0.04

Signed-off-by: Rudy Celekli <rudy@gradiahq.com>

@WaylandYang WaylandYang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, the bug is real. Please use maximumSignificantDigits: 15 instead of 20 fraction digits: rules can compute values with arithmetic, and with 20 fraction digits 0.1+0.2 renders as 0.30000000000000004. Fifteen significant digits still shows 0.035 and 0.0003.

Signed-off-by: Rudy Celekli <rudy@gradiahq.com>

@WaylandYang WaylandYang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, 15 significant digits shows 0.035 亿元 and 0.3 kg both right. Approving and merging.

@WaylandYang
WaylandYang merged commit 52fb5a6 into deeplethe:dev Oct 27, 2026
6 checks passed
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.

2 participants