3 ms·
this is a common approach when you are dealing in rates less than .01 -- you just need to be sure you are rounding correctly
by mdellavo 5y ago
this is a common approach when you are dealing in rates less than .01 -- you just need to be sure you are rounding correctly
- IncRnd 5y agoWhen 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.
- 10000truths 5y agoWhen 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”.
- cjaybo 5y ago> store as bigint
- IncRnd 5y agoThank you. I made a mistake due to the starting comment in the thread.