mirror of
git://git.musl-libc.org/musl
synced 2025-01-10 08:39:56 +00:00
fix potentially wrong-sign zero in cproj functions at infinity
these are specified to use the sign of the imaginary part of the input as the sign of zero in the result, but wrongly copied the sign of the real part.
This commit is contained in:
parent
52f0deb969
commit
75b3412f3d
@ -3,6 +3,6 @@
|
||||
double complex cproj(double complex z)
|
||||
{
|
||||
if (isinf(creal(z)) || isinf(cimag(z)))
|
||||
return CMPLX(INFINITY, copysign(0.0, creal(z)));
|
||||
return CMPLX(INFINITY, copysign(0.0, cimag(z)));
|
||||
return z;
|
||||
}
|
||||
|
@ -3,6 +3,6 @@
|
||||
float complex cprojf(float complex z)
|
||||
{
|
||||
if (isinf(crealf(z)) || isinf(cimagf(z)))
|
||||
return CMPLXF(INFINITY, copysignf(0.0, crealf(z)));
|
||||
return CMPLXF(INFINITY, copysignf(0.0, cimagf(z)));
|
||||
return z;
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ long double complex cprojl(long double complex z)
|
||||
long double complex cprojl(long double complex z)
|
||||
{
|
||||
if (isinf(creall(z)) || isinf(cimagl(z)))
|
||||
return CMPLXL(INFINITY, copysignl(0.0, creall(z)));
|
||||
return CMPLXL(INFINITY, copysignl(0.0, cimagl(z)));
|
||||
return z;
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user