Skip to content
Snippets Groups Projects
Forked from cmucl / cmucl
Source project has a limited visibility.
  • rtoy's avatar
    3e0a1c82
    Fix some issues with the complex functions with signed zeroes. See · 3e0a1c82
    rtoy authored
    comment for full details, but the issue is that Lisp says mixing a
    real and a complex requires converting the real to complex before
    doing the operation.  But Kahan's algorithms assume that this doesn't
    happen, like z-1 should not be computed as z-(1+0*i).
    
    One place where this was wrong was for acos(2 +/- 0i).  Kahan says
    acos(2+0i) is +0 - i*acosh(2) and acos(2-0i) is +0 + i*acosh(2).  We
    had this backwards for the above reason.
    
    I think this was caused by the erroneous deftransforms for real op
    complex which were removed sometime ago, causing these function to
    compute the wrong thing.
    3e0a1c82
    History
    Fix some issues with the complex functions with signed zeroes. See
    rtoy authored
    comment for full details, but the issue is that Lisp says mixing a
    real and a complex requires converting the real to complex before
    doing the operation.  But Kahan's algorithms assume that this doesn't
    happen, like z-1 should not be computed as z-(1+0*i).
    
    One place where this was wrong was for acos(2 +/- 0i).  Kahan says
    acos(2+0i) is +0 - i*acosh(2) and acos(2-0i) is +0 + i*acosh(2).  We
    had this backwards for the above reason.
    
    I think this was caused by the erroneous deftransforms for real op
    complex which were removed sometime ago, causing these function to
    compute the wrong thing.