libm: correctly test for for NaN and Infinity in sinpi(), cospi(), and tanpi()
The current versions of lib/msun/src/s_cospi.c, s_sinpi.c and s_tanpi.c all exhibit the same defect. After checking for various numeric ranges, they check to see whether the input argument is a NaN or an Infinity. However, the code uses a value of 0x7f80000 instead of the correct value of 0x7ff00000. If you review s_cospif.c, s_sinpif.c, and s_tanpif.c, you will see that the equivalent statements in these functions are accurate and have appropriate source comments. The impact of these defects is to flag some valid input values as invalid and raise a pole error (divide by zero). Reported by: Paul Green <Paul.Green@stratus.com> PR: 272539 MFC after: 1 week
This commit is contained in:
parent
b8cc13fa21
commit
be4c7f2735
@ -138,7 +138,8 @@ cospi(double x)
|
||||
return (j0 & 1 ? -c : c);
|
||||
}
|
||||
|
||||
if (ix >= 0x7f800000)
|
||||
/* x = +-inf or nan. */
|
||||
if (ix >= 0x7ff00000)
|
||||
return (vzero / vzero);
|
||||
|
||||
/*
|
||||
|
@ -155,7 +155,8 @@ sinpi(double x)
|
||||
return ((hx & 0x80000000) ? -s : s);
|
||||
}
|
||||
|
||||
if (ix >= 0x7f800000)
|
||||
/* x = +-inf or nan. */
|
||||
if (ix >= 0x7ff00000)
|
||||
return (vzero / vzero);
|
||||
|
||||
/*
|
||||
|
@ -163,7 +163,7 @@ tanpi(double x)
|
||||
}
|
||||
|
||||
/* x = +-inf or nan. */
|
||||
if (ix >= 0x7f800000)
|
||||
if (ix >= 0x7ff00000)
|
||||
return (vzero / vzero);
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user