Thanks for the patch. I'm not 100% sure it's quite right since atan(y/x) is not the same as atan2(y,x).
If I look at the original source (from CMUCL, based on Kahan's paper), I see that divide-by-zero traps are disabled. To be equivalent, I think we only need to check for division by zero and instead of calling atan, just return pi/2 or -pi/2, as appropriate.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Add a tiny real part, and it's OK
(%i193) asinh(1.0b-1000+%i*2.0b0) ;
(%o193) 1.316957896924817b0-1.570796326794897b0*%i
The division by zero comes from complex-asin. A patch is attached.
Andrej
fpatan -> fpatan2
Thanks for the patch. I'm not 100% sure it's quite right since atan(y/x) is not the same as atan2(y,x).
If I look at the original source (from CMUCL, based on Kahan's paper), I see that divide-by-zero traps are disabled. To be equivalent, I think we only need to check for division by zero and instead of calling atan, just return pi/2 or -pi/2, as appropriate.
Fixed in CVS by checking for division by zero and returning pi/2 or -pi/2 as appropriate.