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

this is a common approach when you are dealing in rates less than .01 -- you just need to be sure you are rounding correctly


When you are approximating fixed-point using floating-point there is a lot more you need to do correctly other than roun ding. Your representation must have enough precision and range for the beginning inputs, intermediate results, and final results. You must be able to represent all expected numbers. And on. There is a lot more involved than what you mentioned.

Of course, if you are willing to get incorrect results, such as in play money, this may be okay.


When did mdellavo anything about floating point? You can, and should, use plain old fixed-point arithmetic for currency. That’s what he means by “microdollar”.


> store as bigint


Thank you. I made a mistake due to the starting comment in the thread.




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

Search: