(machar()).eps() wrong on i386
Status: Beta
Brought to you by:
m_schellens
On a i386 CPU, the single precision "EPS" is wrongly calculated:
GDL> print, (machar(double=0)).eps 1.08420e-19 GDL> print, (machar(double=1)).eps 1.0842022e-19
When I do the same on a x86_64 machine, I get:
GDL> print, (machar(double=0)).eps 1.19209e-07 GDL> print, (machar(double=1)).eps 2.2204460e-16
Since the value (for double=0
) is used as stepwidth in mpfit, mpfit fails on i386.
Interestingly, on another 32-bit platform (armhf), the value is correct:
GDL> print, (machar(double=0)).eps 1.19209e-07 GDL> print, (machar(double=1)).eps 2.2204460e-16
Hi Ole,
GDL implements (or is supposed to) this code . There are no apparent errors. I wonder what the above code gives on a i386?
I was able to replicate the bug on an old laptop (Ubuntu) and a VM in Debian 32b
yes, the current GDL code used a rather tricky way to compute that.
I made a few search and it seems that current C++ compilers do provide
interessting (simple) solutions but I had no time to test is.
http://www.cplusplus.com/reference/limits/numeric_limits/
Moved to github: https://github.com/gnudatalanguage/gdl/issues/38
Closing.