4 ms·
> Floats are only necessary if we have huge dynamic range. Oh it’s not so surprising if you’ve used both floats and fixed a lot. There are very good reasons fl
by dahart 3y ago
> Floats are only necessary if we have huge dynamic range.
Oh it’s not so surprising if you’ve used both floats and fixed a lot. There are very good reasons floats are much more widely used today, and fixed point predates floats so if fixed was better it would come up more often. With fixed point, you always have to think about both the range and the resolution you want to represent, and that’s often a hassle and might require doing difficult analysis (or more likely throwing away precision for safety). Fixed point numbers also have a non-uniform relative precision - the ratio between steps changes across it’s range, and this can be a disadvantage for a lot of computations. The relative precision of fixed is actually kind-of opposite of what most people need, it gets higher the larger the magnitude.
Floats are much easier because the relative precision is roughly constant, you always know you have ~7 decimal digits worth of mantissa, and because the range is huge so most people don’t have to worry about overflow or underflow (especially for intermediate results!), and the range goes really small as well, which is useful. Float precision, unlike fixed point, is kind-of scale invariant within the float’s range.
It’s not an accident at all that float usage dominates hardware and software, it’s very intentional and people like it. There are good uses for fixed-point too, and they’re used all the time, and it makes use of integer hardware, but on the whole fixed point numbers are much more difficult to use casually than floats.