Closed kagalenko-m-b closed 1 year ago
@stla can comment further, but it is known that most of the functions in this package do not (yet) reliably support extended precision. See Issue #11 for status of extended precision support. I've corrected the checklist there.
The epsilon
in CarlsonRF
is too small. Maybe removing the ^2
is fine.
This is not due to epsilon
. There's an infinite loop because of this strange thing:
> phi > pi/2
true
> phi - pi > -pi/2
false
Ok I changed the code and it works. Now the code deals with the comparison of phi / pi
with +/- 0.5
.
phi - pi > -pi/2 You probably already realized this, but because
pi
is of typeIrrational
, it has indefinitely large precision, depending on how it's used. So in the expressionphi - pi
it will be evaluated accurately to the same precision asphi
(256 bits or about 77 decimal digits). But in the right-hand side-pi/2
it will only be evaluated toFloat64
precision (53 bits or about 15 decimal digits). Hence the error. There are lots of this type of thing in the code base that will have to be fixed to support extended precision.
Ok. I already fixed in the elliptic integrals.
I have not looked at the code, but from the error message it seems to me that the iterative algorithm to compute the integral is implemented recursively, and there's no hard limit on the depth of recursion. Perhaps, rewriting it as a loop with conditional termination and fixed upper number of iterations would enhance the robustness of the software? It is one thing to not provide all correct significant digits, but failure to return any answer at all on certain inputs seems like a serious bug.
It is fixed now.
Thanks ! Although there might be another multiprecision issue coming up :)
If, instead, the second argument is
big"0.81"
, the computation hangs while CPU goes to 100%. If the last digit ofphi=big".."
is deleted, the computation returns normally.