Open fllor opened 4 weeks ago
It seems the failure of the 32-bit tests might be due to a bug somewhere in the floating point engine. The program
#StartFloat 64
Local X = 2/3;
Local Y = sqrt_(3);
Local Z = pi_;
ToFloat;
Evaluate;
Print;
.end
gives me
X = 6.66666666666666666667e-01;
Y = 1.73205080756887729352e+00;
Z = 3.14159265358979323846e+00;
on my laptop and
X = 6.66666666666666666666666666667e-;
Y = 1.7320508075688772935274463415e+0;
Z = 3.14159265358979323846264338328e+;
on the 32-bit containers.
For some reason, floats are evaluated to a different precision.
Also, note that Y
in the first case is not rounded correctly. In the second case the exponents are not printed properly.
I am not sure if this is a bug in Form or GMP/MPFR. The internal representations are already different in evaluate.c:668.
There is a known problem with the truncation of trailing zeros and messing up the exponent (see #492) which looks to be also the cause of the valgrind failures in your tests. So that needs to be sorted out but I didn't re-check it yet.
Jos said in his slides that float mode is not expected to work properly in 32bit mode, and it seems that it will be removed/declared "unsupported" for v5 anyway.
Once the valgrind errors are resolved you could also move your tests to features.frm rather than user-tests.frm.
Printing of exponents and valgrind errors should be fixed now. 32-bit tests will probably still fail.
This PR addresses some issues discussed during the workshop.
ee_
,em_
)Evaluate
statement to insert arbitrary precision floating point values for the three builtin constants (π
,e
,γ
). The values are provided (and cached) by MPFREvaluate
statement, e.g.Evaluate pi_
pi_*sqrt_(3)
,sqrt_(pi_)
,pi_*ee_
Furthermore, this PR fixes a bug in the printing of floating point numbers, that could cause exponents to be truncated and memory errors that would be lead to warnings in valgrind.