Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

better errors for trailing_zeros and friends on BigInt #43240

Merged
merged 1 commit into from
Nov 29, 2021

Conversation

rfourquet
Copy link
Member

E.g. trailing_zeros(big(0)) is not meaningful; the underlying MPZ.scan1
returns typemax(Culong) to convey this. But we were converting to Int,
which gave either InexactError (not user-friendly) or typemax(UInt32)
on Windows, which was really meaningless. We now throw DomainError
on all architectures.

E.g. `trailing_zeros(big(0))` is not meaningful; the underlying `MPZ.scan1`
returns `typemax(Culong)` to convey this. But we were converting to `Int`,
which gave either `InexactError` (not user-friendly) or `typemax(UInt32)`
on Windows, which was really meaningless. We now throw `DomainError`
on all architectures.
@rfourquet rfourquet added domain:bignums BigInt and BigFloat kind:bugfix This change fixes an existing bug labels Nov 26, 2021
@JeffBezanson JeffBezanson merged commit c7b5f7d into master Nov 29, 2021
@JeffBezanson JeffBezanson deleted the rf/big-trailing-error branch November 29, 2021 19:36
LilithHafner pushed a commit to LilithHafner/julia that referenced this pull request Feb 22, 2022
E.g. `trailing_zeros(big(0))` is not meaningful; the underlying `MPZ.scan1`
returns `typemax(Culong)` to convey this. But we were converting to `Int`,
which gave either `InexactError` (not user-friendly) or `typemax(UInt32)`
on Windows, which was really meaningless. We now throw `DomainError`
on all architectures.
LilithHafner pushed a commit to LilithHafner/julia that referenced this pull request Mar 8, 2022
E.g. `trailing_zeros(big(0))` is not meaningful; the underlying `MPZ.scan1`
returns `typemax(Culong)` to convey this. But we were converting to `Int`,
which gave either `InexactError` (not user-friendly) or `typemax(UInt32)`
on Windows, which was really meaningless. We now throw `DomainError`
on all architectures.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:bignums BigInt and BigFloat kind:bugfix This change fixes an existing bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants