3 ms·
What type do I get if I'm multiply four int32s?
by jefftk 4y ago
What type do I get if I'm multiply four int32s?
- captainmuon 4y agoIt should fit in 128 bits or in the range of [-2^128,2^128] (tiny bit narrower since max and min int32 are asymmetric). The question is what type do you want? Do you want the full result? Or do you want it to be modulo something? Or are you sure that the numbers are small, but just kept in int32 storage for some other reason? The compiler could use static analysis to keep the size to a minimum, for example in this case: int32 a int32 b = 2 var c = a * b it would know that c just needs 33 bits.