Skip to content

fix: preserve decimal digits when truncating counts - #242

Open
xiehuanyi wants to merge 1 commit into
EvanHahn:mainfrom
xiehuanyi:fix-decimal-truncation-precision
Open

xiehuanyi wants to merge 1 commit into
EvanHahn:mainfrom
xiehuanyi:fix-decimal-truncation-precision

Conversation

@xiehuanyi

Copy link
Copy Markdown

With maxDecimalPoints: 2, 1150 milliseconds currently renders as “1.14 seconds” and 2300 milliseconds as “2.29 seconds”. Multiplying the count by a power of ten introduces floating-point error just below the integer that is then floored.

Shift the decimal exponent through the number's string representation before truncating, then shift it back. Tests cover exact decimal digits, truncation rather than rounding, scientific notation, large counts, and a large decimal-point limit. Changelog and contributor credits follow CONTRIBUTING.md.

Validation: the new truncation regression fails before the fix; npm test passes formatting, lint, TypeScript checking, and all 35 tests afterward.

Copilot AI balanced review requested due to automatic review settings October 10, 2026 11:49

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@EvanHahn

Copy link
Copy Markdown
Owner

Thanks. I'll review in the next few weeks.

This branch has not been deployed

No deployments
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