3 ms·
> One thing that probably has a good answer is why to use floats at all; even at 32 bits? Is there an advantage relative to using just 32 bit ints? Sibling com
by jsjohnst 2y ago
> One thing that probably has a good answer is why to use floats at all; even at 32 bits? Is there an advantage relative to using just 32 bit ints?
Sibling commenter gave a better detailed answer, but I will share a succinct tl;dr in case that’s more your desire.
INT32 maximum value: 2,147,483,647
FP32 maximum value: 3.4028235 x 10^38
If you need to exactly represent all digits between 10,000,000 and 1,000,000,000, then INT32 will handle it fine, but FP32 won’t. But instead if you need to represent a range of values from 1.00 to 35,003,986,674,493.00 and it’s ok to just be directionally accurate, FP32 has you covered.