Hi all,
I did the check using mingw-w64 on msys2.
I got correct 1.9999999999999998 stably.
I repeated 10 times.
So, that issue seems not related with my problem.
Still, my problem is mystery for me. I'll invest more.
Any comments and suggestions will be appreciated.
Best,
Takashi
On 2020/08/07 0:37, Takashi Inoue wrote:
Hi,
Thank you for your interesting suggestion.
I made a sample code. I attach.
With GCC(gfortran) on FreeBSD, I get 1.9999999999999998 correctly.
I'll check result of mingw-w64 as soon as I arrive at my office tomorrow,
since I'm at home and the PC with mingw-w64 is there.
Best,
Takashi
On 08/06/20 23:36, Liu Hao wrote:
在 2020/8/6 13:25, Takashi Inoue 写道:
Hi,
Did you compile your program with the i686 compiler or the x86_64 compiler? I
suspect it has something to do with the
floating-point environment.
My windows is 64bit version widows 8.1.
So, I installed x86_64 package via msys2 pacman.
Would you please check the sum of
1.9999999999999998
and
1.1102230246251564e-16,
in both the main thread and an OMP thread?
IEEE-conforming double precision (with a 53-bit mantissa) arithmetic shall yield
1.9999999999999998,
while a defective implementation (for example, if your FORTRAN compiler
performs 64-bit addition with x87, rounds the result
accordingly, then double-rounds it to 53-bit precision), you may get 2.0 [1].
The mingw-w64 CRT initializes the x87 control word to 64-bit precision, in
contrast to MSVCRT which defaults to 53-bit
precision, and may produce unexpected results under rare circumstances.
[1]https://wandbox.org/permlink/v63VObkDke527VrJ
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public