problem adding complex to newlib/cygwin

Marco Atzeri marco_atzeri@yahoo.it
Mon Oct 4 14:38:00 GMT 2010


--- Lun 4/10/10, Corinna Vinschen  ha scritto:

> 
> Btw., you'll note that cabs and cabsf are already
> available
> (from newlib/libm/math/w[f]_cabs.c files):
> 
>   cabs NOSIGFE
>   _cabs = cabs NOSIGFE
>   cabsf NOSIGFE
>   _cabsf = cabsf NOSIGFE
> 

I know, the potential problem is that they are slight different
I need to test if the implementation is the same or not.
The cleanest way should be to use the new version:

---------------------------------------------
double
cabs(double complex z)
{

        return hypot(__real__ z, __imag__ z);
}
----------------------------------------------
versus the previous one

-------------------------------------------
struct complex {
        double x;
        double y;
};

double
cabs(z)
        struct complex z;
{
        return hypot(z.x, z.y);
}
-------------------------------------------


> The underscore variations are there as a result of a wrong
> sense of
> backward compatibility.  We don't do that anymore for
> new functions.
> So, you just have to add the version without leading
> underscore, for
> instance:
> 
>   cexp NOSIGFE
>   cexpf NOSIGFE
> 

thanks for the guidance

> 
> Corinna
> 
> -- 

Marco







More information about the Cygwin-developers mailing list