Skip to content

bignum too big to convert into `long' (RangeError) #199

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

Closed
casperisfine opened this issue Nov 9, 2021 · 4 comments · Fixed by #200
Closed

bignum too big to convert into `long' (RangeError) #199

casperisfine opened this issue Nov 9, 2021 · 4 comments · Fixed by #200

Comments

@casperisfine
Copy link

On current ruby 3.1:

>> BigDecimal::VERSION
=> "3.1.0-dev"
>> BigDecimal(-10000000000000000000)
(irb):2:in `BigDecimal': bignum too big to convert into `long' (RangeError)

On 3.0:

>> BigDecimal::VERSION
=> "3.0.0"
>> BigDecimal(-10000000000000000000)
=> -0.1e20
@casperisfine
Copy link
Author

Actually, it seems that the trigger is Ruby 3.1 and not the latest bigdecimal version. I'll try to track this down.

@casperisfine
Copy link
Author

Ok, so the problem is in 4792a91

When dealing with signed integers, comparing rb_absint_size to sizeof long is no longer correct.

cc @mrkn

@mrkn
Copy link
Member

mrkn commented Nov 12, 2021

@casperisfine Thank you for reporting and investigating this!

@mrkn mrkn closed this as completed in #200 Nov 12, 2021
@casperisfine
Copy link
Author

Thanks for the merge!

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 a pull request may close this issue.

2 participants