|
|
|
|
|
by kragen
2534 days ago
|
|
No, fixed-point math is typically faster than floating-point math (except if you have many, many more transistors devoted to the floating-point.) The only time floating-point is ever faster than fixed-point in practice is when (1) your points really are floating, so 13 decimal places of precision is fine, but the magnitude of the result ranges over many orders of magnitude (Fourier transform results and calculator apps being good examples); and when (2) the floating-point hardware can't be used for fixed-point calculations and would just sit idle if you didn't find something to run on it. The main reason people use floating-point math is convenience. It's like dynamic typing: write your real quadratic equation solver with floating-point math and you can use it for everything, whether the values are 6.02e23 or 555e-9, at the expense of having to do extra computation at run-time, just like dynamic typing lets you implement a single hash table type that works for any type of value. But in fixed-point, unless you're using a pretty fancy language, you need to decide on the magnitude range of your values up front. Maybe 3e-6 to 3e5? Use 16.16. Maybe 4e-3 to 1e11? Use 24.8. It's a pain in the bohonkus. But it's faster, more portable (if reproducible results are necessary) and easier to reason about than floating point. |
|