HomeFreeBSD

libm: correctly test for for NaN and Infinity in sinpi(), cospi(), and tanpi()

Description

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

Details

Provenance
Steve Kargl <kargl@FreeBSD.org>Authored on Jul 17 2023, 5:19 AM
kibCommitted on Jul 17 2023, 5:23 AM
Parents
rGb8cc13fa21df: riscv pmap: another vm_radix_init
Branches
Unknown
Tags
Unknown