-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
2^big(64) is an Int #13057
Comments
Wow, yes, this worked in 0.3. |
I'm sorry, i should have made a PR, but it seemed pretty unambiguous at the time. |
Of course, the funny part is, not even GMP itself supports raising a BigInt to a BigInt power, since if your exponent is that large you're kind of in trouble. |
What should be done here? Just revert d9bcdeb, or are there other ways that might satisfy both @my-little-repository and @nolta? |
I suppose on grounds that |
The problem with that line of reasoning is that in |
In my use case, the exponent is the argument of a function, ultimately provided by the user. In case of an integer overflow, the user can just provide a BigInt as an argument and the whole computation will switch to arbitrary precision. Sometimes we provide a BigInt as an input not because the input is a huge number, but because the computation leads to a huge output. Think about the factorial function. Or to some myexp2 function defined as Anyway, I am just pointing out an unexpected change in the 0.4 release candidate, I certainly can start writing two versions for each function that uses exponentiation, one for int, the other for bigint. By the way, exp2 is in base and we have
1.844674407370955161600000000000000000000000000000000000000000000000000000000000e+19 I think that it would be more natural to return a BigInt here instead of a BigFloat. Or explicitely warn in the documentation that this function is not meant for integer typed computations. |
Yes, on the whole I'd say we should switch back to the 0.3 behavior. People do expect bigints to "propagate". |
backported in #13107 |
Hi, I just tried the julia0.4rc. I see an unexpected behavior in some test. 2^big(64) is an Int, and thus underflows. I am pretty sure that this was a BigInt six month ago. Not sure if it is a bug though.
The text was updated successfully, but these errors were encountered: