Skip to content

Remove the trailing zeros that rounding adds in Context.Reduce - #166

Open
youdie006 wants to merge 1 commit into
cockroachdb:masterfrom
youdie006:reduce-after-rounding
Open

youdie006 wants to merge 1 commit into
cockroachdb:masterfrom
youdie006:reduce-after-rounding

Conversation

@youdie006

Copy link
Copy Markdown
Contributor

Context.Reduce strips trailing zeros and then rounds, so a rounding carry leaves new ones. At precision 3:

input before after
9999 1.00E+4 1E+4
0.999E-999 (redx215) 1.00E-999 1E-999
-0.0001E-999 -0E-1001 -0

TestGDA compares finite results with Cmp, so redx215/redx216 pass today. This reduces again after rounding and adds the zeros it removes to the returned count. Exact inputs keep their previous count, so 1.2300 still reports 2.

TestContextReduceRounding fails on master and passes with the change. go test ./..., -race and go vet -unsafeptr=false pass.

Written with AI assistance (Claude); I have reviewed the change.

Context.Reduce removed trailing zeros before rounding to the precision,
so a rounding carry left new ones: at precision 3, 9999 reduced to
1.00E+4 rather than 1E+4, and 0.999E-999 to 1.00E-999 rather than the
1E-999 of reduce.decTest (redx215). TestGDA compares finite results
numerically, so the vectors passed. Reduce again after rounding.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-26T00:05:31.859795Z
We couldn’t complete this review. Comment @codex review to try again.
510e71b PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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.

1 participant