Forum OpenACS Q&A: Re: Tcl weird behaviour with math

Posted by Gustaf Neumann on
The best is to calculate internally the only the smallest unit (i.e. cents) in integers, calculate with these, and format these as required to dollar, euro, etc.

In the more general case, you might want to look into the tcl decimal arithmetic package:

In some simple cases, it might be sufficient to work with a comparison operator with an espilon fuzz value (e.g. withinEpsilon is

best regards
-gustaf neumann