[fpc-pascal] Floating point question

Thomas Kurz fpc.2021 at t-net.ruhr
Sat Jan 27 18:22:51 CET 2024


Hmmm... I don't think I can understand that. If the precision of "double" were that bad, it wouldn't be possible to store dates up to a precision of milliseconds in a TDateTime. I have a discrepancy of 40 seconds here.



----- Original Message ----- 
From: Bart via fpc-pascal <fpc-pascal at lists.freepascal.org>
To: FPC-Pascal users discussions <fpc-pascal at lists.freepascal.org>
Sent: Saturday, January 27, 2024, 17:03:15
Subject: [fpc-pascal] Floating point question

On Sat, Jan 27, 2024 at 1:40 PM Thomas Kurz via fpc-pascal
<fpc-pascal at lists.freepascal.org> wrote:


> My problems are:

> 1. The "writeln" in line 32 correctly prints "0.0000" when (cross-) compiling to win64, but "39.375" when compiling to win32 (with ppc386).
On Win64 all math is done with double precision, on win32 all literal
floating point values in your code will be interpreted as Extended.
Cast everything to Double and the result will be the same on Win64 and Win32.


-- 
Bart
_______________________________________________
fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal



More information about the fpc-pascal mailing list