[Cfp-interest 3269] Re: Specification of complex operators

Paul Zimmermann Paul.Zimmermann at inria.fr
Wed Sep 11 23:01:13 PDT 2024


       Hi Damian,

> > Avoidance of intermediate overflows is not so easy. For cmulf all 3 compilers gcc, icx and
> > clang give the wrong result for the following example (x1, y1, x2, y2):
> >
> >    {-0x1.80a55ep+0,-0x1.1bfep+80,0x1.ap+64,-0x1.54c296p+127}, /* gcc Inf */
> >    {-0x1.80a55ep+0,-0x1.1bfep+80,0x1.ap+64,-0x1.54c296p+127}, /* icx Inf */
> >    {-0x1.80a55ep+0,-0x1.1bfep+80,0x1.ap+64,-0x1.54c296p+127}, /* clang Inf */
> 
> Shouldn't these yield a number whose real and imaginary components are 
> both an infinity?

indeed

> My quick C version yields a real component which is infinity but an 
> imaginary component which is a NaN.

yes this is what we get:

libm gives (-inf,-nan)
mpc gives (-inf,-inf)

thus we consider the error is infinite in this case.
A complex multiply should never yield NaN (if no NaN in the inputs).

Paul





More information about the Cfp-interest mailing list