[fpc-pascal] Freepascal Floating Point Issue

Bernd.Oppolzer at t-online.de Bernd.Oppolzer at t-online.de
Tue Aug 22 08:39:54 CEST 2017


https://www.facebook.com/notes/new-stanford-pascal-compiler/floating-point-output-differences-between-platforms/365845753799072
<https://www.facebook.com/notes/new-stanford-pascal-compiler/floating-point-output-differences-between-platforms/365845753799072> 
/

other Pascal Implementations have to provide solutions to this issue, too

Kind regards

Bernd



------------------------------------------------------------------------
Gesendet mit der Telekom Mail App
<http://www.t-online.de/service/redir/email_app_android_sendmail_footer.htm>


--- Original-Nachricht ---
Von: Sven Barth via fpc-pascal
Betreff: Re: [fpc-pascal] Freepascal Floating Point Issue
Datum: 22.08.2017, 7:54 Uhr
An: FPC-Pascal users discussions
Cc: Sven Barth



Am 22.08.2017 00:02 schrieb "James Richters" <
james at productionautomation.net <mailto:james at productionautomation.net> >:

The others already wrote about floating point precision, so I won't repeat 
that.

> The reason I noticed this is because I have some conditional statements 
like
> If Draw_GX_Min<>99.999 then
>     Something....

*DON'T* compare floating point numbers like that. Instead use SameValue() 
from the Math unit which has an additional epsilon value (with a default 
value) that defines a lower and upper bound from your desired value to 
compare to.

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20170822/86fdb315/attachment.html>
-------------- next part --------------
_______________________________________________
fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


More information about the fpc-pascal mailing list