Skip to content

Skip the Rem quotient size limit at zero precision - #156

Merged
rafiss merged 1 commit into
cockroachdb:masterfrom
Shubham-Padkonde:fix/unlimited-precision-remainder
Oct 21, 2026
Merged

rafiss merged 1 commit into
cockroachdb:masterfrom
Shubham-Padkonde:fix/unlimited-precision-remainder

Conversation

@Shubham-Padkonde

@Shubham-Padkonde Shubham-Padkonde commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

BaseContext.Rem(New(100, 100), New(10, 1)) returned DivisionImpossible
even though the remainder is exactly zero. The quotient digit-count
check treated the default precision of zero as a zero-digit limit,
while the rest of the context uses zero to disable rounding.

Apply the quotient-size limit only when precision is nonzero, and say
so in the Rem doc comment. QuoInteger keeps rejecting a zero precision;
its doc comment now says so and names c.Precision instead of the
nonexistent d.Precision.

Fixes #134.

🤖 Generated with Claude Code

BaseContext.Rem(New(100, 100), New(10, 1)) returned DivisionImpossible
even though the remainder is exactly zero. The quotient digit-count
check treated the default precision of zero as a zero-digit limit,
while the rest of the context uses zero to disable rounding.

Apply the quotient-size limit only when precision is nonzero, and say
so in the Rem doc comment. QuoInteger keeps rejecting a zero precision;
its doc comment now says so and names c.Precision instead of the
nonexistent d.Precision.

Fixes cockroachdb#134.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@rafiss rafiss changed the title fix: allow exact remainders with zero precision Skip the Rem quotient size limit at zero precision Oct 21, 2026
@rafiss
rafiss force-pushed the fix/unlimited-precision-remainder branch from 583b156 to 968c4f9 Compare October 21, 2026 20:11
@rafiss
rafiss merged commit 0e59bff into cockroachdb:master Oct 21, 2026
18 checks passed
cueckoo pushed a commit to cue-lang/cue that referenced this pull request Oct 22, 2026
Its master no longer treats a precision of zero as a quotient size
limit in Context.Rem, where the rest of the package treats it as
unlimited; see cockroachdb/apd#156.

Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
Change-Id: Iedf072cb01212a8b56ea91174967a9269ab2836a
GitOrigin-RevId: ef2ee05d0bd7d6928051af7148424ba963ce7d6c
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.

Context.Rem fails for Rem(100E100, 10)

2 participants