I am trying to save the number 10^19 in a variable in Julia.
I know it is overflowing, but I figured that doing something like BigInt(10^19)
or Int128(10^19)
would solve the problem but it doesn't.
Any thoughts?
See overflow behavior for Julia
Julia does Int64 arithmetic by default, so the 10^19 overflows as the default Int64 before the surrounding parentheses casting to a bigger type are encountered. Try
Int128(10)^20 == BigInt(10)^20 == big"10"^20
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With