| ▲ | AlotOfReading an hour ago | |||||||||||||
I recommend pretty much everyone avoid fixed point and other float alternatives, barring exceptional cases after you've done your own numerical analysis, or you lack floating point hardware (rare these days). Yes, fixed point can use simpler hardware. That's also a completely irrelevant consideration for software. The vast majority of processors are optimized for floats now and some operations (e.g. division) are actually faster. The precision argument also falls apart. Any float with mantissa >= X+Y can get exactly the same results as a QX.Y fixed point. The float will actually perform better across the same range because you have to round it to perform like the fixed point. That means more precision, lower error, automatic normalization, better overflow behavior, a larger working range, etc. And it'll probably be just as fast, unless you're bottlenecked on memory bandwidth of inputs (unlikely). When you inevitably want an exp() or another special function, it's a heck of a lot easier to call libm than implement your own and it will perform better. Floats are also much easier to get right for your coworkers that aren't numerical analysts. | ||||||||||||||
| ▲ | torginus an hour ago | parent | next [-] | |||||||||||||
I didn't recommend fixed point for simpler HW - I recommended it for better precision (if you know what you are doing). First, a point I didn't make, is that if you have 32 bits of fixed, you get way more precision than with a 32 bit float. But I can think of a pretty common case where a 24 bit int would win against a 32bit float: convolution filters. If you have a filter whose inputs are supposed to sum up to 1 (which is the most common case), integer computations mean that, even with internal overflows, the end result will be correct. In contrast, with floats, you can lose precision. If you apply said operation 10000x recursively (say, you are 'stepping' a simulation), those errors can add up bigtime. > Floats are also much easier to get right for your coworkers that aren't numerical analysts. That one is true, however, when you have people, such as EEs who really care about precision, and know the theory behind it, then floats are often not the obvious choice. It has other advantages, like your calculation running the exact same regardless of CPU and/or compiler, which I'm sure a lot of analysts care about. Afaik finance people don't even use floats for things like account balances, because you can't represent something like 0.1$ exactly. Fixed point has basically no language support, and is very hard to get right, but sometimes you need to do that. Do you have any subject matter expertise in quantization errors? Like doing simulations or DSP work? Not trying to be antagonistic, just figure out where you're coming form. | ||||||||||||||
| ▲ | Asraelite 33 minutes ago | parent | prev | next [-] | |||||||||||||
> The vast majority of processors are optimized for floats now and some operations (e.g. division) are actually faster. This seems backwards. Hardware is optimized for floats because people use floats. If people used fixed point, hardware would become optimized for that instead. Given an equal number of transistors, I'm pretty sure fixed point would be a lot faster on equally optimized hardware for almost all operations. | ||||||||||||||
| ▲ | hilariously an hour ago | parent | prev | next [-] | |||||||||||||
fixed-point provides uniform precision, exact integer-scaled arithmetic, is deterministic whereas floating point is more convenient but its not a panacea | ||||||||||||||
| ||||||||||||||
| ▲ | an hour ago | parent | prev [-] | |||||||||||||
| [deleted] | ||||||||||||||