Hacker News new | past | comments | ask | show | jobs | submit login

Decimal floating point would hardly affect accuracy compared to binary floating point -- with the exception of domains where the inputs and output are strictly human-readable and human-precise constructs (e.g. banking... is there a better term for this?).

Binary floating point can accurately represent fractions of the form 1/(2^n). Decimal floating point can accurately represent fractions of the form 1/((2^n)*(5^m)). Either can only approximate fractions with other prime factors in the denominator (1/3, 1/7, 1/11, ...).

In terms of a programmer having to be concerned with accumulated errors due to approximations in the representation, I'd assert that decimal floating point in no way changes the scope of concerns or approach to numeric programming compared to binary floating point. I'd guess even in a domain with a very precise need of fractional decimals, a programmer would still need to reason about and account for numeric representation errors in decimal floating point such as overflow and underflow.




> Decimal floating point would hardly affect accuracy compared to binary floating point

The larger the radix, the more of the mantissa is wasted. Given fixed storage, base 2 floats will have higher precision over their range than higher bases, like 10 and 16.

The difference is easy to illustrate with base 16 and base 2, since we can convert between the two easily. Converting a base 16 float to base 2 will result in leading zeroes some of the time, which could have been used for storing data. The same is true with base 10, but you have to do more math to demonstrate it.


You could just expand the mantissa to account for the base providing more range, though I do agree using a small base is better in general.


> I'd assert that decimal floating point in no way changes the scope of concerns or approach to numeric programming compared to binary floating point.

Agree. What problem does this solve? That I can now represent 1/5 precisely?

All the other problems of representing floating point numbers and numbers generally are maintained.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: