[PATCH] Fix cexp when both real and imaginary parts of x are non-finite

Mark H Weaver mhw@netris.org
Wed Aug 1 03:02:00 GMT 2012


On 07/31/2012 06:07 PM, Joseph S. Myers wrote:
> On Tue, 31 Jul 2012, Mark H Weaver wrote:
>
>> The default implementations of cexp, cexpf, and cexpl are broken when
>> the real part of x is infinite and the imaginary part is non-finite
>> (infinite or NaN).
>>
>> In these cases, the complex phase of the result is indeterminate, and
>> thus the only two sensible results are 0.0 + i*0.0 (when the real part
>> of x is negative infinity) or NaN + i*NaN in all other cases.
>
> I believe the present results are in accordance with what C99 and C11
> (Annex G) specify  [...]

The C99 and C11 standards specify behavior that is mathematically 
incorrect.  Apparently too few people involved in C standardization 
understand complex exponentials.  What a damn shame.  I will have to 
avoid using cexp in Guile.

Thanks anyway for the prompt response.

      Mark



More information about the Libc-alpha mailing list