Skip to content

fix(javascript): keep float64 precision for dynamic non-integer numbers - #4005

Merged
chaokunyang merged 2 commits into
apache:mainfrom
ayush00git:fix/dynamic-num-lose
Aug 31, 2026
Merged

fix(javascript): keep float64 precision for dynamic non-integer numbers#4005
chaokunyang merged 2 commits into
apache:mainfrom
ayush00git:fix/dynamic-num-lose

Conversation

@ayush00git

@ayush00git ayush00git commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Why?

Dynamic number dispatch picked the float32 serializer for any non-integer within int32 range, silently corrupting values like 0.1. Narrow to float32 only when Math.fround(v) === v; otherwise use float64.

What does this PR do?

Related issues

AI Contribution Checklist

  • Substantial AI assistance was used in this PR: yes / no
  • If yes, I included a completed AI Contribution Checklist in this PR description and the required AI Usage Disclosure.
  • If yes, my PR description includes the required ai_review summary and screenshot evidence or equivalent persisted links of the final clean AI review results from both fresh reviewers described in AI_POLICY.md, the Fory-guided reviewer and the independent general reviewer, on the current PR diff or current HEAD after the latest code changes.

Does this PR introduce any user-facing change?

  • Does this PR introduce any public API change?
  • Does this PR introduce any binary protocol compatibility change?

Benchmark

Dynamic number dispatch picked the float32 serializer for any non-integer
within int32 range, silently corrupting values like 0.1. Narrow to float32
only when Math.fround(v) === v; otherwise use float64.

@chaokunyang chaokunyang left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@chaokunyang
chaokunyang merged commit 94f0439 into apache:main Aug 31, 2026
64 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