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: http://wiki.tcl.tk/28305

In some simple cases, it might be sufficient to work with a comparison operator with an espilon fuzz value (e.g. withinEpsilon is http://wiki.tcl.tk/879)

best regards

-gustaf neumann