4 ms·
The use of arbitrary-precision decimals instead of floats comes with a very severe performance penalty. And for what benefit? So you can represent values to a g
by jcranmer 7y ago
The use of arbitrary-precision decimals instead of floats comes with a very severe performance penalty. And for what benefit? So you can represent values to a greater precision than your ability to measure them accurately?
Almost anything you'd want to use a non-integer number for is going to be difficult to nail down to 5 or 6 decimal digits of precision on (honestly, even 3 is pushing it). Double-precision floats gives you 11 decimal digits of precision--ample room for accumulated round-off error to not affect the final result, unless you've got numerical instabilities.
- saagarjha 7y agoDoubles give you around 15-16 (according to DBL_DIG) digits of precision, don't they?
- jcranmer 7y agoYou're right, I mixed it up with the 11 bits of exponent.
- anamexis 7y agoTo your point, I think one of the places where you see 6 decimal places actually put to use is with latitude and longitude, where 6 decimal digits gets you to 11cm of precision. (11 digits gets you to a micrometer.)