Within the erf() function, my code was getting hanging on this statement
if (x < 0.0) {
return -erf(-x);
}
due to -x not being successfully passed into the recursive call (i.e. it was still negative).
Both
double a;
if (x < 0.0) {
a = -1.0*x;
return -erf(a);
}
and
if (x < 0.0) {
return -erf(fabs(x));
}
work, as did changing the implementation back to the scipy.special one.
Also noting that the following did not work.
if (x < 0.0) {
return -erf(-1.0*x);
}
This PR implements fabs() approach to fix the issue. It was chosen after discussion with @aki-nishimura for simplicity and to avoid any potential other issues with doing a -1 multiplication.
This problem occurred in the following environments:
Kubuntu 21.04, gcc version Ubuntu 10.3.0-1ubuntu1
Mint 20.1, gcc version Ubuntu 9.3.0-17ubuntu1~20.04 (Mint 20.1 is based on Ubuntu 20.04)
It worked fine for me on windows 10 and all OS's pass on Github Actions, where ubuntu-20.04 is currently the latest supported linux version.
Exact root cause of this issue has not been investigated.
Within the erf() function, my code was getting hanging on this statement
due to
-x
not being successfully passed into the recursive call (i.e. it was still negative).Both
and
work, as did changing the implementation back to the
scipy.special
one.Also noting that the following did not work.
This PR implements
fabs()
approach to fix the issue. It was chosen after discussion with @aki-nishimura for simplicity and to avoid any potential other issues with doing a -1 multiplication.This problem occurred in the following environments:
It worked fine for me on windows 10 and all OS's pass on Github Actions, where ubuntu-20.04 is currently the latest supported linux version.
Exact root cause of this issue has not been investigated.