[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gm2] GCC / GM2 Optimizer
From: |
Michael Riedl |
Subject: |
[Gm2] GCC / GM2 Optimizer |
Date: |
Mon, 30 Nov 2015 19:03:22 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 |
Hallo Gaius,
another curious result.
MODULE TestMachEps;
FROM STextIO IMPORT WriteLn;
FROM SLongIO IMPORT WriteFloat;
PROCEDURE MachEps() : LONGREAL;
VAR eps,EinsPlusEps : LONGREAL;
BEGIN
eps:=0.5; EinsPlusEps:=1.5;
WHILE (EinsPlusEps # 1.0) DO
eps:=0.5*eps;
EinsPlusEps:=1.0+eps;
END;
RETURN 2.0*eps;
END MachEps;
VAR eps : LONGREAL;
BEGIN
eps := MachEps();
WriteLn; WriteLn;
WriteString(" MachEps = "); WriteFloat(eps,20,10);
WriteLn; WriteLn;
END TestMachEps.
Compile attached with -O0 and with -O2. In the latter the machine
precision equals to zero ...
By the way - same behavior with REAL.
Gruß
Michael
PS : GFortran does not show this result - see attached Fortran 90. Maybe
that will give an idea as both are using the same backend.
TestMachEps.f90
Description: Text Data
- [Gm2] GCC / GM2 Optimizer,
Michael Riedl <=