[fpc-pascal] floating point an FPC

Jonas Maebe jonas.maebe at elis.ugent.be
Mon Mar 1 22:48:37 CET 2010

On 01 Mar 2010, at 22:32, ik wrote:

> So if I need for example to compare currency or something that is floating
> point, how do I do that ?

If it's currency, use the currency type. The currency type is fixed point, not floating point, and that's exactly because floating point is inexact while fixed point is not.

If you have to compare actual floating point values, then you have to realise from the start that your comparison will be inexact. That's why there are functions such as math.SameValue() that allow you to specify the precision to use when determining whether or not two values are "the same".


More information about the fpc-pascal mailing list