Opened 10 years ago

Closed 10 years ago

#830 closed defect (fixed)

(abs #c(1d300 1d300)) signals overflow

Reported by: rtoy Owned by: rme
Priority: normal Milestone:
Component: ANSI CL Compliance Version: trunk
Keywords: Cc:


As the subject says, (abs #c(1d300 1d300)) signals an overflow. But in fact, the answer is approximately 1.414d300, which still fits in a double-float.

The implementation is probably just doing sqrt(x^2+y^2). A better answer can be achieved using |x|*sqrt(1+(y/x)^2) if |x| >= |y|, with obvious modifications for |x| <= |y|.

Change History (2)

comment:1 Changed 10 years ago by rme

  • Owner set to rme

comment:2 Changed 10 years ago by rme

  • Resolution set to fixed
  • Status changed from new to closed

(In [14673]) When computing the absolute value of a complex number, be a little more careful about it.

hypot in libm is even more careful, and one could certainly make the argument that we should just arrange to ff-call that.

This new version conses more than what we were previously doing, but seems to be about the same speed. If this ends up being a performance issue, writing a LAP version probably would not be too tough.

Fixes ticket:830.

Note: See TracTickets for help on using tickets.