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

Florian Klämpfl florian at freepascal.org
Sun May 13 14:59:20 CEST 2018


Am 11.05.2018 um 23:59 schrieb Benito van der Zander:
> Hi,
> 
> after all these discussions about the frac function, what is the best way to test if there is a
> fractional part? That is the most common thing I use frac for
> 
> I have always used frac(x) = 0
> 
> Is that worse or better than int(x) = x  ?

int(x) is probably the better way because frac calculates int(x) first and then subtracts this part
from x (basically).



More information about the fpc-pascal mailing list