-
Notifications
You must be signed in to change notification settings - Fork 230
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
Arbitrary precision integers (bignum) #1376
Comments
Scheme has full-numeric tower which includes big integer and big rational numbers. |
Related to this topic, I think one of Janet's current bignum-related problems is that it appears to support bignum but behaves strangely. Below are some examples. (tested on
Wouldn't it be better to generate an error rather than allowing abnormal behavior like above? In the long term, I hope that Janet will support bignum natively.
As above, Janet-big works normally only when bignum is provided as a string. |
The reason this happens is because Janet uses floating point numbers built-in. Loss of precision in floating point use-cases is normal and expected, there are some use-cases that explicitly depend on this. Typically, the way you're meant to use bignums is by starting from something that isn't a bignum, turning it into one, and then letting it "contaminate" the rest of the numbers it comes into contact with. I finally got around to this point on my list (thus why I'm commenting now) and am working on bindings to libtommath (which will coincidentally provide a lot of the desired functionality from prior discussions, such as |
Is there a convenient way to introduce arbitrary precision integers (bignum) in Janet? Perhaps through long strings?
The text was updated successfully, but these errors were encountered: