#1908 rectform with large floats gives bad answer

closed
nobody
5
2010-03-22
2010-02-18
Stavros Macrakis
No

rectform(1e160/(1e160+%i)) => 0.0 (should be 1.0 - 1.0e-160)

We should probably special-case the float case to give better precision by avoiding underflow.

Discussion

  • Raymond Toy
    Raymond Toy
    2010-03-22

    Is this gcl? With cmucl, I get a floating-point overflow error. Not good, but better than returning 0.

     
  • Raymond Toy
    Raymond Toy
    2010-03-22

    A special case is added to risplit-expt to compute 1/(x+%i*y) carefully. With this change, we now get 1.0 - 9.99988867182683e-161 %i.

    See rpart.lisp, rev 1.32.

    Closing bug.

     
  • Raymond Toy
    Raymond Toy
    2010-03-22

    • status: open --> closed
     
  • Dan Gildea
    Dan Gildea
    2010-03-25

    This fix does not work with gcl (where rectform(1e160/(1e160+%i)) still gives 0.0)
    or with ecl (where it gives a floating point overflow lisp error).

    Bugs like this are hard to fix in a portable way - are they even worth worrying about?

     
  • Raymond Toy
    Raymond Toy
    2010-03-25

    This definitely needed to be fixed. That it doesn't work with gcl and ecl is a bug in gcl and ecl. The code basically calls (/ (complex x y)). If this overflows, it's a bug in gcl and ecl.

    Of course, we can do it portably, and my original version did this. These errors should be reported to gcl and ecl.