4 ms·
most of this is solved by using big numbers, knowing about precision expansion for different fundamental operations, real numbers, and when to use rounding. it
by Uptrenda 6y ago
most of this is solved by using big numbers, knowing about precision expansion for different fundamental operations, real numbers, and when to use rounding. it is an insightful article but honestly i wouldnt expect to use the float type for precise math. computers are fast as hell. a bigger question to me is where to actually use floats since they never seems to be what i want.
- hansvm 6y agoYou 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.
- lern_too_spel 6y agoFor almost all of the problems I work on, I only care that the relative error is bounded. Floating point is perfect for me and, I would guess, most scientific calculations.