BUG: fix special case z = -1/e in lambertw#107
BUG: fix special case z = -1/e in lambertw#107ilanschnell wants to merge 5 commits intoscipy:mainfrom
Conversation
|
Thanks @ilanschnell. A test in |
|
Thanks @ilanschnell. However, returning -1 isn't quite right. The double precision floating point value This is the same kind of phenomenon observed when computing, for example, |
|
Thanks Warren, this is a good point. I've add the imaginary value. I'm working on adding |
It is a double precision floating point constant. The compiler won't store more than what fits in a double precision float, so writing it that way is no more precise than So there shouldn't be any need to change the literal constant or the expression that checks If the literal value ended with the |
|
While working on the new tests, I realized that when lowering the tolerance Therefore the comment remains valid, However, as no |
This PR fixes: scipy/scipy#24770
After inspecting the output of scipy's lambertw function near -1/e+0j, I found that only the branch point -1/e itself is the problem, as it will cause division by zero in Halley's method. When changing even the least significant (of the real or imaginary part of z), the method converges to the correct result.