Hi everyone
Well, I’m new in this in general and just testing the REPL with random numbers.
Why this is happening and what I’ve to learn previous to declare operations like this one?
At first glance, you can tell that these numbers do not fit into a 64 bit integer, and hence we’ll only get the lower 64 bits (which will all be zero, as true_answer % (2^64) == 0, which you can tell from the fact that both numbers are even and both exponents are greater than 64).
Multiplying the other numbers by 0 will of course result in an answer of 0.
This is probably enough to be correct (multipications should go left to right, so making the first big should keep all intermediates big, and then we also need the two exponents).
The number is very large.
Far larger than the number you said Python gave.
I’d post it, but it is several times over the character limit.
Use BigInt, e.g by: big"234"^23423.
Also note, that in python the ^ operator is the xor operator, while in julia it is the exponentiation operator.
So unless you actually want xors, the result you got in python is not the one you expect.
(In python, the exponentiation operator is **)
is what you want.
Making the first of these a BigInt will keep the accumulation in BigInt as we move from left to right.
And, we also still need the exponents to be BigInt as well, hence I left the big on them.
CheckedArithmetic.jl provides a macro which checks for over/underflows in calculations.
SafeREPL.jl changes all number literals in the REPL to a different type, BigInts by default, so that you don’t get under/overflow. This will make most calculations slower, but is useful if you care more about correctness than speed.