3 ms·
You use them when their downsides aren't excessive (e.g. the error is tolerable) and/or when their upsides are attractive (e.g. you need the speed of raw hardwa
by hansvm 6y ago
You use them when their downsides aren't excessive (e.g. the error is tolerable) and/or when their upsides are attractive (e.g. you need the speed of raw hardware floats, and you might be doing math on numbers of vastly different orders of magnitude).
Specific examples include differential equation solvers (vastly different orders of magnitude to deal with), plotting libraries (only have to be correct to within a pixel), and a ton of other graphics-related operations for that matter (only have to be correct to within a pixel, and most classes of small errors won't be important anyway).
Some amount of error can even be desirable (see a lot of the work the last half-decade in reduced precision neural networks).
Floats aren't bad -- they're a tool in your toolbox, and they won't hammer every nail.