Re: Free42  A Complex glitch? Message #17 Posted by Thomas Okken on 13 Sept 2011, 10:24 p.m., in response to message #16 by Thomas Okken
It looks like a branch cut issue. Both the <= 1.4.66 and the >= 1.4.67 code are correct in strictly analytical terms; the former calculates ASIN by multiplying x by i, calculating ASINH, then multiplying by i, while the latter swaps the real and imaginary parts of x, then calculates ASINH, then swaps the real and imaginary parts back. For a complex analytical function that is also odd, those two approaches are mostly equivalent, *except* for the edge cases. It looks like fixing the behavior near re(z)=infinity broke the behavior near im(z)=0. The results that Free42 returns aren't wrong, but they don't follow the conventions used by the HP42S (or maybe that means they *are* wrong, and I just didn't realize what the commonly accepted conventions are). If anyone can point me to a reference that lists those conventions, I'd appreciate it! If not, I'll have to spend some time doing some research on how to handle the edge cases correctly.
Note that the code that handles the cases where X is real and x>1 are handled by code that's completely separate from the code that handles the case that X is complex (even if the imaginary part is zero). The code for real X where x>1 uses arcsin(x)=pi/2i*arccosh(x) if x>0 and arcsin(x)=pi/2+i*arccosh(x) if x<0, and that gives results that match the HP42S. This code did not change in release 1.4.67. (Hmmm, maybe I should use the same algorithm for the complex case?)
Edited: 13 Sept 2011, 10:38 p.m.
