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

You shouldn't use fixed integers. What happens when you need to represent a fraction smaller than what your largest integer can?

For financial calculation you use a dynamic integer type that expand as needed.




For many financial applications, you know precisely in advance how many decimal points you need to be able to accommodate. E.g. for UK VAT calculations, you are never required to work it out to more than four decimal points (and can then round to 3).

I sort-of agree with you, in that it is easy to get bitten, and that if people have a dynamic integer type available on their platform that's probably safest. If the choice is between using integers for fixed point vs. using double's though, I'd go for the fixed point any day.




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

Search: