[cfp-interest 3474] Re: Range error conditions for atan2 and atan2pi

Damian McGuckin damianm at esi.com.au
Tue May 27 17:14:28 PDT 2025


On Tue, 27 May 2025, Jim Thomas wrote:

>> 
>> atan:
>>
>>  ... occurs if x is nonzero and too close to zero
>> 
>> atan2:
>>
>>  ... occurs if y/x is nonzero and too close to zero and x is positive (B)
>> OR
>>  ... occurs if x is positive and y/x is nonzero and too close to zero (C)
>> 
>> That also avoids having a double usage of 'if'.
>
> (A) has the advantage that it matches the atan wording without requiring 
> a change to atan.

Yes, but not as natural.

> (C) has the advantage that the "x is positive" condition is stated 
> first, which seems to me the more natural order of thinking about the 
> conditions.

Yes.

> Consider also
>
> ... occurs if both x is positive and also nonzero y/x is too close to zero (D)
>
> which has both advantages.

Great minds think alike.  But then I looked at qualifications of domains 
in Annex F and Annex G last night and 'both' was never used. So I did not 
mention it at the time.

But on checking Section 7 right now, 'both' is used very sparingly like 
your (D) the above.  So, as there is a precedent in the standard, I think 
I now prefer (D).

Thanks - Damian


More information about the cfp-interest mailing list