Re: division by zero mystery



user923005 wrote:
CBFalconer wrote:

Or the FP unit can return +-INF for the division operation, and the
atan routine can recognize that and return the appropriate value.
Not luck, just QOI.

If with a,b we can obviously have 4 different sign states for a,b but
only two after the division. So what quadrant did the angle occur in?
This also matters for +/-INF because we can have {for example}
DBLE_MAX/DBLE_MIN or -DBLE_MAX/-DBLE_MIN which produce the same thing
(+INF) but for which the angle represented should be different.

I would hope that the atan(arg) routine is defined to return the
principal value. This may be in the range 0 .. PI, or -PI/2 ..
PI/2. atan(num, den) can cover the range 0..2PI. In any case the
division will be performed somewhere, and the above paragraph
applies.

Internally the detailed work is probably done by a routine that
covers only 0 .. PI/4 with an argument in 0 .. 1.

--
Merry Christmas, Happy Hanukah, Happy New Year
Joyeux Noel, Bonne Annee.
Chuck F (cbfalconer at maineline dot net)
<http://cbfalconer.home.att.net>


.



Relevant Pages