Re: rounding issue
- Posted by mattlewis (admin) Aug 20, 2010
- 986 views
gwalters said...
I am having a rounding issue when comparing atoms. Here's the problem and I would like to know how to solve it.
[snip]
So do sequences store numbers as atoms with about 14-16 digits significance?
The short answer is not to store money in a floating point format, because you'll always have rounding issues, unless you're only computing binary fractions. This applies to any programming language.
You should store it as integral values of the smallest denomination you need (probably cents). Then do the conversion when required for display purposes.
Matt