3 ms·
Most conventions come from the days when computers were mostly used for scientific and military applications. But now we do more currency-oriented calculations,
by tabtab 8y ago
Most conventions come from the days when computers were mostly used for scientific and military applications. But now we do more currency-oriented calculations, the kind that used to be left to COBOL, which generally doesn't use floating point.
A newer approach is the "Decimal" type (name depends on system, I'm assuming Microsoft here). It's still floating point, but shrinks the exponent range/size and uses the freed bits for more decimal precision. Poor for computing the universe, but better at money. It's still not a perfect solution, but greatly reduces the chance of problems.
One should still be careful when computing with large amounts of money and/or lots of fractional rates.