[fpc-devel] Broken frac function in FPC3.1.1 / Windows x86_64

Mattias Gaertner nc-gaertnma at netcologne.de
Sat Apr 28 11:18:11 CEST 2018


On Sat, 28 Apr 2018 10:55:10 +0200
Sven Barth via fpc-devel <fpc-devel at lists.freepascal.org> wrote:

>[...]
> The question is whether we should really return 0 for numbers that would 
> cause an integer overflow as from the user's perspective of this 
> function integers aren't involved at all (after all one passes in a 
> floating point value and receives one).
> Maybe it would be better if we'd provide an optimized Int() function and 
> Frac() then simply stays "d - Int(d)".

Since a float only stores the highest bits of a number, the fraction
of a high number is not stored aka treated as 0.

Mattias



More information about the fpc-devel mailing list