The result of FPU calculations depends on the maximally supported FPU precision
Original Reporter info from Mantis: m7sthe@uni-jena.de @heiko
-
Reporter name: Heiko
Original Reporter info from Mantis: m7sthe@uni-jena.de @heiko
- Reporter name: Heiko
Description:
Val returns different results for i386 and x86_64.
In addition, the accuracy is lost, although this is not necessary. The mantissa remains the same only the exponent changes.
Furthermore, this behavior should be documented.
The same applies to strtofloat, where the reference to val should also be placed.
Steps to reproduce:
program test;
begin
writeln ('Single');
val ('0.0001234',s,error);
writeln (s);
val ('1234E-7',s,error);
writeln (s);
val ('1234',s,error);
writeln (s/10000000);
val ('12340000',s,error);
writeln (s);
val ('1234E4',s,error);
writeln (s);
writeln ('Double');
val ('0.0001234',d,error);
writeln (d);
val ('1234E-7',d,error);
writeln (d);
val ('1234',d,error);
writeln (d/10000000);
val ('12340000',d,error);
writeln (d);
val ('1234E4',d,error);
writeln (d);
writeln ('Extended');
val ('0.0001234',e,error);
writeln (e);
val ('1234E-7',e,error);
writeln (e);
val ('1234',e,error);
writeln (e/10000000);
val ('12340000',e,error);
writeln (e);
val ('1234E4',e,error);
writeln (e);
end.
Additional information:
i386:
Single
1.233999938E-04
1.233999938E-04
1.234000000E-04 << here
1.234000000E+07
1.234000000E+07
Double
1.2339999999999999E-004
1.2339999999999999E-004
1.2340000000000000E-004 << here
1.2340000000000000E+007
1.2340000000000000E+007
Extended
1.23400000000000000001E-0004
1.23400000000000000001E-0004
1.23400000000000000001E-0004
1.23400000000000000000E+0007
1.23400000000000000000E+0007
x86_64:
Single
1.233999938E-04
1.233999938E-04
1.233999938E-04 << here
1.234000000E+07
1.234000000E+07
Double
1.2339999999999999E-004
1.2339999999999999E-004
1.2339999999999999E-004 << here
1.2340000000000000E+007
1.2340000000000000E+007
Extended
1.23400000000000000001E-0004
1.23400000000000000001E-0004
1.23400000000000000001E-0004
1.23400000000000000000E+0007
1.23400000000000000000E+0007
Mantis conversion info:
- Mantis ID: 34269
- OS: Linux
- OS Build: Mageia 6
- Build: 3.0.4 [2017/10/02] for x86_64
- Platform: Desktop
- Version: 3.0.4