Re: [fpc-pascal] Floating point question

2024-01-27 Thread Bart via fpc-pascal
On Sat, Jan 27, 2024 at 1:40 PM Thomas Kurz via fpc-pascal wrote: > 2. According to both C, Sqlite and Excel, the value of "t" in line 41 should > be "8427.0229167". FPC gives me a difference of approximately 39/86400. Again: if I cast all flots involved to double both the result of

Re: [fpc-pascal] Floating point question

2024-01-27 Thread Bart via fpc-pascal
On Sat, Jan 27, 2024 at 1:40 PM Thomas Kurz via fpc-pascal wrote: > My problems are: > > 1. The "writeln" in line 32 correctly prints "0." 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

Re: [fpc-pascal] Floating point question

2024-01-27 Thread Thomas Kurz via fpc-pascal
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 To: FPC-Pascal

Re: [fpc-pascal] Floating point question

2024-01-27 Thread Adriaan van Os via fpc-pascal
Thomas Kurz via fpc-pascal wrote: 1. The "writeln" in line 32 correctly prints "0." when (cross-) compiling to win64, but "39.375" when compiling to win32 (with ppc386). Maybe the word "cross-compiling" gives a clue ? In a cross-compiler, floating-point operations of constants must be

Re: [fpc-pascal] Floating point question

2024-01-27 Thread Bart via fpc-pascal
On Sat, Jan 27, 2024 at 6:23 PM Thomas Kurz via fpc-pascal wrote: > 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.

[fpc-pascal] Floating point question

2024-01-27 Thread Thomas Kurz via fpc-pascal
Hello, I'm facing some strange floating-point issues and cannot find what's actually wrong. OS is win64, but I'm even getting different results when targeting to win32. Please consider the following program: program test1; {$mode objfpc} function maketime (ayear, amonth, aday, ahour,