Repository navigation
Conversation
When Modf is inlined, a fused multiply-subtract can retain extra precision from pow * val and move a half-way fractional part below 0.5. On arm64 and riscv64, round(123.5555, 3) then returns 123.555 instead of 123.556. An explicit float64 conversion rounds the product before Modf examines it. The existing TestRound case covers the regression. Signed-off-by: cl2t <yihong.or@isrc.iscas.ac.cn>
2 tasks done
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With Go 1.26.3 on arm64 and Go 1.27.1 on riscv64,
round(123.5555, 3)can return123.555instead of123.556. Aftermath.Modfis inlined, a fused multiply-subtract retains extra precision and moves the fractional part below the rounding threshold.Explicitly convert the product to
float64so it is rounded beforeModfsubtracts its integer part, as required by the Go floating-point rules.Validation:
989da45), the existingTestRoundfails before this change and passes afterward with Go 1.26.3 on darwin/arm64.TZ=UTC(the existingTestHtmlDateexpects that date). Dependencies were tested offline using a temporary modfile pointing to the official cast v1.9.2 archive; repository module files are unchanged.Assisted-by: Codex:GPT-6