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

Thorsten Engler thorsten.engler at gmx.net
Sat Apr 28 11:28:46 CEST 2018


Basically that.

For doubles that don't fit into an Int64, any fraction is beyond the significant number of digits that the double can store anyway, so 0 is the valid and correct result for Frac in that case.

> -----Original Message-----
> From: fpc-devel <fpc-devel-bounces at lists.freepascal.org> On Behalf
> Of Mattias Gaertner
> Sent: Saturday, 28 April 2018 19:18
> To: fpc-devel at lists.freepascal.org
> Subject: Re: [fpc-devel] Broken frac function in FPC3.1.1 / Windows
> x86_64
> 
> 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
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel




More information about the fpc-devel mailing list