In other words does this work as expected?
int32 i = INT_MAX-1;
int64 j = i * i;
or do I need to cast the i to 64 bit first?
You need to cast at least one of the operands to the multiply. At the point the multiply is being done, the system doesn't know you're planning to assign to an int64.
(Unless int64 is actually the native int type for your particular system, which seems unlikely)
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