4 ms·
Floats are for math. Math includes computing things like 100! (100 factorial), the volume of the observable universe (~3.3* 10^80), or any other countably fini
by smlacy 15y ago
Floats are for math. Math includes computing things like 100! (100 factorial), the volume of the observable universe (~3.3* 10^80), or any other countably finite value, most of which are far greater than 2^128.
Fixed point is a special purpose encoding that is useful in many places (computer graphics and constrained simulations) when your range and precision are known and fixed. "Math" doesn't follow these rules.
Floats are good for math.
- eru 15y agoAnd I thought arbitrary precision integers and rational numbers were for mathematics.
- JabavuAdams 15y agoYou have it exactly backwards. 100 factorial cannot be represented by a float (or double, or long double) 100! = 9332621544394415268169923885626670049071596826438162146859296389521759\ 9993229915608941463976156518286253697920827223758251185210916864000000\ 000000000000000000 This is 2^(524.765) > 2^32 or 2^64 or 2^80 or 2^128 Note that "floating point" is commonly used to refer to 32-bit or 64-bit or 80-bit representations. Floats are for games (with caveats), and possibly engineering, while purer math needs arbitrary-precision representations that are too slow for games and many simulations.
- brazzy 15y agoFloats are primarily designed for engineering, and not just floats. Read the original von Neumann paper. Basically, out dominant computer architectur was originally designed to optimally support floating-point for numerical calculations. EDIT: I just looked at the paper again and realize that I was wrong. Von Neumann actually wanted to keep things simple and thus assumed all numbers to be normalized to be between -1 and 1...