[fpc-pascal] testing if a float has a fractional part

Bart bartjunk64 at gmail.com
Tue May 15 13:14:01 CEST 2018


On Sun, May 13, 2018 at 3:40 PM, Jonas Maebe <jonas at freepascal.org> wrote:

> The only proper way is to use something like Math.SameValue(x, int(x)).
> Never use equality tests with floating point values, unless you are checking
> for a specific bit pattern (or if you know that the value can always be
> represented exactly a sum of power-of-two's).

Just curious.

If Frac(x) equals zero, will Int(x) cahnge the bitpattern of x then?
(Or: it cannot be gueranteed that this will not be the case?)

Bart



More information about the fpc-pascal mailing list