> From: Greg Steuck <[email protected]>
> Date: Sun, 09 Jan 2022 12:47:14 -0800
> 
> Greg Steuck <[email protected]> writes:
> 
> > This was reduced from a ghc test. The results of the program differ
> > between OpenBSD 7.0-current-amd64 and a couple of other systems:
> 
> Thanks to phessler@ for testing on arm64 where the bug doesn't happen.
> This patch makes OpenBSD-amd64 work the rest of the systems. I added
> i386 as it was also similarly broken (but didn't test the change yet).

As I said on icb, NetBSD removed all of the x86 assembly sin/cos/tan
implementations because:

  "The x87 hardware uses a bad approximation to pi for argument reduction"

So I think we should use the software fallbacks for all of these
functions (and remove the broken assembly implementations).

I don't think it makes sense to just remove tanf() and leave the
others in place.


> diff --git a/lib/libm/Makefile b/lib/libm/Makefile
> index 47cd94cac06..552e97ea0d3 100644
> --- a/lib/libm/Makefile
> +++ b/lib/libm/Makefile
> @@ -26,7 +26,7 @@ ARCH_SRCS = e_acos.S e_asin.S e_atan2.S e_exp.S e_fmod.S 
> e_log.S e_log10.S \
>           s_log1p.S s_log1pf.S s_logb.S s_logbf.S \
>           s_llrint.S s_llrintf.S s_lrint.S s_lrintf.S s_rint.S s_rintf.S\
>           s_scalbnf.S s_significand.S s_significandf.S \
> -         s_sin.S s_sinf.S s_tan.S s_tanf.S
> +         s_sin.S s_sinf.S s_tan.S
>  .elif (${MACHINE_ARCH} == "amd64")
>  .PATH:       ${.CURDIR}/arch/amd64
>  CPPFLAGS+=-I${.CURDIR}/arch/amd64
> @@ -39,7 +39,7 @@ ARCH_SRCS = e_acos.S e_asin.S e_atan2.S e_exp.S e_fmod.S 
> e_log.S e_log10.S \
>           s_log1p.S s_log1pf.S s_logb.S s_logbf.S \
>           s_llrint.S s_llrintf.S s_lrint.S s_lrintf.S \
>           s_rint.S s_rintf.S s_scalbnf.S s_significand.S \
> -         s_significandf.S s_sin.S s_sinf.S s_tan.S s_tanf.S
> +         s_significandf.S s_sin.S s_sinf.S s_tan.S
>  .elif (${MACHINE_ARCH} == "hppa")
>  .PATH:       ${.CURDIR}/arch/hppa
>  ARCH_SRCS = e_sqrt.c e_sqrtf.c e_remainder.c e_remainderf.c \
> 
> 

Reply via email to