2 ms·
They have the same kind of rounding problems - except in base 10 instead of 2.
by wolfgke 12y ago
They have the same kind of rounding problems - except in base 10 instead of 2.
- dragonwriter 12y ago> They have the same kind of rounding problems - except in base 10 instead of 2 Sure, but if you aren't dealing with transcendental functions but just typical input from people and arithmetic, you don't usually introduce as many errors by rounding to a base-10 representation, so decimal floating point solves a lot of the problems (at the cost of performance if you have a system that implements it over hardware that doesn't.) You still have the big + small problem, though.
- acqq 12y agoIt is proven that the binary FP accumulates errors slower than any other bigger base when the longer scientific calculations are involved. But when you want to represent something like money, there's by definition an error as soon as you want to store 0.01 as the binary FP, and the same error doesn't happen in decimal FP.
- wolfgke 12y agoOn the other hand: If your smallest unit of money is cents (or perhaps tenth of cents), you better use large integers to store the amount of money instead of base 10 floating point numbers.