12 ms·
> the development of double precision floating point So refreshing to hear that a double is good enough for JPL when repeatedly told it's not good enough for m
by karmakaze 8y ago
> the development of double precision floating point
So refreshing to hear that a double is good enough for JPL when repeatedly told it's not good enough for mere dollars and cents.
- perl4ever 8y agoNew Horizons is a mere few billion miles/km away, while financial matters these days sometimes involve trillions. Plus extra digits for cents and fractions thereof, of course. “There are 10^11 stars in the galaxy. That used to be a huge number. But it’s only a hundred billion. It’s less than the national deficit! We used to call them astronomical numbers. Now we should call them economical numbers.” - Richard Feynman
- dekhn 8y agoi know you're joking but it's really the precision at large numbers that makes doubles so valuable. Typically when somebody is steering a spacecraft to a remote location, the large distance as well as the fine precision needs to be represented. I am not aware of people working with very large sums of money who also need penny-level precision (and even then, floats aren't the right solution).
- planteen 8y agoJPL also has PhD applied mathematicians on staff to ensure numerical stability of their algorithms at double precision. Most developers do not have the ability to do that sort of non-trivial analysis. They are not just blindly saying "a double is good enough."
- mikeash 8y agoIt’s good enough for dollars and cents if you put thought into it, but you can’t just represent money as double-precision dollars and expect to get the results you need.
- vidarh 8y agoThe problem with floating point for money is that simple calculations can give different answers than you would like because of how numbers are represented. E.g in a JS console: > 0.1 * 0.1 <- 0.010000000000000002 This matters whenever you do things where the error might be allowed to accumulate and you're not careful to control for it. The general advice to avoid floating point for money is not because it's impossible to do correctly, but because it's very easy to get wrong in ways that are hard to discover with testing, and doing it with money is one of those areas where it's easy to get it wrong in ways that people will care about (because you're suddenly paying the wrong amount of tax, for example). I don't know about you, but I don't trust myself to get this right, much less developers who often don't understand the issues involved.
- dekhn 8y agofloating point was designed for scientific and numerical/math applications (written by people with numerical analysis skills), not money. There are decimal data types which are much better for money management.