-
Notifications
You must be signed in to change notification settings - Fork 137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test failures when using icc #169
Comments
Since The
The
So does
And finally the Bessel functions seem to be completely wrong:
|
To make --- a/Make.inc
+++ b/Make.inc
@@ -43,8 +43,8 @@ CFLAGS_add += -fno-builtin -fno-strict-aliasing
endif
ifeq ($(USEGCC),1)
-CC = gcc
-CFLAGS_add += -fno-gnu89-inline -fno-builtin
+CC = icc
+CFLAGS_add += -fno-gnu89-inline -fno-builtin -fp-model=precise
endif
ARCH ?= $(shell $(CC) -dumpmachine | sed "s/\([^-]*\).*$$/\1/")
Then all tests pass:
|
The --- a/src/s_exp2.c
+++ b/src/s_exp2.c
@@ -342,6 +342,7 @@ exp2(double x)
{
double r, t, twopk, twopkp1000, z;
u_int32_t hx, ix, lx, i0;
+ volatile double t_;
int k;
/* Filter out exceptional cases. */
@@ -370,7 +371,8 @@ exp2(double x)
k = (i0 >> TBLBITS) << 20;
i0 = (i0 & (TBLSIZE - 1)) << 1;
t -= redux;
- z = x - t;
+ t_ = t;
+ z = x - t_;
/* Compute r = exp2(y) = exp2t[i0] * p(z - eps[i]). */
t = tbl[i0]; /* exp2t[i0] */ Then the It would be nice to figure out a cleaner option for the above. |
Ok, I finally figured out what it is doing. Here is a much better patch: --- a/src/s_exp2.c
+++ b/src/s_exp2.c
@@ -369,7 +369,7 @@ exp2(double x)
i0 += TBLSIZE / 2;
k = (i0 >> TBLBITS) << 20;
i0 = (i0 & (TBLSIZE - 1)) << 1;
- t -= redux;
+ t = floor(x*TBLSIZE) / (double)TBLSIZE;
z = x - t;
/* Compute r = exp2(y) = exp2t[i0] * p(z - eps[i]). */ Now at least the The new code is obviously slower, but perhaps there is a way to speed it up. |
Got rid of the multiplication and division: --- a/src/s_exp2.c
+++ b/src/s_exp2.c
@@ -369,7 +369,7 @@ exp2(double x)
i0 += TBLSIZE / 2;
k = (i0 >> TBLBITS) << 20;
i0 = (i0 & (TBLSIZE - 1)) << 1;
- t -= redux;
+ t = ldexp(floor(ldexp(x, TBLBITS)), -TBLBITS);
z = x - t;
/* Compute r = exp2(y) = exp2t[i0] * p(z - eps[i]). */ I think this is probably as simple as it gets, while still being mathematically correct. A good compiler like I did check however that |
Discovered a slight mistake: --- a/src/s_exp2.c
+++ b/src/s_exp2.c
@@ -369,7 +369,7 @@ exp2(double x)
i0 += TBLSIZE / 2;
k = (i0 >> TBLBITS) << 20;
i0 = (i0 & (TBLSIZE - 1)) << 1;
- t -= redux;
+ t = ldexp(floor(ldexp(x, TBLBITS)+0.5), -TBLBITS);
z = x - t;
/* Compute r = exp2(y) = exp2t[i0] * p(z - eps[i]). */ Both versions work for the test suite, but only this latter actually works for all values of |
I submitted a fix in #170. |
I first tested with gcc, and all tests pass. Then I applied the following patch:
And recompiled with
icc
16.0.2. Everything compiled and here are the test errors that I got:The text was updated successfully, but these errors were encountered: