Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Also vaguely relevant https://0.30000000000000004.com/


Representing 1/10 with fractional powers of two is an infinite series, so tenth of a whole number will not be exactly representable with IEEE floating point.

In financial apps, it is perhaps more common to use specific numerical types that don't lose precision.

One simplistic option is to simply represent the smallest unit (say, tenths of a penny) with a fixed point number rather than a unit like USD dollars in floating point.




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

Search: