diff options
Diffstat (limited to 'lib/msun')
300 files changed, 330 insertions, 761 deletions
diff --git a/lib/msun/Makefile b/lib/msun/Makefile index 8bc984c2c342..24989749a502 100644 --- a/lib/msun/Makefile +++ b/lib/msun/Makefile @@ -1,5 +1,3 @@ -# @(#)Makefile 5.1beta 93/09/24 -# # ==================================================== # Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. # @@ -28,7 +26,7 @@ CFLAGS+= -I${.CURDIR}/x86 CFLAGS+= -I${.CURDIR}/ld80 .elif ${LDBL_PREC} == 113 .PATH: ${.CURDIR}/ld128 -CFLAGS+= -I${.CURDIR}/ld128 +CFLAGS+= -I${.CURDIR}/ld128 -I${SRCTOP}/contrib/arm-optimized-routines/math .endif CFLAGS+= -I${.CURDIR}/${ARCH_SUBDIR} @@ -97,17 +95,27 @@ COMMON_SRCS+= s_cospi.c s_cospif.c \ s_sinpi.c s_sinpif.c \ s_tanpi.c s_tanpif.c +# LIBCSRCDIR is defined lazily, so can't be used for exists() below +LIBC_SRCTOP=${SRCTOP}/lib/libc # Location of fpmath.h and _fpmath.h -.if exists(${LIBCSRCDIR}/${MACHINE_ARCH}) -LIBC_ARCH=${MACHINE_ARCH} + +# Pick the current architecture directory for libc. In general, this is named +# MACHINE_CPUARCH, but some ABIs are different enough to require their own libc, +# so allow a directory named MACHINE_ARCH to override this (though treat +# powerpc64le and powerpc64 the same). +# Note: This is copied from libc/Makefile +M=${MACHINE_ARCH:S/powerpc64le/powerpc64/} +.if exists(${LIBC_SRCTOP}/${M}) +LIBC_ARCH=${M} .else LIBC_ARCH=${MACHINE_CPUARCH} .endif -CFLAGS+= -I${.CURDIR}/src -I${LIBCSRCDIR}/include \ - -I${LIBCSRCDIR}/${LIBC_ARCH} + +CFLAGS+= -I${.CURDIR}/src -I${LIBC_SRCTOP}/include \ + -I${LIBC_SRCTOP}/${LIBC_ARCH} SYM_MAPS+= ${.CURDIR}/Symbol.map -VERSION_DEF= ${LIBCSRCDIR}/Versions.def +VERSION_DEF= ${LIBC_SRCTOP}/Versions.def SYMBOL_MAPS= ${SYM_MAPS} # C99 long double functions @@ -146,7 +154,8 @@ COMMON_SRCS+= catrig.c catrigf.c \ s_cproj.c s_cprojf.c s_creal.c s_crealf.c s_creall.c \ s_csinh.c s_csinhf.c s_ctanh.c s_ctanhf.c -# FreeBSD's C library supplies these functions: +# FreeBSD's C library supplies these functions (but note we still have s_frexp.c +# and s_isnan.c enabled above, so they are duplicated): #COMMON_SRCS+= s_fabs.c s_frexp.c s_isnan.c s_ldexp.c s_modf.c # Exclude the generic versions of what we provide in the MD area. diff --git a/lib/msun/Symbol.map b/lib/msun/Symbol.map index 6e74918ade6e..4d5a5e4d7e6e 100644 --- a/lib/msun/Symbol.map +++ b/lib/msun/Symbol.map @@ -88,7 +88,6 @@ FBSD_1.0 { exp2f; expm1; expm1f; - fabs; fabsf; fabsl; fdim; diff --git a/lib/msun/aarch64/Makefile.inc b/lib/msun/aarch64/Makefile.inc index 82463110f1bb..fcc744878220 100644 --- a/lib/msun/aarch64/Makefile.inc +++ b/lib/msun/aarch64/Makefile.inc @@ -1,4 +1,3 @@ - LDBL_PREC = 113 # Use a builtin when it generates the needed instruction diff --git a/lib/msun/aarch64/fenv.h b/lib/msun/aarch64/fenv.h index 2148a68b053b..a435a9de5223 100644 --- a/lib/msun/aarch64/fenv.h +++ b/lib/msun/aarch64/fenv.h @@ -31,6 +31,7 @@ #ifndef _FENV_H_ #define _FENV_H_ +#include <sys/cdefs.h> #include <sys/_types.h> #ifndef __fenv_static diff --git a/lib/msun/amd64/Makefile.inc b/lib/msun/amd64/Makefile.inc index 6a99005f6701..dcdc2495d690 100644 --- a/lib/msun/amd64/Makefile.inc +++ b/lib/msun/amd64/Makefile.inc @@ -1,4 +1,3 @@ - ARCH_SRCS = e_fmod.S e_fmodf.S e_fmodl.S \ e_remainder.S e_remainderf.S e_remainderl.S \ e_sqrt.S e_sqrtf.S e_sqrtl.S \ diff --git a/lib/msun/amd64/fenv.c b/lib/msun/amd64/fenv.c index 2aea6a4cf036..4d271f8d456a 100644 --- a/lib/msun/amd64/fenv.c +++ b/lib/msun/amd64/fenv.c @@ -26,7 +26,6 @@ * SUCH DAMAGE. */ -#include <sys/cdefs.h> #include <sys/types.h> #include <machine/fpu.h> diff --git a/lib/msun/arm/Makefile.inc b/lib/msun/arm/Makefile.inc index a52552766e36..6e3ddb351dd3 100644 --- a/lib/msun/arm/Makefile.inc +++ b/lib/msun/arm/Makefile.inc @@ -1,4 +1,3 @@ - LDBL_PREC = 53 SYM_MAPS += ${.CURDIR}/arm/Symbol.map diff --git a/lib/msun/arm/fenv.c b/lib/msun/arm/fenv.c index 9f172d5fd7c9..05b3adb05f81 100644 --- a/lib/msun/arm/fenv.c +++ b/lib/msun/arm/fenv.c @@ -32,10 +32,6 @@ #include <machine/acle-compat.h> -#if __ARM_ARCH >= 6 -#define FENV_ARMv6 -#endif - /* When SOFTFP_ABI is defined we are using the softfp ABI. */ #if defined(__VFP_FP__) && !defined(__ARM_PCS_VFP) #define SOFTFP_ABI @@ -52,7 +48,7 @@ const fenv_t __fe_dfl_env = 0; /* If this is a non-mangled softfp version special processing is required */ -#if defined(FENV_MANGLE) || !defined(SOFTFP_ABI) || !defined(FENV_ARMv6) +#if defined(FENV_MANGLE) || !defined(SOFTFP_ABI) /* * The following macros map between the softfloat emulator's flags and diff --git a/lib/msun/arm/fenv.h b/lib/msun/arm/fenv.h index 5dded5d744fd..e8a30fcf496f 100644 --- a/lib/msun/arm/fenv.h +++ b/lib/msun/arm/fenv.h @@ -29,6 +29,7 @@ #ifndef _FENV_H_ #define _FENV_H_ +#include <sys/cdefs.h> #include <sys/_types.h> #ifndef __fenv_static diff --git a/lib/msun/bsdsrc/b_exp.c b/lib/msun/bsdsrc/b_exp.c index 398755a0aaeb..44cd5190de92 100644 --- a/lib/msun/bsdsrc/b_exp.c +++ b/lib/msun/bsdsrc/b_exp.c @@ -29,8 +29,6 @@ * SUCH DAMAGE. */ -/* @(#)exp.c 8.1 (Berkeley) 6/4/93 */ -#include <sys/cdefs.h> /* EXP(X) * RETURN THE EXPONENTIAL OF X * DOUBLE PRECISION (IEEE 53 bits, VAX D FORMAT 56 BITS) diff --git a/lib/msun/bsdsrc/b_log.c b/lib/msun/bsdsrc/b_log.c index aeec29368412..a82140bb98b5 100644 --- a/lib/msun/bsdsrc/b_log.c +++ b/lib/msun/bsdsrc/b_log.c @@ -29,8 +29,6 @@ * SUCH DAMAGE. */ -/* @(#)log.c 8.2 (Berkeley) 11/30/93 */ -#include <sys/cdefs.h> /* Table-driven natural logarithm. * * This code was derived, with minor modifications, from: diff --git a/lib/msun/bsdsrc/b_tgamma.c b/lib/msun/bsdsrc/b_tgamma.c index cc9f8f70297e..a7e97bc777c3 100644 --- a/lib/msun/bsdsrc/b_tgamma.c +++ b/lib/msun/bsdsrc/b_tgamma.c @@ -42,8 +42,6 @@ * porting to other precisions. */ -/* @(#)gamma.c 8.1 (Berkeley) 6/4/93 */ -#include <sys/cdefs.h> #include <float.h> #include "math.h" @@ -261,7 +259,7 @@ small_gam(double x) static double smaller_gam(double x) { - double d, rhi, rlo, t, xhi, xlo; + double d, t, xhi, xlo; struct Double r; if (x < x0 + left) { diff --git a/lib/msun/bsdsrc/mathimpl.h b/lib/msun/bsdsrc/mathimpl.h index 3d6554747dac..a4d081c3f02f 100644 --- a/lib/msun/bsdsrc/mathimpl.h +++ b/lib/msun/bsdsrc/mathimpl.h @@ -31,14 +31,11 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * @(#)mathimpl.h 8.1 (Berkeley) 6/4/93 */ #ifndef _MATHIMPL_H_ #define _MATHIMPL_H_ -#include <sys/cdefs.h> #include <math.h> #include "../src/math_private.h" diff --git a/lib/msun/i387/Makefile.inc b/lib/msun/i387/Makefile.inc index d0f22572b36d..73feb52de6a2 100644 --- a/lib/msun/i387/Makefile.inc +++ b/lib/msun/i387/Makefile.inc @@ -1,4 +1,3 @@ - ARCH_SRCS = e_exp.S e_fmod.S e_log.S e_log10.S \ e_remainder.S e_sqrt.S s_ceil.S s_copysign.S \ s_finite.S s_floor.S s_llrint.S s_logb.S s_lrint.S \ diff --git a/lib/msun/i387/fenv.c b/lib/msun/i387/fenv.c index 958c8a87b2fa..ebb4111a5fa6 100644 --- a/lib/msun/i387/fenv.c +++ b/lib/msun/i387/fenv.c @@ -26,7 +26,6 @@ * SUCH DAMAGE. */ -#include <sys/cdefs.h> #include <sys/types.h> #include <machine/npx.h> diff --git a/lib/msun/i387/invtrig.c b/lib/msun/i387/invtrig.c index 523f022e0546..50d8d3af9343 100644 --- a/lib/msun/i387/invtrig.c +++ b/lib/msun/i387/invtrig.c @@ -26,7 +26,6 @@ * SUCH DAMAGE. */ -#include <sys/cdefs.h> #include <stdint.h> #define STRUCT_DECLS diff --git a/lib/msun/ld128/b_tgammal.c b/lib/msun/ld128/b_tgammal.c index 4bae4f3aded6..6df7264a4c9e 100644 --- a/lib/msun/ld128/b_tgammal.c +++ b/lib/msun/ld128/b_tgammal.c @@ -1,55 +1,12 @@ /*- * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2013 David Chisnall - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. + * Copyright (c) 2024 The FreeBSD Foundation */ -#include <float.h> -#include <math.h> - /* - * If long double is not the same size as double, then these will lose - * precision and we should emit a warning whenever something links against - * them. + * This is a pure C function generously donated by ARM. + * See src/contrib/arm-optimized-routines/math/tgamma128.[ch]. */ -#if (LDBL_MANT_DIG > 53) -#define WARN_IMPRECISE(x) \ - __warn_references(x, # x " has lower than advertised precision"); -#else -#define WARN_IMPRECISE(x) -#endif -/* - * Declare the functions as weak variants so that other libraries providing - * real versions can override them. - */ -#define DECLARE_WEAK(x)\ - __weak_reference(imprecise_## x, x);\ - WARN_IMPRECISE(x) - -#define DECLARE_IMPRECISE(f) \ - long double imprecise_ ## f ## l(long double v) { return f(v); }\ - DECLARE_WEAK(f ## l) - -DECLARE_IMPRECISE(tgamma); +#define tgamma128 tgammal +#include "tgamma128.c" diff --git a/lib/msun/ld128/e_lgammal_r.c b/lib/msun/ld128/e_lgammal_r.c index e3d97b6d18b7..f8079b79d7fa 100644 --- a/lib/msun/ld128/e_lgammal_r.c +++ b/lib/msun/ld128/e_lgammal_r.c @@ -1,4 +1,3 @@ -/* @(#)e_lgamma_r.c 1.3 95/01/18 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,7 +9,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* * See e_lgamma_r.c for complete comments. * diff --git a/lib/msun/ld128/e_powl.c b/lib/msun/ld128/e_powl.c index fd8b57b66bd5..f5a993cf0054 100644 --- a/lib/msun/ld128/e_powl.c +++ b/lib/msun/ld128/e_powl.c @@ -59,7 +59,6 @@ * */ -#include <sys/cdefs.h> #include <float.h> #include <math.h> diff --git a/lib/msun/ld128/e_rem_pio2l.h b/lib/msun/ld128/e_rem_pio2l.h index 35ed0b865a7c..0ea1a706f3aa 100644 --- a/lib/msun/ld128/e_rem_pio2l.h +++ b/lib/msun/ld128/e_rem_pio2l.h @@ -1,4 +1,3 @@ -/* From: @(#)e_rem_pio2.c 1.4 95/01/18 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -13,7 +12,6 @@ * Optimized by Bruce D. Evans. */ -#include <sys/cdefs.h> /* ld128 version of __ieee754_rem_pio2l(x,y) * * return the remainder of x rem pi/2 in y[0]+y[1] @@ -56,7 +54,7 @@ pio2_2t = 2.0670321098263988236496903051604844e-43L, /* 0x127044533e63a0105df5 pio2_3 = 2.0670321098263988236499468110329591e-43L, /* 0x127044533e63a0105e00000000000.0p-254 */ pio2_3t = -2.5650587247459238361625433492959285e-65L; /* -0x159c4ec64ddaeb5f78671cbfb2210.0p-327 */ -static inline __always_inline int +static __always_inline int __ieee754_rem_pio2l(long double x, long double *y) { union IEEEl2bits u,u1; diff --git a/lib/msun/ld128/invtrig.c b/lib/msun/ld128/invtrig.c index cd9a276b68d1..75aef7b5166a 100644 --- a/lib/msun/ld128/invtrig.c +++ b/lib/msun/ld128/invtrig.c @@ -26,7 +26,6 @@ * SUCH DAMAGE. */ -#include <sys/cdefs.h> #include "invtrig.h" /* diff --git a/lib/msun/ld128/k_cosl.c b/lib/msun/ld128/k_cosl.c index 8280378c429c..c7562664bd3c 100644 --- a/lib/msun/ld128/k_cosl.c +++ b/lib/msun/ld128/k_cosl.c @@ -1,4 +1,3 @@ -/* From: @(#)k_cos.c 1.3 95/01/18 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -11,7 +10,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* * ld128 version of k_cos.c. See ../src/k_cos.c for most comments. */ diff --git a/lib/msun/ld128/k_expl.h b/lib/msun/ld128/k_expl.h index 71924f16c8a4..86811dd8e089 100644 --- a/lib/msun/ld128/k_expl.h +++ b/lib/msun/ld128/k_expl.h @@ -30,7 +30,6 @@ * Optimized by Bruce D. Evans. */ -#include <sys/cdefs.h> /* * ld128 version of k_expl.h. See ../ld80/s_expl.c for most comments. * diff --git a/lib/msun/ld128/k_sinl.c b/lib/msun/ld128/k_sinl.c index ca54f9f1a630..f2b17ba0eeb3 100644 --- a/lib/msun/ld128/k_sinl.c +++ b/lib/msun/ld128/k_sinl.c @@ -1,4 +1,3 @@ -/* From: @(#)k_sin.c 1.3 95/01/18 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -11,7 +10,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* * ld128 version of k_sin.c. See ../src/k_sin.c for most comments. */ diff --git a/lib/msun/ld128/k_tanl.c b/lib/msun/ld128/k_tanl.c index daff6b2bde8c..8aff0d1fc0d3 100644 --- a/lib/msun/ld128/k_tanl.c +++ b/lib/msun/ld128/k_tanl.c @@ -1,5 +1,3 @@ -/* From: @(#)k_tan.c 1.5 04/04/22 SMI */ - /* * ==================================================== * Copyright 2004 Sun Microsystems, Inc. All Rights Reserved. @@ -11,7 +9,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* * ld128 version of k_tan.c. See ../src/k_tan.c for most comments. */ diff --git a/lib/msun/ld128/s_cexpl.c b/lib/msun/ld128/s_cexpl.c index 1e4141f162c5..9e3eebfa750e 100644 --- a/lib/msun/ld128/s_cexpl.c +++ b/lib/msun/ld128/s_cexpl.c @@ -26,7 +26,6 @@ * SUCH DAMAGE. */ -#include <sys/cdefs.h> #include <complex.h> #include <float.h> #include <math.h> diff --git a/lib/msun/ld128/s_erfl.c b/lib/msun/ld128/s_erfl.c index 43ba2f0bed8b..227c31fd096b 100644 --- a/lib/msun/ld128/s_erfl.c +++ b/lib/msun/ld128/s_erfl.c @@ -1,4 +1,3 @@ -/* @(#)s_erf.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,7 +9,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* * See s_erf.c for complete comments. * diff --git a/lib/msun/ld128/s_exp2l.c b/lib/msun/ld128/s_exp2l.c index 74ae8c2daad8..249cb4cb8bb0 100644 --- a/lib/msun/ld128/s_exp2l.c +++ b/lib/msun/ld128/s_exp2l.c @@ -26,7 +26,6 @@ * SUCH DAMAGE. */ -#include <sys/cdefs.h> #include <float.h> #include <stdint.h> diff --git a/lib/msun/ld128/s_expl.c b/lib/msun/ld128/s_expl.c index 6d6c22d917fe..e1358e2213a0 100644 --- a/lib/msun/ld128/s_expl.c +++ b/lib/msun/ld128/s_expl.c @@ -28,7 +28,6 @@ * Optimized by Bruce D. Evans. */ -#include <sys/cdefs.h> /* * ld128 version of s_expl.c. See ../ld80/s_expl.c for most comments. */ diff --git a/lib/msun/ld128/s_logl.c b/lib/msun/ld128/s_logl.c index 8961dd0c96db..e9133ec66fd2 100644 --- a/lib/msun/ld128/s_logl.c +++ b/lib/msun/ld128/s_logl.c @@ -26,7 +26,6 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include <sys/cdefs.h> /** * Implementation of the natural logarithm of x for 128-bit format. * @@ -445,7 +444,7 @@ struct ld { #endif #ifdef STRUCT_RETURN -static inline __always_inline void +static __always_inline void k_logl(long double x, struct ld *rp) #else long double diff --git a/lib/msun/ld80/e_lgammal_r.c b/lib/msun/ld80/e_lgammal_r.c index cfd73b408b87..9f8b8f0f98bb 100644 --- a/lib/msun/ld80/e_lgammal_r.c +++ b/lib/msun/ld80/e_lgammal_r.c @@ -1,4 +1,3 @@ -/* @(#)e_lgamma_r.c 1.3 95/01/18 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,7 +9,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* * See e_lgamma_r.c for complete comments. * diff --git a/lib/msun/ld80/e_powl.c b/lib/msun/ld80/e_powl.c index 2daf26aab93b..d04d77a5ee98 100644 --- a/lib/msun/ld80/e_powl.c +++ b/lib/msun/ld80/e_powl.c @@ -14,7 +14,6 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include <sys/cdefs.h> #include <math.h> #include "math_private.h" @@ -24,10 +23,10 @@ * P[0] x^n + P[1] x^(n-1) + ... + P[n] */ static inline long double -__polevll(long double x, long double *PP, int n) +__polevll(long double x, const long double *PP, int n) { long double y; - long double *P; + const long double *P; P = PP; y = *P++; @@ -43,10 +42,10 @@ __polevll(long double x, long double *PP, int n) * x^n + P[0] x^(n-1) + P[1] x^(n-2) + ... + P[n] */ static inline long double -__p1evll(long double x, long double *PP, int n) +__p1evll(long double x, const long double *PP, int n) { long double y; - long double *P; + const long double *P; P = PP; n -= 1; @@ -114,7 +113,6 @@ __p1evll(long double x, long double *PP, int n) * */ -#include <sys/cdefs.h> #include <float.h> #include <math.h> @@ -128,13 +126,13 @@ __p1evll(long double x, long double *PP, int n) /* log(1+x) = x - .5x^2 + x^3 * P(z)/Q(z) * on the domain 2^(-1/32) - 1 <= x <= 2^(1/32) - 1 */ -static long double P[] = { +static const long double P[] = { 8.3319510773868690346226E-4L, 4.9000050881978028599627E-1L, 1.7500123722550302671919E0L, 1.4000100839971580279335E0L, }; -static long double Q[] = { +static const long double Q[] = { /* 1.0000000000000000000000E0L,*/ 5.2500282295834889175431E0L, 8.4000598057587009834666E0L, @@ -143,7 +141,7 @@ static long double Q[] = { /* A[i] = 2^(-i/32), rounded to IEEE long double precision. * If i is even, A[i] + B[i/2] gives additional accuracy. */ -static long double A[33] = { +static const long double A[33] = { 1.0000000000000000000000E0L, 9.7857206208770013448287E-1L, 9.5760328069857364691013E-1L, @@ -178,7 +176,7 @@ static long double A[33] = { 5.1094857432705833910408E-1L, 5.0000000000000000000000E-1L, }; -static long double B[17] = { +static const long double B[17] = { 0.0000000000000000000000E0L, 2.6176170809902549338711E-20L, -1.0126791927256478897086E-20L, @@ -201,7 +199,7 @@ static long double B[17] = { /* 2^x = 1 + x P(x), * on the interval -1/32 <= x <= 0 */ -static long double R[] = { +static const long double R[] = { 1.5089970579127659901157E-5L, 1.5402715328927013076125E-4L, 1.3333556028915671091390E-3L, @@ -232,13 +230,13 @@ static long double R[] = { static const long double MAXLOGL = 1.1356523406294143949492E4L; static const long double MINLOGL = -1.13994985314888605586758E4L; static const long double LOGE2L = 6.9314718055994530941723E-1L; -static volatile long double z; -static long double w, W, Wa, Wb, ya, yb, u; +static _Thread_local volatile long double z; +static _Thread_local long double w, W, Wa, Wb, ya, yb, u; static const long double huge = 0x1p10000L; #if 0 /* XXX Prevent gcc from erroneously constant folding this. */ static const long double twom10000 = 0x1p-10000L; #else -static volatile long double twom10000 = 0x1p-10000L; +static _Thread_local volatile long double twom10000 = 0x1p-10000L; #endif static long double reducl( long double ); diff --git a/lib/msun/ld80/e_rem_pio2l.h b/lib/msun/ld80/e_rem_pio2l.h index d9e4d3a0941f..b39e63b72afc 100644 --- a/lib/msun/ld80/e_rem_pio2l.h +++ b/lib/msun/ld80/e_rem_pio2l.h @@ -1,4 +1,3 @@ -/* From: @(#)e_rem_pio2.c 1.4 95/01/18 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -13,7 +12,6 @@ * Optimized by Bruce D. Evans. */ -#include <sys/cdefs.h> /* ld80 version of __ieee754_rem_pio2l(x,y) * * return the remainder of x rem pi/2 in y[0]+y[1] @@ -68,7 +66,7 @@ pio2_2t = 6.36831716351095013979e-25L, /* 0xc51701b839a25205.0p-144 */ pio2_3t = -2.75299651904407171810e-37L; /* -0xbb5bf6c7ddd660ce.0p-185 */ #endif -static inline __always_inline int +static __always_inline int __ieee754_rem_pio2l(long double x, long double *y) { union IEEEl2bits u,u1; diff --git a/lib/msun/ld80/invtrig.c b/lib/msun/ld80/invtrig.c index 0e2d49546391..76eb681454d3 100644 --- a/lib/msun/ld80/invtrig.c +++ b/lib/msun/ld80/invtrig.c @@ -26,7 +26,6 @@ * SUCH DAMAGE. */ -#include <sys/cdefs.h> #include "invtrig.h" /* diff --git a/lib/msun/ld80/k_cosl.c b/lib/msun/ld80/k_cosl.c index e76d429b90ef..371c360aa2ce 100644 --- a/lib/msun/ld80/k_cosl.c +++ b/lib/msun/ld80/k_cosl.c @@ -1,4 +1,3 @@ -/* From: @(#)k_cos.c 1.3 95/01/18 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -11,7 +10,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* * ld80 version of k_cos.c. See ../src/k_cos.c for most comments. */ diff --git a/lib/msun/ld80/k_expl.h b/lib/msun/ld80/k_expl.h index 8c3617e4b177..fabf5a792205 100644 --- a/lib/msun/ld80/k_expl.h +++ b/lib/msun/ld80/k_expl.h @@ -30,7 +30,6 @@ * Optimized by Bruce D. Evans. */ -#include <sys/cdefs.h> /* * See s_expl.c for more comments about __k_expl(). * diff --git a/lib/msun/ld80/k_sinl.c b/lib/msun/ld80/k_sinl.c index 21c1946b5e1b..ffc00be23f1c 100644 --- a/lib/msun/ld80/k_sinl.c +++ b/lib/msun/ld80/k_sinl.c @@ -1,4 +1,3 @@ -/* From: @(#)k_sin.c 1.3 95/01/18 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -11,7 +10,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* * ld80 version of k_sin.c. See ../src/k_sin.c for most comments. */ diff --git a/lib/msun/ld80/k_tanl.c b/lib/msun/ld80/k_tanl.c index 4965c669979f..b3a4d9e05255 100644 --- a/lib/msun/ld80/k_tanl.c +++ b/lib/msun/ld80/k_tanl.c @@ -1,5 +1,3 @@ -/* From: @(#)k_tan.c 1.5 04/04/22 SMI */ - /* * ==================================================== * Copyright 2004 Sun Microsystems, Inc. All Rights Reserved. @@ -11,7 +9,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* * ld80 version of k_tan.c. See ../src/k_tan.c for most comments. */ diff --git a/lib/msun/ld80/s_cexpl.c b/lib/msun/ld80/s_cexpl.c index 81a4d727561b..cbe9dcd64099 100644 --- a/lib/msun/ld80/s_cexpl.c +++ b/lib/msun/ld80/s_cexpl.c @@ -28,7 +28,6 @@ * src/s_cexp.c converted to long double complex by Steven G. Kargl */ -#include <sys/cdefs.h> #include <complex.h> #include <float.h> #ifdef __i386__ diff --git a/lib/msun/ld80/s_erfl.c b/lib/msun/ld80/s_erfl.c index 362b4f07d6bc..047077ca4470 100644 --- a/lib/msun/ld80/s_erfl.c +++ b/lib/msun/ld80/s_erfl.c @@ -1,4 +1,3 @@ -/* @(#)s_erf.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,7 +9,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* * See s_erf.c for complete comments. * diff --git a/lib/msun/ld80/s_exp2l.c b/lib/msun/ld80/s_exp2l.c index 94aecf1843cd..9d979994ece8 100644 --- a/lib/msun/ld80/s_exp2l.c +++ b/lib/msun/ld80/s_exp2l.c @@ -26,7 +26,6 @@ * SUCH DAMAGE. */ -#include <sys/cdefs.h> #include <float.h> #include <stdint.h> diff --git a/lib/msun/ld80/s_expl.c b/lib/msun/ld80/s_expl.c index 065e02fae1b0..03d7b366151a 100644 --- a/lib/msun/ld80/s_expl.c +++ b/lib/msun/ld80/s_expl.c @@ -28,7 +28,6 @@ * Optimized by Bruce D. Evans. */ -#include <sys/cdefs.h> /** * Compute the exponential of x for Intel 80-bit format. This is based on: * diff --git a/lib/msun/ld80/s_logl.c b/lib/msun/ld80/s_logl.c index 459374d7d164..7141abe086d5 100644 --- a/lib/msun/ld80/s_logl.c +++ b/lib/msun/ld80/s_logl.c @@ -26,7 +26,6 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include <sys/cdefs.h> /** * Implementation of the natural logarithm of x for Intel 80-bit format. * @@ -445,7 +444,7 @@ struct ld { #endif #ifdef STRUCT_RETURN -static inline __always_inline void +static __always_inline void k_logl(long double x, struct ld *rp) #else long double diff --git a/lib/msun/man/acos.3 b/lib/msun/man/acos.3 index b7b3a2eb7f17..e21687c1bb66 100644 --- a/lib/msun/man/acos.3 +++ b/lib/msun/man/acos.3 @@ -25,8 +25,6 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" from: @(#)acos.3 5.1 (Berkeley) 5/2/91 -.\" .Dd July 31, 2008 .Dt ACOS 3 .Os diff --git a/lib/msun/man/acosh.3 b/lib/msun/man/acosh.3 index db0104b0bdd2..0268bde8e092 100644 --- a/lib/msun/man/acosh.3 +++ b/lib/msun/man/acosh.3 @@ -25,8 +25,6 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" from: @(#)acosh.3 5.2 (Berkeley) 5/6/91 -.\" .Dd June 9, 2013 .Dt ACOSH 3 .Os diff --git a/lib/msun/man/asin.3 b/lib/msun/man/asin.3 index 03a9145ce065..20dc7ac1f54c 100644 --- a/lib/msun/man/asin.3 +++ b/lib/msun/man/asin.3 @@ -25,8 +25,6 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" from: @(#)asin.3 5.1 (Berkeley) 5/2/91 -.\" .Dd July 31, 2008 .Dt ASIN 3 .Os diff --git a/lib/msun/man/asinh.3 b/lib/msun/man/asinh.3 index c706f2c14e46..66515fa6ac0b 100644 --- a/lib/msun/man/asinh.3 +++ b/lib/msun/man/asinh.3 @@ -25,8 +25,6 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" from: @(#)asinh.3 6.4 (Berkeley) 5/6/91 -.\" .Dd June 9, 2013 .Dt ASINH 3 .Os diff --git a/lib/msun/man/atan.3 b/lib/msun/man/atan.3 index 0cda6fb2d8f9..d04787ce8bfe 100644 --- a/lib/msun/man/atan.3 +++ b/lib/msun/man/atan.3 @@ -25,8 +25,6 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" from: @(#)atan.3 5.1 (Berkeley) 5/2/91 -.\" .Dd July 31, 2008 .Dt ATAN 3 .Os diff --git a/lib/msun/man/atan2.3 b/lib/msun/man/atan2.3 index df67200a002f..df023777ce71 100644 --- a/lib/msun/man/atan2.3 +++ b/lib/msun/man/atan2.3 @@ -25,8 +25,6 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" from: @(#)atan2.3 5.1 (Berkeley) 5/2/91 -.\" .Dd July 31, 2008 .Dt ATAN2 3 .Os diff --git a/lib/msun/man/atanh.3 b/lib/msun/man/atanh.3 index a4c1061bd014..3fd9d2977d8f 100644 --- a/lib/msun/man/atanh.3 +++ b/lib/msun/man/atanh.3 @@ -25,8 +25,6 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" from: @(#)atanh.3 5.2 (Berkeley) 5/6/91 -.\" .Dd June 9, 2013 .Dt ATANH 3 .Os diff --git a/lib/msun/man/ceil.3 b/lib/msun/man/ceil.3 index 61a63e2c5fd1..9a0a5be89f64 100644 --- a/lib/msun/man/ceil.3 +++ b/lib/msun/man/ceil.3 @@ -25,8 +25,6 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" from: @(#)ceil.3 5.1 (Berkeley) 5/2/91 -.\" .Dd January 13, 2005 .Dt CEIL 3 .Os diff --git a/lib/msun/man/copysign.3 b/lib/msun/man/copysign.3 index 5d08bd5dd559..091164fbeda9 100644 --- a/lib/msun/man/copysign.3 +++ b/lib/msun/man/copysign.3 @@ -25,8 +25,6 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" from: @(#)ieee.3 6.4 (Berkeley) 5/6/91 -.\" .Dd January 26, 2005 .Dt COPYSIGN 3 .Os diff --git a/lib/msun/man/cos.3 b/lib/msun/man/cos.3 index 68036ab7bb99..4b5223b37261 100644 --- a/lib/msun/man/cos.3 +++ b/lib/msun/man/cos.3 @@ -25,8 +25,6 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" from: @(#)cos.3 5.1 (Berkeley) 5/2/91 -.\" .Dd April 1, 2020 .Dt COS 3 .Os diff --git a/lib/msun/man/cosh.3 b/lib/msun/man/cosh.3 index 45af312bd025..22105f259817 100644 --- a/lib/msun/man/cosh.3 +++ b/lib/msun/man/cosh.3 @@ -25,8 +25,6 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" from: @(#)cosh.3 5.1 (Berkeley) 5/2/91 -.\" .Dd April 3, 2022 .Dt COSH 3 .Os diff --git a/lib/msun/man/cospi.3 b/lib/msun/man/cospi.3 index 5b33fe2555a1..86e63fb77498 100644 --- a/lib/msun/man/cospi.3 +++ b/lib/msun/man/cospi.3 @@ -62,27 +62,21 @@ where p is the floating\(enpoint precision of .Ar x , then the returned value is 1 and it has no significance. .Sh SPECIAL VALUES -.Bl -tag -.It -.Fn cospi \*(Pm0 +.Bl -tag -width "cospi(+n/2)" +.It Fn cospi \*(Pm0 returns 1. -.It -.Fn cospi \*(Pmn/2 +.It Fn cospi \*(Pmn/2 returns 0 for positive integers .Ar n . -.It -.Fn cospi n +.It Fn cospi n returns 1 for even integers .Ar n . -.It -.Fn cospi n +.It Fn cospi n returns \-1 for odd integers .Ar n . -.It -.Fn cospi \*(Pm\(if +.It Fn cospi \*(Pm\(if return an \*(Na and raises an FE_INVALID exception. -.It -.Fn cospi \*(Na +.It Fn cospi \*(Na return an \*(Na and raises an FE_INVALID exception. .El .Sh SEE ALSO diff --git a/lib/msun/man/erf.3 b/lib/msun/man/erf.3 index e0771863cca1..8d66017ed11c 100644 --- a/lib/msun/man/erf.3 +++ b/lib/msun/man/erf.3 @@ -25,9 +25,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" from: @(#)erf.3 6.4 (Berkeley) 4/20/91 -.\" -.Dd July 13, 2014 +.Dd June 23, 2024 .Dt ERF 3 .Os .Sh NAME @@ -88,6 +86,17 @@ subtracts the result of the error function from 1.0. .Sh SEE ALSO .Xr math 3 +.Sh STANDARDS +The +.Fn erf , +.Fn erff , +.Fn erfl , +.Fn erfc , +.Fn erfcf +and +.Fn erfcl +functions conform to +.St -isoC-99 . .Sh HISTORY The .Fn erf diff --git a/lib/msun/man/exp.3 b/lib/msun/man/exp.3 index b918f32dba6a..a94c372fa0f5 100644 --- a/lib/msun/man/exp.3 +++ b/lib/msun/man/exp.3 @@ -25,8 +25,6 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" from: @(#)exp.3 6.12 (Berkeley) 7/31/91 -.\" .Dd April 1, 2020 .Dt EXP 3 .Os diff --git a/lib/msun/man/fabs.3 b/lib/msun/man/fabs.3 index 3ddf68ed2ef3..031b6aa54d18 100644 --- a/lib/msun/man/fabs.3 +++ b/lib/msun/man/fabs.3 @@ -1,7 +1,5 @@ .\" Copyright (c) 1991 The Regents of the University of California. .\" All rights reserved. -.\" -.\" @(#)fabs.3 5.1 (Berkeley) 5/2/91 .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: @@ -26,8 +24,6 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" from: @(#)fabs.3 5.1 (Berkeley) 5/2/91 -.\" .Dd October 25, 2003 .Dt FABS 3 .Os diff --git a/lib/msun/man/floor.3 b/lib/msun/man/floor.3 index 4bf3f4ddd971..b295d013035f 100644 --- a/lib/msun/man/floor.3 +++ b/lib/msun/man/floor.3 @@ -25,8 +25,6 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" from: @(#)floor.3 6.5 (Berkeley) 4/19/91 -.\" .Dd April 3, 2022 .Dt FLOOR 3 .Os diff --git a/lib/msun/man/fmod.3 b/lib/msun/man/fmod.3 index bf7288d1a9c3..a7a5ae86df58 100644 --- a/lib/msun/man/fmod.3 +++ b/lib/msun/man/fmod.3 @@ -25,8 +25,6 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" from: @(#)fmod.3 5.1 (Berkeley) 5/2/91 -.\" .Dd April 3, 2022 .Dt FMOD 3 .Os diff --git a/lib/msun/man/hypot.3 b/lib/msun/man/hypot.3 index 4ff901b14af5..7b8498757955 100644 --- a/lib/msun/man/hypot.3 +++ b/lib/msun/man/hypot.3 @@ -25,8 +25,6 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" from: @(#)hypot.3 6.7 (Berkeley) 5/6/91 -.\" .Dd March 30, 2008 .Dt HYPOT 3 .Os diff --git a/lib/msun/man/ieee.3 b/lib/msun/man/ieee.3 index 398287da8606..aaf73efe6bf9 100644 --- a/lib/msun/man/ieee.3 +++ b/lib/msun/man/ieee.3 @@ -25,8 +25,6 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" from: @(#)ieee.3 6.4 (Berkeley) 5/6/91 -.\" .Dd January 26, 2005 .Dt IEEE 3 .Os diff --git a/lib/msun/man/ieee_test.3 b/lib/msun/man/ieee_test.3 index 7a5b2abb2573..bae704eb22df 100644 --- a/lib/msun/man/ieee_test.3 +++ b/lib/msun/man/ieee_test.3 @@ -25,8 +25,6 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" from: @(#)ieee.3 6.4 (Berkeley) 5/6/91 -.\" .Dd November 6, 2005 .Dt IEEE_TEST 3 .Os diff --git a/lib/msun/man/ilogb.3 b/lib/msun/man/ilogb.3 index e263f4f0a262..4d4523316afd 100644 --- a/lib/msun/man/ilogb.3 +++ b/lib/msun/man/ilogb.3 @@ -25,8 +25,6 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" from: @(#)ieee.3 6.4 (Berkeley) 5/6/91 -.\" .Dd December 16, 2007 .Dt ILOGB 3 .Os diff --git a/lib/msun/man/j0.3 b/lib/msun/man/j0.3 index 804bc3678e8f..a5c58f03977a 100644 --- a/lib/msun/man/j0.3 +++ b/lib/msun/man/j0.3 @@ -25,8 +25,6 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" from: @(#)j0.3 6.7 (Berkeley) 4/19/91 -.\" .Dd March 10, 2015 .Dt J0 3 .Os diff --git a/lib/msun/man/lgamma.3 b/lib/msun/man/lgamma.3 index cf80c9e7f365..41d680e41bda 100644 --- a/lib/msun/man/lgamma.3 +++ b/lib/msun/man/lgamma.3 @@ -25,9 +25,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" from: @(#)lgamma.3 6.6 (Berkeley) 12/3/92 -.\" -.Dd December 8, 2017 +.Dd April 12, 2024 .Dt LGAMMA 3 .Os .Sh NAME @@ -169,15 +167,6 @@ non-positive integers. For large non-integer negative values, .Fn tgamma will underflow. -.Sh BUGS -To conform with newer C/C++ standards, a stub implementation for -.Nm tgammal -was committed to the math library, where -.Nm tgammal -is mapped to -.Nm tgamma . -Thus, the numerical accuracy is at most that of the 53-bit double -precision implementation. .Sh SEE ALSO .Xr math 3 .Sh STANDARDS @@ -214,3 +203,11 @@ The .Fn tgamma function appeared in .Fx 5.0 . +The 128-bit +.Ft long double +version of +.Fn tgammal +replaced the 80-bit stub version in +version in +.Fx 14.1 , +thanks to an appropriate implementation from Arm. diff --git a/lib/msun/man/math.3 b/lib/msun/man/math.3 index 0704918846a8..47353298bb54 100644 --- a/lib/msun/man/math.3 +++ b/lib/msun/man/math.3 @@ -25,8 +25,6 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" from: @(#)math.3 6.10 (Berkeley) 5/6/91 -.\" .Dd December 7, 2017 .Dt MATH 3 .Os diff --git a/lib/msun/man/nextafter.3 b/lib/msun/man/nextafter.3 index 970e029b46b6..3282050f1d2e 100644 --- a/lib/msun/man/nextafter.3 +++ b/lib/msun/man/nextafter.3 @@ -25,8 +25,6 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" from: @(#)ieee.3 6.4 (Berkeley) 5/6/91 -.\" .Dd May 4, 2005 .Dt NEXTAFTER 3 .Os diff --git a/lib/msun/man/remainder.3 b/lib/msun/man/remainder.3 index 9b8962b4907e..9c2d92f5e90c 100644 --- a/lib/msun/man/remainder.3 +++ b/lib/msun/man/remainder.3 @@ -25,8 +25,6 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" from: @(#)ieee.3 6.4 (Berkeley) 5/6/91 -.\" .Dd March 30, 2008 .Dt REMAINDER 3 .Os diff --git a/lib/msun/man/rint.3 b/lib/msun/man/rint.3 index 385b5b51dc8a..399a0720b324 100644 --- a/lib/msun/man/rint.3 +++ b/lib/msun/man/rint.3 @@ -25,8 +25,6 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" from: @(#)rint.3 5.1 (Berkeley) 5/2/91 -.\" .Dd January 13, 2008 .Dt RINT 3 .Os diff --git a/lib/msun/man/scalbn.3 b/lib/msun/man/scalbn.3 index 2c56f57f6793..9b14e1fcb3d4 100644 --- a/lib/msun/man/scalbn.3 +++ b/lib/msun/man/scalbn.3 @@ -25,8 +25,6 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" from: @(#)ieee.3 6.4 (Berkeley) 5/6/91 -.\" .Dd March 4, 2005 .Dt SCALBN 3 .Os diff --git a/lib/msun/man/sin.3 b/lib/msun/man/sin.3 index a007be7fac31..376fc706dd2b 100644 --- a/lib/msun/man/sin.3 +++ b/lib/msun/man/sin.3 @@ -1,7 +1,5 @@ .\" Copyright (c) 1991 The Regents of the University of California. .\" All rights reserved. -.\" -.\" @(#)sin.3 6.7 (Berkeley) 4/19/91 .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: @@ -26,8 +24,6 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" from: @(#)sin.3 6.7 (Berkeley) 4/19/91 -.\" .Dd April 1, 2020 .Dt SIN 3 .Os diff --git a/lib/msun/man/sinh.3 b/lib/msun/man/sinh.3 index 71dcfbd59b10..7fb928028371 100644 --- a/lib/msun/man/sinh.3 +++ b/lib/msun/man/sinh.3 @@ -25,8 +25,6 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" from: @(#)sinh.3 6.6 (Berkeley) 4/19/91 -.\" .Dd April 3, 2022 .Dt SINH 3 .Os diff --git a/lib/msun/man/sinpi.3 b/lib/msun/man/sinpi.3 index a5f514d3979f..63a1e3010de5 100644 --- a/lib/msun/man/sinpi.3 +++ b/lib/msun/man/sinpi.3 @@ -62,19 +62,15 @@ where p is the floating\(enpoint precision of .Ar x , then the returned value is \*(Pm0 and it has no significance. .Sh SPECIAL VALUES -.Bl -tag -.It -.Fn sinpi \*(Pm0 +.Bl -tag -width "sinpi(NaN)" +.It Fn sinpi \*(Pm0 returns \*(Pm0. -.It -.Fn sinpi \*(Pmn +.It Fn sinpi \*(Pmn returns \*(Pm0 for positive integers .Ar n . -.It -.Fn sinpi \*(Pm\(if +.It Fn sinpi \*(Pm\(if return an \*(Na and raises an FE_INVALID exception. -.It -.Fn sinpi \*(Na +.It Fn sinpi \*(Na return an \*(Na and raises an FE_INVALID exception. .El .Sh SEE ALSO diff --git a/lib/msun/man/sqrt.3 b/lib/msun/man/sqrt.3 index 9645160dfdae..f4a217353af0 100644 --- a/lib/msun/man/sqrt.3 +++ b/lib/msun/man/sqrt.3 @@ -25,8 +25,6 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" from: @(#)sqrt.3 6.4 (Berkeley) 5/6/91 -.\" .Dd February 15, 2020 .Dt SQRT 3 .Os diff --git a/lib/msun/man/tan.3 b/lib/msun/man/tan.3 index 5a0226cf1156..8714d2429c2a 100644 --- a/lib/msun/man/tan.3 +++ b/lib/msun/man/tan.3 @@ -25,8 +25,6 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" from: @(#)tan.3 5.1 (Berkeley) 5/2/91 -.\" .Dd January 24, 2008 .Dt TAN 3 .Os diff --git a/lib/msun/man/tanh.3 b/lib/msun/man/tanh.3 index 61ae7a0920b8..e795d0e7eba6 100644 --- a/lib/msun/man/tanh.3 +++ b/lib/msun/man/tanh.3 @@ -25,8 +25,6 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" from: @(#)tanh.3 5.1 (Berkeley) 5/2/91 -.\" .Dd April 3, 2022 .Dt TANH 3 .Os diff --git a/lib/msun/man/tanpi.3 b/lib/msun/man/tanpi.3 index 2b95f5daa8b1..b11d54031b71 100644 --- a/lib/msun/man/tanpi.3 +++ b/lib/msun/man/tanpi.3 @@ -62,22 +62,17 @@ where p is the floating\(enpoint precision of .Ar x , then the returned value is \*(Pm0 and it has no significance. .Sh SPECIAL VALUES -.Bl -tag -.It -.Fn tanpi \*(Pm0 +.Bl -tag -width "tanpi(+n/2)" +.It Fn tanpi \*(Pm0 returns \*(Pm0. -.It -.Fn tanpi \*(Pmn +.It Fn tanpi \*(Pmn returns \*(Pm0 for positive integers .Ar n . -.It -.Fn tanpi \*(Pmn/2 +.It Fn tanpi \*(Pmn/2 returns \*(Na for n > 0 and raises an FE_INVALID exception. -.It -.Fn tanpi \*(Pm\(if +.It Fn tanpi \*(Pm\(if return an \*(Na and raises an FE_INVALID exception. -.It -.Fn tanpi \*(Na +.It Fn tanpi \*(Na return an \*(Na and raises an FE_INVALID exception. .El .Sh SEE ALSO diff --git a/lib/msun/powerpc/Makefile.inc b/lib/msun/powerpc/Makefile.inc index c1088659f2b0..35747abb7087 100644 --- a/lib/msun/powerpc/Makefile.inc +++ b/lib/msun/powerpc/Makefile.inc @@ -1,3 +1,2 @@ - LDBL_PREC = 53 SYM_MAPS += ${.CURDIR}/powerpc/Symbol.map diff --git a/lib/msun/riscv/Makefile.inc b/lib/msun/riscv/Makefile.inc index e83e57a743ac..6262cfd6981e 100644 --- a/lib/msun/riscv/Makefile.inc +++ b/lib/msun/riscv/Makefile.inc @@ -1,3 +1,2 @@ - LDBL_PREC = 113 SYM_MAPS += ${.CURDIR}/riscv/Symbol.map diff --git a/lib/msun/riscv/Symbol.map b/lib/msun/riscv/Symbol.map index 2bc6215688bb..65157d0de9c1 100644 --- a/lib/msun/riscv/Symbol.map +++ b/lib/msun/riscv/Symbol.map @@ -1,15 +1,12 @@ -/* - */ -FBSD_1.0 { -}; - FBSD_1.3 { fesetexceptflag; feraiseexcept; fegetenv; feholdexcept; feupdateenv; +}; + +FBSD_1.8 { feenableexcept; fedisableexcept; - fegetexcept; }; diff --git a/lib/msun/riscv/fenv.c b/lib/msun/riscv/fenv.c index 9d7ae3d3fdaf..a4dde02a6ddc 100644 --- a/lib/msun/riscv/fenv.c +++ b/lib/msun/riscv/fenv.c @@ -37,14 +37,6 @@ */ const fenv_t __fe_dfl_env = 0; -#ifdef __riscv_float_abi_soft -#define __set_env(env, flags, mask, rnd) env = ((flags) | (rnd) << 5) -#define __env_flags(env) ((env) & FE_ALL_EXCEPT) -#define __env_mask(env) (0) /* No exception traps. */ -#define __env_round(env) (((env) >> 5) & _ROUND_MASK) -#include "fenv-softfloat.h" -#endif - extern inline int feclearexcept(int __excepts); extern inline int fegetexceptflag(fexcept_t *__flagp, int __excepts); extern inline int fesetexceptflag(const fexcept_t *__flagp, int __excepts); diff --git a/lib/msun/riscv/fenv.h b/lib/msun/riscv/fenv.h index 1971e976645c..fd50463d479e 100644 --- a/lib/msun/riscv/fenv.h +++ b/lib/msun/riscv/fenv.h @@ -36,6 +36,7 @@ #ifndef _FENV_H_ #define _FENV_H_ +#include <sys/cdefs.h> #include <sys/_types.h> #ifndef __fenv_static @@ -71,32 +72,13 @@ __BEGIN_DECLS extern const fenv_t __fe_dfl_env; #define FE_DFL_ENV (&__fe_dfl_env) -#if !defined(__riscv_float_abi_soft) && !defined(__riscv_float_abi_double) -#if defined(__riscv_float_abi_single) -#error single precision floating point ABI not supported -#else -#error compiler did not set soft/hard float macros -#endif +#ifndef __riscv_float_abi_double +#error only double hard float ABI supported #endif -#ifndef __riscv_float_abi_soft #define __rfs(__fcsr) __asm __volatile("csrr %0, fcsr" : "=r" (__fcsr)) #define __wfs(__fcsr) __asm __volatile("csrw fcsr, %0" :: "r" (__fcsr)) -#endif -#ifdef __riscv_float_abi_soft -int feclearexcept(int __excepts); -int fegetexceptflag(fexcept_t *__flagp, int __excepts); -int fesetexceptflag(const fexcept_t *__flagp, int __excepts); -int feraiseexcept(int __excepts); -int fetestexcept(int __excepts); -int fegetround(void); -int fesetround(int __round); -int fegetenv(fenv_t *__envp); -int feholdexcept(fenv_t *__envp); -int fesetenv(const fenv_t *__envp); -int feupdateenv(const fenv_t *__envp); -#else __fenv_static inline int feclearexcept(int __excepts) { @@ -212,18 +194,10 @@ feupdateenv(const fenv_t *__envp) return (0); } -#endif /* !__riscv_float_abi_soft */ #if __BSD_VISIBLE -/* We currently provide no external definitions of the functions below. */ - -#ifdef __riscv_float_abi_soft -int feenableexcept(int __mask); -int fedisableexcept(int __mask); -int fegetexcept(void); -#else -static inline int +__fenv_static inline int feenableexcept(int __mask __unused) { @@ -232,7 +206,7 @@ feenableexcept(int __mask __unused) return (0); } -static inline int +__fenv_static inline int fedisableexcept(int __mask __unused) { @@ -241,6 +215,7 @@ fedisableexcept(int __mask __unused) return (0); } +/* We currently provide no external definition of fegetexcept(). */ static inline int fegetexcept(void) { @@ -249,7 +224,6 @@ fegetexcept(void) return (0); } -#endif /* !__riscv_float_abi_soft */ #endif /* __BSD_VISIBLE */ diff --git a/lib/msun/src/catrig.c b/lib/msun/src/catrig.c index 929811a09a3b..45af164a66c5 100644 --- a/lib/msun/src/catrig.c +++ b/lib/msun/src/catrig.c @@ -26,7 +26,6 @@ * SUCH DAMAGE. */ -#include <sys/cdefs.h> #include <complex.h> #include <float.h> diff --git a/lib/msun/src/catrigf.c b/lib/msun/src/catrigf.c index 7feecfc5de38..da90629ec076 100644 --- a/lib/msun/src/catrigf.c +++ b/lib/msun/src/catrigf.c @@ -40,7 +40,6 @@ * a few comments on the right of declarations remain. */ -#include <sys/cdefs.h> #include <complex.h> #include <float.h> diff --git a/lib/msun/src/catrigl.c b/lib/msun/src/catrigl.c index 7cc3c1431731..faf9d299670e 100644 --- a/lib/msun/src/catrigl.c +++ b/lib/msun/src/catrigl.c @@ -39,7 +39,6 @@ * a few comments on the right of declarations remain. */ -#include <sys/cdefs.h> #include <complex.h> #include <float.h> diff --git a/lib/msun/src/e_acos.c b/lib/msun/src/e_acos.c index 275d0ebb7756..af51fe1ecddc 100644 --- a/lib/msun/src/e_acos.c +++ b/lib/msun/src/e_acos.c @@ -1,5 +1,4 @@ -/* @(#)e_acos.c 1.3 95/01/18 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -11,7 +10,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* acos(x) * Method : * acos(x) = pi/2 - asin(x) diff --git a/lib/msun/src/e_acosf.c b/lib/msun/src/e_acosf.c index 29f6d4a78495..ede552e7055a 100644 --- a/lib/msun/src/e_acosf.c +++ b/lib/msun/src/e_acosf.c @@ -13,7 +13,6 @@ * ==================================================== */ -#include <sys/cdefs.h> #include "math.h" #include "math_private.h" @@ -23,11 +22,17 @@ pi = 3.1415925026e+00, /* 0x40490fda */ pio2_hi = 1.5707962513e+00; /* 0x3fc90fda */ static volatile float pio2_lo = 7.5497894159e-08; /* 0x33a22168 */ + +/* + * The coefficients for the rational approximation were generated over + * 0x1p-12f <= x <= 0.5f. The maximum error satisfies log2(e) < -30.084. + */ static const float -pS0 = 1.6666586697e-01, -pS1 = -4.2743422091e-02, -pS2 = -8.6563630030e-03, -qS1 = -7.0662963390e-01; +pS0 = 1.66666672e-01f, /* 0x3e2aaaab */ +pS1 = -1.19510300e-01f, /* 0xbdf4c1d1 */ +pS2 = 5.47002675e-03f, /* 0x3bb33de9 */ +qS1 = -1.16706085e+00f, /* 0xbf956240 */ +qS2 = 2.90115148e-01f; /* 0x3e9489f9 */ float acosf(float x) @@ -47,13 +52,13 @@ acosf(float x) if(ix<=0x32800000) return pio2_hi+pio2_lo;/*if|x|<2**-26*/ z = x*x; p = z*(pS0+z*(pS1+z*pS2)); - q = one+z*qS1; + q = one+z*(qS1+z*qS2); r = p/q; return pio2_hi - (x - (pio2_lo-x*r)); } else if (hx<0) { /* x < -0.5 */ z = (one+x)*(float)0.5; p = z*(pS0+z*(pS1+z*pS2)); - q = one+z*qS1; + q = one+z*(qS1+z*qS2); s = sqrtf(z); r = p/q; w = r*s-pio2_lo; @@ -67,7 +72,7 @@ acosf(float x) SET_FLOAT_WORD(df,idf&0xfffff000); c = (z-df*df)/(s+df); p = z*(pS0+z*(pS1+z*pS2)); - q = one+z*qS1; + q = one+z*(qS1+z*qS2); r = p/q; w = r*s+c; return (float)2.0*(df+w); diff --git a/lib/msun/src/e_acosh.c b/lib/msun/src/e_acosh.c index d50f5513ee59..0e5640b623d9 100644 --- a/lib/msun/src/e_acosh.c +++ b/lib/msun/src/e_acosh.c @@ -1,5 +1,4 @@ -/* @(#)e_acosh.c 1.3 95/01/18 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -12,7 +11,6 @@ * */ -#include <sys/cdefs.h> /* acosh(x) * Method : * Based on diff --git a/lib/msun/src/e_acoshf.c b/lib/msun/src/e_acoshf.c index df12609671cf..b6fbd2c14cb4 100644 --- a/lib/msun/src/e_acoshf.c +++ b/lib/msun/src/e_acoshf.c @@ -13,7 +13,6 @@ * ==================================================== */ -#include <sys/cdefs.h> #include "math.h" #include "math_private.h" diff --git a/lib/msun/src/e_acoshl.c b/lib/msun/src/e_acoshl.c index 8f3d3963e7cf..6bfa6244df09 100644 --- a/lib/msun/src/e_acoshl.c +++ b/lib/msun/src/e_acoshl.c @@ -1,6 +1,5 @@ /* from: FreeBSD: head/lib/msun/src/e_acosh.c 176451 2008-02-22 02:30:36Z das */ -/* @(#)e_acosh.c 1.3 95/01/18 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -13,7 +12,6 @@ * */ -#include <sys/cdefs.h> /* * See e_acosh.c for complete comments. * diff --git a/lib/msun/src/e_acosl.c b/lib/msun/src/e_acosl.c index 524fa756a103..209814383e51 100644 --- a/lib/msun/src/e_acosl.c +++ b/lib/msun/src/e_acosl.c @@ -1,5 +1,4 @@ -/* @(#)e_acos.c 1.3 95/01/18 */ /* FreeBSD: head/lib/msun/src/e_acos.c 176451 2008-02-22 02:30:36Z das */ /* * ==================================================== @@ -12,7 +11,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* * See comments in e_acos.c. * Converted to long double by David Schultz <das@FreeBSD.ORG>. diff --git a/lib/msun/src/e_asin.c b/lib/msun/src/e_asin.c index ae6e496850e1..530bf7910756 100644 --- a/lib/msun/src/e_asin.c +++ b/lib/msun/src/e_asin.c @@ -1,5 +1,4 @@ -/* @(#)e_asin.c 1.3 95/01/18 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -11,7 +10,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* asin(x) * Method : * Since asin(x) = x + x^3/6 + x^5*3/40 + x^7*15/336 + ... diff --git a/lib/msun/src/e_asinf.c b/lib/msun/src/e_asinf.c index 391c15870f84..8d1aca27df83 100644 --- a/lib/msun/src/e_asinf.c +++ b/lib/msun/src/e_asinf.c @@ -13,18 +13,23 @@ * ==================================================== */ -#include <sys/cdefs.h> #include "math.h" #include "math_private.h" static const float one = 1.0000000000e+00, /* 0x3F800000 */ -huge = 1.000e+30, - /* coefficient for R(x^2) */ -pS0 = 1.6666586697e-01, -pS1 = -4.2743422091e-02, -pS2 = -8.6563630030e-03, -qS1 = -7.0662963390e-01; +huge = 1.000e+30; + +/* + * The coefficients for the rational approximation were generated over + * 0x1p-12f <= x <= 0.5f. The maximum error satisfies log2(e) < -30.084. + */ +static const float +pS0 = 1.66666672e-01f, /* 0x3e2aaaab */ +pS1 = -1.19510300e-01f, /* 0xbdf4c1d1 */ +pS2 = 5.47002675e-03f, /* 0x3bb33de9 */ +qS1 = -1.16706085e+00f, /* 0xbf956240 */ +qS2 = 2.90115148e-01f; /* 0x3e9489f9 */ static const double pio2 = 1.570796326794896558e+00; @@ -47,7 +52,7 @@ asinf(float x) } t = x*x; p = t*(pS0+t*(pS1+t*pS2)); - q = one+t*qS1; + q = one+t*(qS1+t*qS2); w = p/q; return x+x*w; } @@ -55,7 +60,7 @@ asinf(float x) w = one-fabsf(x); t = w*(float)0.5; p = t*(pS0+t*(pS1+t*pS2)); - q = one+t*qS1; + q = one+t*(qS1+t*qS2); s = sqrt(t); w = p/q; t = pio2-2.0*(s+s*w); diff --git a/lib/msun/src/e_asinl.c b/lib/msun/src/e_asinl.c index d0cff2f536fa..bb2320e129e7 100644 --- a/lib/msun/src/e_asinl.c +++ b/lib/msun/src/e_asinl.c @@ -1,5 +1,4 @@ -/* @(#)e_asin.c 1.3 95/01/18 */ /* FreeBSD: head/lib/msun/src/e_asin.c 176451 2008-02-22 02:30:36Z das */ /* * ==================================================== @@ -12,7 +11,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* * See comments in e_asin.c. * Converted to long double by David Schultz <das@FreeBSD.ORG>. diff --git a/lib/msun/src/e_atan2.c b/lib/msun/src/e_atan2.c index f4d3ed2e00db..ab5fc72dbabf 100644 --- a/lib/msun/src/e_atan2.c +++ b/lib/msun/src/e_atan2.c @@ -1,5 +1,4 @@ -/* @(#)e_atan2.c 1.3 95/01/18 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -12,7 +11,6 @@ * */ -#include <sys/cdefs.h> /* atan2(y,x) * Method : * 1. Reduce y to positive by atan2(y,x)=-atan2(-y,x). diff --git a/lib/msun/src/e_atan2f.c b/lib/msun/src/e_atan2f.c index af8c00851476..408f3646f612 100644 --- a/lib/msun/src/e_atan2f.c +++ b/lib/msun/src/e_atan2f.c @@ -13,7 +13,6 @@ * ==================================================== */ -#include <sys/cdefs.h> #include "math.h" #include "math_private.h" diff --git a/lib/msun/src/e_atan2l.c b/lib/msun/src/e_atan2l.c index 722334f76791..a27fd3efc141 100644 --- a/lib/msun/src/e_atan2l.c +++ b/lib/msun/src/e_atan2l.c @@ -1,5 +1,4 @@ -/* @(#)e_atan2.c 1.3 95/01/18 */ /* FreeBSD: head/lib/msun/src/e_atan2.c 176451 2008-02-22 02:30:36Z das */ /* * ==================================================== @@ -13,7 +12,6 @@ * */ -#include <sys/cdefs.h> /* * See comments in e_atan2.c. * Converted to long double by David Schultz <das@FreeBSD.ORG>. diff --git a/lib/msun/src/e_atanh.c b/lib/msun/src/e_atanh.c index 3eabaaf82403..0cc0b9248b6b 100644 --- a/lib/msun/src/e_atanh.c +++ b/lib/msun/src/e_atanh.c @@ -1,5 +1,4 @@ -/* @(#)e_atanh.c 1.3 95/01/18 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -12,7 +11,6 @@ * */ -#include <sys/cdefs.h> /* atanh(x) * Method : * 1.Reduced x to positive by atanh(-x) = -atanh(x) diff --git a/lib/msun/src/e_atanhf.c b/lib/msun/src/e_atanhf.c index 134513e5b817..a2d6b69a6812 100644 --- a/lib/msun/src/e_atanhf.c +++ b/lib/msun/src/e_atanhf.c @@ -13,7 +13,6 @@ * ==================================================== */ -#include <sys/cdefs.h> #include "math.h" #include "math_private.h" diff --git a/lib/msun/src/e_atanhl.c b/lib/msun/src/e_atanhl.c index 66a301f52ab6..cb707272a66c 100644 --- a/lib/msun/src/e_atanhl.c +++ b/lib/msun/src/e_atanhl.c @@ -1,6 +1,5 @@ /* from: FreeBSD: head/lib/msun/src/e_atanh.c 176451 2008-02-22 02:30:36Z das */ -/* @(#)e_atanh.c 1.3 95/01/18 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -13,7 +12,6 @@ * */ -#include <sys/cdefs.h> /* * See e_atanh.c for complete comments. * diff --git a/lib/msun/src/e_cosh.c b/lib/msun/src/e_cosh.c index 56ec7d56093d..5c3614efbf47 100644 --- a/lib/msun/src/e_cosh.c +++ b/lib/msun/src/e_cosh.c @@ -1,5 +1,4 @@ -/* @(#)e_cosh.c 1.3 95/01/18 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -11,7 +10,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* cosh(x) * Method : * mathematically cosh(x) if defined to be (exp(x)+exp(-x))/2 diff --git a/lib/msun/src/e_coshf.c b/lib/msun/src/e_coshf.c index 8c5457e24a51..40443b8b84d3 100644 --- a/lib/msun/src/e_coshf.c +++ b/lib/msun/src/e_coshf.c @@ -13,7 +13,6 @@ * ==================================================== */ -#include <sys/cdefs.h> #include "math.h" #include "math_private.h" diff --git a/lib/msun/src/e_coshl.c b/lib/msun/src/e_coshl.c index de54b8183bbb..efb5094d39f9 100644 --- a/lib/msun/src/e_coshl.c +++ b/lib/msun/src/e_coshl.c @@ -11,7 +11,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* * See e_cosh.c for complete comments. * diff --git a/lib/msun/src/e_exp.c b/lib/msun/src/e_exp.c index afbcdb3db7b6..6401556a44e4 100644 --- a/lib/msun/src/e_exp.c +++ b/lib/msun/src/e_exp.c @@ -1,5 +1,4 @@ -/* @(#)e_exp.c 1.6 04/04/22 */ /* * ==================================================== * Copyright (C) 2004 by Sun Microsystems, Inc. All rights reserved. @@ -10,7 +9,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* exp(x) * Returns the exponential of x. * diff --git a/lib/msun/src/e_expf.c b/lib/msun/src/e_expf.c index 2dbce9dd870d..fe2e6779469f 100644 --- a/lib/msun/src/e_expf.c +++ b/lib/msun/src/e_expf.c @@ -13,7 +13,6 @@ * ==================================================== */ -#include <sys/cdefs.h> #include <float.h> #include "math.h" diff --git a/lib/msun/src/e_fmod.c b/lib/msun/src/e_fmod.c index fdfb56c2a475..ced9cce33aa0 100644 --- a/lib/msun/src/e_fmod.c +++ b/lib/msun/src/e_fmod.c @@ -1,5 +1,4 @@ -/* @(#)e_fmod.c 1.3 95/01/18 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -11,7 +10,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* * fmod(x,y) * Return x mod y in exact arithmetic @@ -28,14 +26,14 @@ static const double one = 1.0, Zero[] = {0.0, -0.0,}; double fmod(double x, double y) { - int32_t n,hx,hy,hz,ix,iy,sx,i; - u_int32_t lx,ly,lz; + int32_t hx, hy, hz, ix, iy, n, sx; + u_int32_t lx, ly, lz; EXTRACT_WORDS(hx,lx,x); EXTRACT_WORDS(hy,ly,y); sx = hx&0x80000000; /* sign of x */ - hx ^=sx; /* |x| */ - hy &= 0x7fffffff; /* |y| */ + hx ^= sx; /* |x| */ + hy &= 0x7fffffff; /* |y| */ /* purge off exception values */ if((hy|ly)==0||(hx>=0x7ff00000)|| /* y=0,or x not finite */ @@ -48,22 +46,16 @@ fmod(double x, double y) } /* determine ix = ilogb(x) */ - if(hx<0x00100000) { /* subnormal x */ - if(hx==0) { - for (ix = -1043, i=lx; i>0; i<<=1) ix -=1; - } else { - for (ix = -1022,i=(hx<<11); i>0; i<<=1) ix -=1; - } - } else ix = (hx>>20)-1023; + if(hx<0x00100000) + ix = subnormal_ilogb(hx, lx); + else + ix = (hx>>20)-1023; /* determine iy = ilogb(y) */ - if(hy<0x00100000) { /* subnormal y */ - if(hy==0) { - for (iy = -1043, i=ly; i>0; i<<=1) iy -=1; - } else { - for (iy = -1022,i=(hy<<11); i>0; i<<=1) iy -=1; - } - } else iy = (hy>>20)-1023; + if(hy<0x00100000) + iy = subnormal_ilogb(hy, ly); + else + iy = (hy>>20)-1023; /* set up {hx,lx}, {hy,ly} and align y to x */ if(ix >= -1022) diff --git a/lib/msun/src/e_fmodf.c b/lib/msun/src/e_fmodf.c index 0e6633fbe739..ada969db44c7 100644 --- a/lib/msun/src/e_fmodf.c +++ b/lib/msun/src/e_fmodf.c @@ -13,7 +13,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* * fmodf(x,y) * Return x mod y in exact arithmetic @@ -28,7 +27,7 @@ static const float one = 1.0, Zero[] = {0.0, -0.0,}; float fmodf(float x, float y) { - int32_t n,hx,hy,hz,ix,iy,sx,i; + int32_t hx, hy, hz, ix, iy, n, sx; GET_FLOAT_WORD(hx,x); GET_FLOAT_WORD(hy,y); @@ -45,14 +44,16 @@ fmodf(float x, float y) return Zero[(u_int32_t)sx>>31]; /* |x|=|y| return x*0*/ /* determine ix = ilogb(x) */ - if(hx<0x00800000) { /* subnormal x */ - for (ix = -126,i=(hx<<8); i>0; i<<=1) ix -=1; - } else ix = (hx>>23)-127; + if(hx<0x00800000) + ix = subnormal_ilogbf(hx); + else + ix = (hx>>23)-127; /* determine iy = ilogb(y) */ - if(hy<0x00800000) { /* subnormal y */ - for (iy = -126,i=(hy<<8); i>=0; i<<=1) iy -=1; - } else iy = (hy>>23)-127; + if(hy<0x00800000) + iy = subnormal_ilogbf(hy); + else + iy = (hy>>23)-127; /* set up {hx,lx}, {hy,ly} and align y to x */ if(ix >= -126) diff --git a/lib/msun/src/e_fmodl.c b/lib/msun/src/e_fmodl.c index 8a348ee117e7..d5997e1f4e47 100644 --- a/lib/msun/src/e_fmodl.c +++ b/lib/msun/src/e_fmodl.c @@ -1,4 +1,3 @@ -/* @(#)e_fmod.c 1.3 95/01/18 */ /*- * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,7 +9,6 @@ * ==================================================== */ -#include <sys/cdefs.h> #include <float.h> #include <stdint.h> diff --git a/lib/msun/src/e_gamma.c b/lib/msun/src/e_gamma.c index 7757337b59af..43541ad935bd 100644 --- a/lib/msun/src/e_gamma.c +++ b/lib/msun/src/e_gamma.c @@ -1,5 +1,4 @@ -/* @(#)e_gamma.c 1.3 95/01/18 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -12,7 +11,6 @@ * */ -#include <sys/cdefs.h> /* gamma(x) * Return the logarithm of the Gamma function of x. * diff --git a/lib/msun/src/e_gamma_r.c b/lib/msun/src/e_gamma_r.c index f204685c3f7a..f317ae435cdc 100644 --- a/lib/msun/src/e_gamma_r.c +++ b/lib/msun/src/e_gamma_r.c @@ -1,5 +1,4 @@ -/* @(#)e_gamma_r.c 1.3 95/01/18 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -12,7 +11,6 @@ * */ -#include <sys/cdefs.h> /* gamma_r(x, signgamp) * Reentrant version of the logarithm of the Gamma function * with user provide pointer for the sign of Gamma(x). diff --git a/lib/msun/src/e_gammaf.c b/lib/msun/src/e_gammaf.c index 3afef79de53a..98da5711e811 100644 --- a/lib/msun/src/e_gammaf.c +++ b/lib/msun/src/e_gammaf.c @@ -13,7 +13,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* gammaf(x) * Return the logarithm of the Gamma function of x. * diff --git a/lib/msun/src/e_gammaf_r.c b/lib/msun/src/e_gammaf_r.c index 5b3bd535aa42..ae80c1bae2cc 100644 --- a/lib/msun/src/e_gammaf_r.c +++ b/lib/msun/src/e_gammaf_r.c @@ -13,7 +13,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* gammaf_r(x, signgamp) * Reentrant version of the logarithm of the Gamma function * with user provide pointer for the sign of Gamma(x). diff --git a/lib/msun/src/e_hypot.c b/lib/msun/src/e_hypot.c index 8d9c2b11dd97..a291af575521 100644 --- a/lib/msun/src/e_hypot.c +++ b/lib/msun/src/e_hypot.c @@ -1,5 +1,4 @@ -/* @(#)e_hypot.c 1.3 95/01/18 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -11,7 +10,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* hypot(x,y) * * Method : diff --git a/lib/msun/src/e_hypotf.c b/lib/msun/src/e_hypotf.c index c976fd33014d..e45486ee912f 100644 --- a/lib/msun/src/e_hypotf.c +++ b/lib/msun/src/e_hypotf.c @@ -13,7 +13,6 @@ * ==================================================== */ -#include <sys/cdefs.h> #include "math.h" #include "math_private.h" diff --git a/lib/msun/src/e_hypotl.c b/lib/msun/src/e_hypotl.c index 0a89e3a0e218..d8e060a66184 100644 --- a/lib/msun/src/e_hypotl.c +++ b/lib/msun/src/e_hypotl.c @@ -1,4 +1,3 @@ -/* From: @(#)e_hypot.c 1.3 95/01/18 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,7 +9,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* long double version of hypot(). See e_hypot.c for most comments. */ #include <float.h> diff --git a/lib/msun/src/e_j0.c b/lib/msun/src/e_j0.c index 20e0d36b162e..b19661c82534 100644 --- a/lib/msun/src/e_j0.c +++ b/lib/msun/src/e_j0.c @@ -1,4 +1,3 @@ -/* @(#)e_j0.c 1.3 95/01/18 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,7 +9,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* j0(x), y0(x) * Bessel function of the first and second kinds of order zero. * Method -- j0(x): diff --git a/lib/msun/src/e_j0f.c b/lib/msun/src/e_j0f.c index 1cb318d80851..de04a9fadf6b 100644 --- a/lib/msun/src/e_j0f.c +++ b/lib/msun/src/e_j0f.c @@ -13,7 +13,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* * See e_j0.c for complete comments. */ diff --git a/lib/msun/src/e_j1.c b/lib/msun/src/e_j1.c index 7c7812325cc2..06a74b0673c3 100644 --- a/lib/msun/src/e_j1.c +++ b/lib/msun/src/e_j1.c @@ -1,4 +1,3 @@ -/* @(#)e_j1.c 1.3 95/01/18 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,7 +9,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* j1(x), y1(x) * Bessel function of the first and second kinds of order zero. * Method -- j1(x): diff --git a/lib/msun/src/e_j1f.c b/lib/msun/src/e_j1f.c index c022557c4d6b..28cee8e37479 100644 --- a/lib/msun/src/e_j1f.c +++ b/lib/msun/src/e_j1f.c @@ -13,7 +13,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* * See e_j1.c for complete comments. */ diff --git a/lib/msun/src/e_jn.c b/lib/msun/src/e_jn.c index 9735b03429ff..0a715661faf4 100644 --- a/lib/msun/src/e_jn.c +++ b/lib/msun/src/e_jn.c @@ -1,4 +1,3 @@ -/* @(#)e_jn.c 1.4 95/01/18 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,7 +9,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* * jn(n, x), yn(n, x) * floating point Bessel's function of the 1st and 2nd kind diff --git a/lib/msun/src/e_jnf.c b/lib/msun/src/e_jnf.c index 2eadaa1cc07b..b55eaf56679a 100644 --- a/lib/msun/src/e_jnf.c +++ b/lib/msun/src/e_jnf.c @@ -13,7 +13,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* * See e_jn.c for complete comments. */ diff --git a/lib/msun/src/e_lgamma.c b/lib/msun/src/e_lgamma.c index 1d74db1c6af8..46e7c25b19c7 100644 --- a/lib/msun/src/e_lgamma.c +++ b/lib/msun/src/e_lgamma.c @@ -1,5 +1,4 @@ -/* @(#)e_lgamma.c 1.3 95/01/18 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -12,7 +11,6 @@ * */ -#include <sys/cdefs.h> /* lgamma(x) * Return the logarithm of the Gamma function of x. * diff --git a/lib/msun/src/e_lgamma_r.c b/lib/msun/src/e_lgamma_r.c index 38efe4385631..30edd65d9354 100644 --- a/lib/msun/src/e_lgamma_r.c +++ b/lib/msun/src/e_lgamma_r.c @@ -1,4 +1,3 @@ -/* @(#)e_lgamma_r.c 1.3 95/01/18 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,7 +9,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* lgamma_r(x, signgamp) * Reentrant version of the logarithm of the Gamma function * with user provide pointer for the sign of Gamma(x). diff --git a/lib/msun/src/e_lgammaf.c b/lib/msun/src/e_lgammaf.c index b3073557c92d..cc34e440e398 100644 --- a/lib/msun/src/e_lgammaf.c +++ b/lib/msun/src/e_lgammaf.c @@ -13,7 +13,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* lgammaf(x) * Return the logarithm of the Gamma function of x. * diff --git a/lib/msun/src/e_lgammaf_r.c b/lib/msun/src/e_lgammaf_r.c index 86f554f3bd38..3f863ce77a51 100644 --- a/lib/msun/src/e_lgammaf_r.c +++ b/lib/msun/src/e_lgammaf_r.c @@ -14,7 +14,6 @@ * ==================================================== */ -#include <sys/cdefs.h> #include "math.h" #include "math_private.h" diff --git a/lib/msun/src/e_lgammal.c b/lib/msun/src/e_lgammal.c index c45a62a7268e..51e3216a8220 100644 --- a/lib/msun/src/e_lgammal.c +++ b/lib/msun/src/e_lgammal.c @@ -1,4 +1,3 @@ -/* @(#)e_lgamma.c 1.3 95/01/18 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,7 +9,6 @@ * ==================================================== */ -#include <sys/cdefs.h> #include "math.h" #include "math_private.h" diff --git a/lib/msun/src/e_log.c b/lib/msun/src/e_log.c index 5dff93c66c5e..48b6e71d8ae5 100644 --- a/lib/msun/src/e_log.c +++ b/lib/msun/src/e_log.c @@ -1,5 +1,4 @@ -/* @(#)e_log.c 1.3 95/01/18 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -11,7 +10,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* log(x) * Return the logrithm of x * diff --git a/lib/msun/src/e_log10.c b/lib/msun/src/e_log10.c index 89efd791265d..3647fb08f873 100644 --- a/lib/msun/src/e_log10.c +++ b/lib/msun/src/e_log10.c @@ -1,5 +1,4 @@ -/* @(#)e_log10.c 1.3 95/01/18 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -11,7 +10,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* * Return the base 10 logarithm of x. See e_log.c and k_log.h for most * comments. diff --git a/lib/msun/src/e_log10f.c b/lib/msun/src/e_log10f.c index f240d14fca27..ee01d6f5b75b 100644 --- a/lib/msun/src/e_log10f.c +++ b/lib/msun/src/e_log10f.c @@ -9,7 +9,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* * Float version of e_log10.c. See the latter for most comments. */ diff --git a/lib/msun/src/e_log2.c b/lib/msun/src/e_log2.c index eb099171f669..54be1b847381 100644 --- a/lib/msun/src/e_log2.c +++ b/lib/msun/src/e_log2.c @@ -1,5 +1,4 @@ -/* @(#)e_log10.c 1.3 95/01/18 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -11,7 +10,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* * Return the base 2 logarithm of x. See e_log.c and k_log.h for most * comments. diff --git a/lib/msun/src/e_log2f.c b/lib/msun/src/e_log2f.c index 7c1b5c032bdc..52fa411bae8e 100644 --- a/lib/msun/src/e_log2f.c +++ b/lib/msun/src/e_log2f.c @@ -9,7 +9,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* * Float version of e_log2.c. See the latter for most comments. */ diff --git a/lib/msun/src/e_logf.c b/lib/msun/src/e_logf.c index 2bbdd068591c..aad9db3a496c 100644 --- a/lib/msun/src/e_logf.c +++ b/lib/msun/src/e_logf.c @@ -13,7 +13,6 @@ * ==================================================== */ -#include <sys/cdefs.h> #include "math.h" #include "math_private.h" diff --git a/lib/msun/src/e_pow.c b/lib/msun/src/e_pow.c index 8b62c49abe4a..85d1d551b6fb 100644 --- a/lib/msun/src/e_pow.c +++ b/lib/msun/src/e_pow.c @@ -1,4 +1,3 @@ -/* @(#)e_pow.c 1.5 04/04/22 SMI */ /* * ==================================================== * Copyright (C) 2004 by Sun Microsystems, Inc. All rights reserved. @@ -9,7 +8,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* pow(x,y) return x**y * * n @@ -301,7 +299,11 @@ pow(double x, double y) r = (z*t1)/(t1-two)-(w+z*w); z = one-(r-z); GET_HIGH_WORD(j,z); - j += (n<<20); + /* + * sign bit of z is 0. + * sign bit of j will indicate sign of 0x3ff-biased exponent. + */ + j += (int32_t)((u_int32_t)n<<20); if((j>>20)<=0) z = scalbn(z,n); /* subnormal output */ else SET_HIGH_WORD(z,j); return s*z; diff --git a/lib/msun/src/e_powf.c b/lib/msun/src/e_powf.c index ff872ab46327..9f670bcd1caa 100644 --- a/lib/msun/src/e_powf.c +++ b/lib/msun/src/e_powf.c @@ -13,7 +13,6 @@ * ==================================================== */ -#include <sys/cdefs.h> #include "math.h" #include "math_private.h" @@ -243,7 +242,11 @@ powf(float x, float y) r = (z*t1)/(t1-two)-(w+z*w); z = one-(r-z); GET_FLOAT_WORD(j,z); - j += (n<<23); + /* + * sign bit of z is 0. + * sign bit of j will indicate sign of 0x7f-biased exponent. + */ + j += (int32_t)((u_int32_t)n<<23); if((j>>23)<=0) z = scalbnf(z,n); /* subnormal output */ else SET_FLOAT_WORD(z,j); return sn*z; diff --git a/lib/msun/src/e_rem_pio2.c b/lib/msun/src/e_rem_pio2.c index ef4107af94cb..16a57a018c59 100644 --- a/lib/msun/src/e_rem_pio2.c +++ b/lib/msun/src/e_rem_pio2.c @@ -1,5 +1,4 @@ -/* @(#)e_rem_pio2.c 1.4 95/01/18 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -13,7 +12,6 @@ * Optimized by Bruce D. Evans. */ -#include <sys/cdefs.h> /* __ieee754_rem_pio2(x,y) * * return the remainder of x rem pi/2 in y[0]+y[1] @@ -47,7 +45,7 @@ pio2_3 = 2.02226624871116645580e-21, /* 0x3BA3198A, 0x2E000000 */ pio2_3t = 8.47842766036889956997e-32; /* 0x397B839A, 0x252049C1 */ #ifdef INLINE_REM_PIO2 -static __inline __always_inline +static __always_inline #endif int __ieee754_rem_pio2(double x, double *y) @@ -164,7 +162,7 @@ medium: /* set z = scalbn(|x|,ilogb(x)-23) */ GET_LOW_WORD(low,x); e0 = (ix>>20)-1046; /* e0 = ilogb(z)-23; */ - INSERT_WORDS(z, ix - ((int32_t)(e0<<20)), low); + INSERT_WORDS(z, ix - ((int32_t)((u_int32_t)e0<<20)), low); for(i=0;i<2;i++) { tx[i] = (double)((int32_t)(z)); z = (z-tx[i])*two24; diff --git a/lib/msun/src/e_rem_pio2f.c b/lib/msun/src/e_rem_pio2f.c index 26f6bc85791b..84cd9bf43d90 100644 --- a/lib/msun/src/e_rem_pio2f.c +++ b/lib/msun/src/e_rem_pio2f.c @@ -14,7 +14,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* __ieee754_rem_pio2f(x,y) * * return the remainder of x rem pi/2 in *y @@ -39,7 +38,7 @@ pio2_1 = 1.57079631090164184570e+00, /* 0x3FF921FB, 0x50000000 */ pio2_1t = 1.58932547735281966916e-08; /* 0x3E5110b4, 0x611A6263 */ #ifdef INLINE_REM_PIO2F -static __inline __always_inline +static __always_inline #endif int __ieee754_rem_pio2f(float x, double *y) @@ -68,7 +67,7 @@ __ieee754_rem_pio2f(float x, double *y) } /* set z = scalbn(|x|,ilogb(|x|)-23) */ e0 = (ix>>23)-150; /* e0 = ilogb(|x|)-23; */ - SET_FLOAT_WORD(z, ix - ((int32_t)(e0<<23))); + SET_FLOAT_WORD(z, ix - ((int32_t)((u_int32_t)e0<<23))); tx[0] = z; n = __kernel_rem_pio2(tx,ty,e0,1,0); if(hx<0) {*y = -ty[0]; return -n;} diff --git a/lib/msun/src/e_remainder.c b/lib/msun/src/e_remainder.c index bd1ce8950619..cc6cd320073e 100644 --- a/lib/msun/src/e_remainder.c +++ b/lib/msun/src/e_remainder.c @@ -1,5 +1,4 @@ -/* @(#)e_remainder.c 1.3 95/01/18 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -11,7 +10,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* remainder(x,p) * Return : * returns x REM p = x - [x/p]*p as if in infinite @@ -66,8 +64,8 @@ remainder(double x, double p) if(x>=p_half) x -= p; } } - GET_HIGH_WORD(hx,x); - if ((hx&0x7fffffff)==0) hx = 0; + EXTRACT_WORDS(hx, lx, x); + if (((hx&0x7fffffff)|lx) == 0) hx = 0; SET_HIGH_WORD(x,hx^sx); return x; } diff --git a/lib/msun/src/e_remainderf.c b/lib/msun/src/e_remainderf.c index 053ae45c4a10..4a6ff6345fcd 100644 --- a/lib/msun/src/e_remainderf.c +++ b/lib/msun/src/e_remainderf.c @@ -13,7 +13,6 @@ * ==================================================== */ -#include <sys/cdefs.h> #include "math.h" #include "math_private.h" diff --git a/lib/msun/src/e_remainderl.c b/lib/msun/src/e_remainderl.c index 4606cf874d75..7a681cdb1289 100644 --- a/lib/msun/src/e_remainderl.c +++ b/lib/msun/src/e_remainderl.c @@ -26,7 +26,6 @@ * SUCH DAMAGE. */ -#include <sys/cdefs.h> #include <math.h> long double diff --git a/lib/msun/src/e_scalb.c b/lib/msun/src/e_scalb.c index 8a38ddb68d81..28d2ae6ff477 100644 --- a/lib/msun/src/e_scalb.c +++ b/lib/msun/src/e_scalb.c @@ -1,5 +1,4 @@ -/* @(#)e_scalb.c 1.3 95/01/18 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -11,7 +10,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* * scalb(x, fn) is provide for * passing various standard test suite. One diff --git a/lib/msun/src/e_scalbf.c b/lib/msun/src/e_scalbf.c index ca94a9fb1634..557a5a007053 100644 --- a/lib/msun/src/e_scalbf.c +++ b/lib/msun/src/e_scalbf.c @@ -13,7 +13,6 @@ * ==================================================== */ -#include <sys/cdefs.h> #include "math.h" #include "math_private.h" diff --git a/lib/msun/src/e_sinh.c b/lib/msun/src/e_sinh.c index b19a4a2f7d48..5eec75e943e3 100644 --- a/lib/msun/src/e_sinh.c +++ b/lib/msun/src/e_sinh.c @@ -1,5 +1,4 @@ -/* @(#)e_sinh.c 1.3 95/01/18 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -11,7 +10,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* sinh(x) * Method : * mathematically sinh(x) if defined to be (exp(x)-exp(-x))/2 diff --git a/lib/msun/src/e_sinhf.c b/lib/msun/src/e_sinhf.c index 7aa177b69f11..e9fe7320d449 100644 --- a/lib/msun/src/e_sinhf.c +++ b/lib/msun/src/e_sinhf.c @@ -13,7 +13,6 @@ * ==================================================== */ -#include <sys/cdefs.h> #include "math.h" #include "math_private.h" diff --git a/lib/msun/src/e_sinhl.c b/lib/msun/src/e_sinhl.c index 121bace1d6c1..cf481b2abd96 100644 --- a/lib/msun/src/e_sinhl.c +++ b/lib/msun/src/e_sinhl.c @@ -11,7 +11,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* * See e_sinh.c for complete comments. * diff --git a/lib/msun/src/e_sqrt.c b/lib/msun/src/e_sqrt.c index ea588c97f5d1..97b778b980be 100644 --- a/lib/msun/src/e_sqrt.c +++ b/lib/msun/src/e_sqrt.c @@ -1,5 +1,4 @@ -/* @(#)e_sqrt.c 1.3 95/01/18 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -11,7 +10,6 @@ * ==================================================== */ -#include <sys/cdefs.h> #include <float.h> #include "math.h" diff --git a/lib/msun/src/e_sqrtf.c b/lib/msun/src/e_sqrtf.c index 1fd0cec447fb..f9e2a320f20e 100644 --- a/lib/msun/src/e_sqrtf.c +++ b/lib/msun/src/e_sqrtf.c @@ -13,10 +13,6 @@ * ==================================================== */ -#ifndef lint -static char rcsid[] = "$FreeBSD$"; -#endif - #include "math.h" #include "math_private.h" diff --git a/lib/msun/src/e_sqrtl.c b/lib/msun/src/e_sqrtl.c index beb4e7a9c948..a785536ea7e2 100644 --- a/lib/msun/src/e_sqrtl.c +++ b/lib/msun/src/e_sqrtl.c @@ -26,7 +26,6 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include <sys/cdefs.h> #include <fenv.h> #include <float.h> diff --git a/lib/msun/src/k_cos.c b/lib/msun/src/k_cos.c index 8cc9a0e83efe..2eb5e040c6c9 100644 --- a/lib/msun/src/k_cos.c +++ b/lib/msun/src/k_cos.c @@ -1,5 +1,4 @@ -/* @(#)k_cos.c 1.3 95/01/18 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -11,7 +10,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* * __kernel_cos( x, y ) * kernel cos function on [-pi/4, pi/4], pi/4 ~ 0.785398164 diff --git a/lib/msun/src/k_cosf.c b/lib/msun/src/k_cosf.c index a93011b52c0d..934c1c7a785e 100644 --- a/lib/msun/src/k_cosf.c +++ b/lib/msun/src/k_cosf.c @@ -14,10 +14,6 @@ * ==================================================== */ -#ifndef INLINE_KERNEL_COSDF -#include <sys/cdefs.h> -#endif - #include "math.h" #include "math_private.h" diff --git a/lib/msun/src/k_exp.c b/lib/msun/src/k_exp.c index ce8e3591827a..383616d64d55 100644 --- a/lib/msun/src/k_exp.c +++ b/lib/msun/src/k_exp.c @@ -26,7 +26,6 @@ * SUCH DAMAGE. */ -#include <sys/cdefs.h> #include <complex.h> #include "math.h" diff --git a/lib/msun/src/k_expf.c b/lib/msun/src/k_expf.c index 61478214e736..2af0c6dd3543 100644 --- a/lib/msun/src/k_expf.c +++ b/lib/msun/src/k_expf.c @@ -26,7 +26,6 @@ * SUCH DAMAGE. */ -#include <sys/cdefs.h> #include <complex.h> #include "math.h" diff --git a/lib/msun/src/k_log.h b/lib/msun/src/k_log.h index f15227139324..da8f00802054 100644 --- a/lib/msun/src/k_log.h +++ b/lib/msun/src/k_log.h @@ -1,5 +1,4 @@ -/* @(#)e_log.c 1.3 95/01/18 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -11,7 +10,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* * k_log1p(f): * Return log(1+f) - f for 1+f in ~[sqrt(2)/2, sqrt(2)]. diff --git a/lib/msun/src/k_logf.h b/lib/msun/src/k_logf.h index 3f637cd6a9ec..72b675143d26 100644 --- a/lib/msun/src/k_logf.h +++ b/lib/msun/src/k_logf.h @@ -9,7 +9,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* * Float version of k_log.h. See the latter for most comments. */ diff --git a/lib/msun/src/k_rem_pio2.c b/lib/msun/src/k_rem_pio2.c index 952bebb6ed2d..3d49d14db19d 100644 --- a/lib/msun/src/k_rem_pio2.c +++ b/lib/msun/src/k_rem_pio2.c @@ -1,5 +1,4 @@ -/* @(#)k_rem_pio2.c 1.3 95/01/18 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -11,7 +10,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* * __kernel_rem_pio2(x,y,e0,nx,prec) * double x[],y[]; int e0,nx,prec; diff --git a/lib/msun/src/k_sin.c b/lib/msun/src/k_sin.c index 6d24a0f21d92..5b97d86e1cf3 100644 --- a/lib/msun/src/k_sin.c +++ b/lib/msun/src/k_sin.c @@ -1,5 +1,4 @@ -/* @(#)k_sin.c 1.3 95/01/18 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -11,7 +10,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* __kernel_sin( x, y, iy) * kernel sin function on ~[-pi/4, pi/4] (except on -0), pi/4 ~ 0.7854 * Input x is assumed to be bounded by ~pi/4 in magnitude. diff --git a/lib/msun/src/k_sincos.h b/lib/msun/src/k_sincos.h index a29a57c06342..796e72af89e5 100644 --- a/lib/msun/src/k_sincos.h +++ b/lib/msun/src/k_sincos.h @@ -11,7 +11,6 @@ * k_sin.c and k_cos.c merged by Steven G. Kargl. */ -#include <sys/cdefs.h> static const double S1 = -1.66666666666666324348e-01, /* 0xBFC55555, 0x55555549 */ S2 = 8.33333333332248946124e-03, /* 0x3F811111, 0x1110F8A6 */ diff --git a/lib/msun/src/k_sincosf.h b/lib/msun/src/k_sincosf.h index 01f5d48b23ee..f031016b79d0 100644 --- a/lib/msun/src/k_sincosf.h +++ b/lib/msun/src/k_sincosf.h @@ -11,7 +11,6 @@ * k_sinf.c and k_cosf.c merged by Steven G. Kargl. */ -#include <sys/cdefs.h> /* |sin(x)/x - s(x)| < 2**-37.5 (~[-4.89e-12, 4.824e-12]). */ static const double S1 = -0x15555554cbac77.0p-55, /* -0.166666666416265235595 */ diff --git a/lib/msun/src/k_sincosl.h b/lib/msun/src/k_sincosl.h index 918d49f54f54..cf8536c8e27e 100644 --- a/lib/msun/src/k_sincosl.h +++ b/lib/msun/src/k_sincosl.h @@ -12,7 +12,6 @@ * k_sinl.c and k_cosl.c merged by Steven G. Kargl */ -#include <sys/cdefs.h> #if LDBL_MANT_DIG == 64 /* ld80 version of k_sincosl.c. */ #if defined(__amd64__) || defined(__i386__) diff --git a/lib/msun/src/k_sinf.c b/lib/msun/src/k_sinf.c index ef547e36bf50..ebebd9663b10 100644 --- a/lib/msun/src/k_sinf.c +++ b/lib/msun/src/k_sinf.c @@ -14,10 +14,6 @@ * ==================================================== */ -#ifndef INLINE_KERNEL_SINDF -#include <sys/cdefs.h> -#endif - #include "math.h" #include "math_private.h" diff --git a/lib/msun/src/k_tan.c b/lib/msun/src/k_tan.c index 5ebcddda09e6..92f30a6a6adf 100644 --- a/lib/msun/src/k_tan.c +++ b/lib/msun/src/k_tan.c @@ -1,5 +1,3 @@ -/* @(#)k_tan.c 1.5 04/04/22 SMI */ - /* * ==================================================== * Copyright 2004 Sun Microsystems, Inc. All Rights Reserved. @@ -10,8 +8,6 @@ * ==================================================== */ -/* INDENT OFF */ -#include <sys/cdefs.h> /* __kernel_tan( x, y, k ) * kernel tan function on ~[-pi/4, pi/4] (except on -0), pi/4 ~ 0.7854 * Input x is assumed to be bounded by ~pi/4 in magnitude. diff --git a/lib/msun/src/k_tanf.c b/lib/msun/src/k_tanf.c index 6ab7be71e323..83bfad9bbb9a 100644 --- a/lib/msun/src/k_tanf.c +++ b/lib/msun/src/k_tanf.c @@ -13,10 +13,6 @@ * ==================================================== */ -#ifndef INLINE_KERNEL_TANDF -#include <sys/cdefs.h> -#endif - #include "math.h" #include "math_private.h" diff --git a/lib/msun/src/math.h b/lib/msun/src/math.h index 8e72beb757f8..aecc652ea08a 100644 --- a/lib/msun/src/math.h +++ b/lib/msun/src/math.h @@ -10,7 +10,6 @@ */ /* - * from: @(#)fdlibm.h 5.1 93/09/24 */ #ifndef _MATH_H_ @@ -33,13 +32,8 @@ extern const union __nan_un { float __uf; } __nan; -#if __GNUC_PREREQ__(3, 3) #define __MATH_BUILTIN_CONSTANTS -#endif - -#if __GNUC_PREREQ__(3, 0) #define __MATH_BUILTIN_RELOPS -#endif #ifdef __MATH_BUILTIN_CONSTANTS #define HUGE_VAL __builtin_huge_val() @@ -78,10 +72,10 @@ extern const union __nan_un { #if __STDC_VERSION__ >= 201112L || __has_extension(c_generic_selections) #define __fp_type_select(x, f, d, ld) __extension__ _Generic((x), \ - float: f(x), \ - double: d(x), \ - long double: ld(x)) -#elif __GNUC_PREREQ__(3, 1) && !defined(__cplusplus) + float: f, \ + double: d, \ + long double: ld)(x) +#elif !defined(__cplusplus) #define __fp_type_select(x, f, d, ld) __builtin_choose_expr( \ __builtin_types_compatible_p(__typeof(x), long double), ld(x), \ __builtin_choose_expr( \ @@ -144,6 +138,22 @@ typedef __float_t float_t; #define M_SQRT2 1.41421356237309504880 /* sqrt(2) */ #define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */ +#if __BSD_VISIBLE || __XSI_VISIBLE >= 800 +#define M_El 2.718281828459045235360287471352662498L /* e */ +#define M_LOG2El 1.442695040888963407359924681001892137L /* log_2 e */ +#define M_LOG10El 0.434294481903251827651128918916605082L /* log_10 e */ +#define M_LN2l 0.693147180559945309417232121458176568L /* log_e 2 */ +#define M_LN10l 2.302585092994045684017991454684364208L /* log_e 10 */ +#define M_PIl 3.141592653589793238462643383279502884L /* pi */ +#define M_PI_2l 1.570796326794896619231321691639751442L /* pi/2 */ +#define M_PI_4l 0.785398163397448309615660845819875721L /* pi/4 */ +#define M_1_PIl 0.318309886183790671537767526745028724L /* 1/pi */ +#define M_2_PIl 0.636619772367581343075535053490057448L /* 2/pi */ +#define M_2_SQRTPIl 1.128379167095512573896158903121545172L /* 2/sqrt(pi) */ +#define M_SQRT2l 1.414213562373095048801688724209698079L /* sqrt(2) */ +#define M_SQRT1_2l 0.707106781186547524400844362104849039L /* 1/sqrt(2) */ +#endif /* __BSD_VISIBLE || __XSI_VISIBLE >= 800 */ + #define MAXFLOAT ((float)3.40282346638528860e+38) extern int signgam; #endif /* __BSD_VISIBLE || __XSI_VISIBLE */ @@ -183,21 +193,21 @@ int __signbitf(float) __pure2; int __signbitl(long double) __pure2; static __inline int -__inline_isnan(__const double __x) +__inline_isnan(const double __x) { return (__x != __x); } static __inline int -__inline_isnanf(__const float __x) +__inline_isnanf(const float __x) { return (__x != __x); } static __inline int -__inline_isnanl(__const long double __x) +__inline_isnanl(const long double __x) { return (__x != __x); diff --git a/lib/msun/src/math_private.h b/lib/msun/src/math_private.h index eae2a2a317b4..fbd84e246ca7 100644 --- a/lib/msun/src/math_private.h +++ b/lib/msun/src/math_private.h @@ -10,7 +10,6 @@ */ /* - * from: @(#)fdlibm.h 5.1 93/09/24 */ #ifndef _MATH_PRIVATE_H_ @@ -406,7 +405,7 @@ do { \ * any extra precision into the type of 'a' -- 'a' should have type float_t, * double_t or long double. b's type should be no larger than 'a's type. * Callers should use these types with scopes as large as possible, to - * reduce their own extra-precision and efficiciency problems. In + * reduce their own extra-precision and efficiency problems. In * particular, they shouldn't convert back and forth just to call here. */ #ifdef DEBUG @@ -740,6 +739,41 @@ irintl(long double x) (ar) = (x) - (ai); \ } while (0) +/* + * For a subnormal double entity split into high and low parts, compute ilogb. + */ +static inline int32_t +subnormal_ilogb(int32_t hi, int32_t lo) +{ + int32_t j; + uint32_t i; + + j = -1022; + if (hi == 0) { + j -= 21; + i = (uint32_t)lo; + } else + i = (uint32_t)hi << 11; + + for (; i < 0x7fffffff; i <<= 1) j -= 1; + + return (j); +} + +/* + * For a subnormal float entity represented as an int32_t, compute ilogb. + */ +static inline int32_t +subnormal_ilogbf(int32_t hx) +{ + int32_t j; + uint32_t i; + i = (uint32_t) hx << 8; + for (j = -126; i < 0x7fffffff; i <<= 1) j -=1; + + return (j); +} + #ifdef DEBUG #if defined(__amd64__) || defined(__i386__) #define breakpoint() asm("int $3") diff --git a/lib/msun/src/s_asinh.c b/lib/msun/src/s_asinh.c index a8bad118f6b3..daebf2145960 100644 --- a/lib/msun/src/s_asinh.c +++ b/lib/msun/src/s_asinh.c @@ -1,4 +1,3 @@ -/* @(#)s_asinh.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,7 +9,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* asinh(x) * Method : * Based on diff --git a/lib/msun/src/s_asinhf.c b/lib/msun/src/s_asinhf.c index 822b0187ad09..4e622d5f6242 100644 --- a/lib/msun/src/s_asinhf.c +++ b/lib/msun/src/s_asinhf.c @@ -13,7 +13,6 @@ * ==================================================== */ -#include <sys/cdefs.h> #include "math.h" #include "math_private.h" diff --git a/lib/msun/src/s_asinhl.c b/lib/msun/src/s_asinhl.c index d80405821ff4..b939fae8fbef 100644 --- a/lib/msun/src/s_asinhl.c +++ b/lib/msun/src/s_asinhl.c @@ -1,6 +1,5 @@ /* from: FreeBSD: head/lib/msun/src/e_acosh.c 176451 2008-02-22 02:30:36Z das */ -/* @(#)s_asinh.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -12,7 +11,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* * See s_asinh.c for complete comments. * diff --git a/lib/msun/src/s_atan.c b/lib/msun/src/s_atan.c index d2bfacf52ab6..bff8b5cad9d0 100644 --- a/lib/msun/src/s_atan.c +++ b/lib/msun/src/s_atan.c @@ -1,4 +1,3 @@ -/* @(#)s_atan.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,7 +9,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* atan(x) * Method * 1. Reduce x to positive by atan(x) = -atan(-x). diff --git a/lib/msun/src/s_atanf.c b/lib/msun/src/s_atanf.c index 30666fe0b66a..2c38014ac6c8 100644 --- a/lib/msun/src/s_atanf.c +++ b/lib/msun/src/s_atanf.c @@ -13,7 +13,6 @@ * ==================================================== */ -#include <sys/cdefs.h> #include "math.h" #include "math_private.h" diff --git a/lib/msun/src/s_atanl.c b/lib/msun/src/s_atanl.c index b85cb131035f..d9e617455499 100644 --- a/lib/msun/src/s_atanl.c +++ b/lib/msun/src/s_atanl.c @@ -1,4 +1,3 @@ -/* @(#)s_atan.c 5.1 93/09/24 */ /* FreeBSD: head/lib/msun/src/s_atan.c 176451 2008-02-22 02:30:36Z das */ /* * ==================================================== @@ -11,7 +10,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* * See comments in s_atan.c. * Converted to long double by David Schultz <das@FreeBSD.ORG>. diff --git a/lib/msun/src/s_carg.c b/lib/msun/src/s_carg.c index 45714bbdb18a..ea7edfdf0835 100644 --- a/lib/msun/src/s_carg.c +++ b/lib/msun/src/s_carg.c @@ -26,7 +26,6 @@ * SUCH DAMAGE. */ -#include <sys/cdefs.h> #include <complex.h> #include <math.h> diff --git a/lib/msun/src/s_cargf.c b/lib/msun/src/s_cargf.c index c4d53006b542..25ab65ef7f9f 100644 --- a/lib/msun/src/s_cargf.c +++ b/lib/msun/src/s_cargf.c @@ -26,7 +26,6 @@ * SUCH DAMAGE. */ -#include <sys/cdefs.h> #include <complex.h> #include <math.h> diff --git a/lib/msun/src/s_cargl.c b/lib/msun/src/s_cargl.c index d7f8206e9608..8a1a108705d4 100644 --- a/lib/msun/src/s_cargl.c +++ b/lib/msun/src/s_cargl.c @@ -26,7 +26,6 @@ * SUCH DAMAGE. */ -#include <sys/cdefs.h> #include <complex.h> #include <math.h> diff --git a/lib/msun/src/s_cbrt.c b/lib/msun/src/s_cbrt.c index afb601bf0fb6..568a36545216 100644 --- a/lib/msun/src/s_cbrt.c +++ b/lib/msun/src/s_cbrt.c @@ -1,4 +1,3 @@ -/* @(#)s_cbrt.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -12,7 +11,6 @@ * Optimized by Bruce D. Evans. */ -#include <sys/cdefs.h> #include <float.h> #include "math.h" #include "math_private.h" @@ -92,7 +90,7 @@ cbrt(double x) * the result is larger in magnitude than cbrt(x) but not much more than * 2 23-bit ulps larger). With rounding towards zero, the error bound * would be ~5/6 instead of ~4/6. With a maximum error of 2 23-bit ulps - * in the rounded t, the infinite-precision error in the Newton + * in the rounded t, the infinite-precision error in the Halley * approximation barely affects third digit in the final error * 0.667; the error in the rounded t can be up to about 3 23-bit ulps * before the final error is larger than 0.667 ulps. @@ -101,7 +99,7 @@ cbrt(double x) u.bits=(u.bits+0x80000000)&0xffffffffc0000000ULL; t=u.value; - /* one step Newton iteration to 53 bits with error < 0.667 ulps */ + /* one step Halley iteration to 53 bits with error < 0.667 ulps */ s=t*t; /* t*t is exact */ r=x/s; /* error <= 0.5 ulps; |r| < |t| */ w=t+t; /* t+t is exact */ diff --git a/lib/msun/src/s_cbrtf.c b/lib/msun/src/s_cbrtf.c index f013e1f1eb6f..c69e0fa5be12 100644 --- a/lib/msun/src/s_cbrtf.c +++ b/lib/msun/src/s_cbrtf.c @@ -14,7 +14,6 @@ * ==================================================== */ -#include <sys/cdefs.h> #include "math.h" #include "math_private.h" @@ -51,7 +50,7 @@ cbrtf(float x) SET_FLOAT_WORD(t,sign|(hx/3+B1)); /* - * First step Newton iteration (solving t*t-x/t == 0) to 16 bits. In + * First step Halley iteration (solving t*t-x/t == 0) to 16 bits. In * double precision so that its terms can be arranged for efficiency * without causing overflow or underflow. */ @@ -60,7 +59,7 @@ cbrtf(float x) T=T*((double)x+x+r)/(x+r+r); /* - * Second step Newton iteration to 47 bits. In double precision for + * Second step Halley iteration to 47 bits. In double precision for * efficiency and accuracy. */ r=T*T*T; diff --git a/lib/msun/src/s_cbrtl.c b/lib/msun/src/s_cbrtl.c index 3ed939cccf92..ff527cc5e5e7 100644 --- a/lib/msun/src/s_cbrtl.c +++ b/lib/msun/src/s_cbrtl.c @@ -14,7 +14,6 @@ * and David A. Schultz. */ -#include <sys/cdefs.h> #include <float.h> #ifdef __i386__ #include <ieeefp.h> @@ -127,7 +126,7 @@ cbrtl(long double x) #endif /* - * Final step Newton iteration to 64 or 113 bits with + * Final step Halley iteration to 64 or 113 bits with * error < 0.667 ulps */ s=t*t; /* t*t is exact */ diff --git a/lib/msun/src/s_ccosh.c b/lib/msun/src/s_ccosh.c index 95ed3a32ddd7..14a8931742dc 100644 --- a/lib/msun/src/s_ccosh.c +++ b/lib/msun/src/s_ccosh.c @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2005 Bruce D. Evans and Steven G. Kargl + * Copyright (c) 2005-2025 Bruce D. Evans and Steven G. Kargl * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -38,7 +38,6 @@ * must satisfy both cosh(conj(z)) == conj(cosh(z)) and cosh(-z) == cosh(z). */ -#include <sys/cdefs.h> #include <complex.h> #include <math.h> @@ -49,7 +48,7 @@ static const double huge = 0x1p1023; double complex ccosh(double complex z) { - double x, y, h; + double c, h, s, x, y; int32_t hx, hy, ix, iy, lx, ly; x = creal(z); @@ -65,14 +64,16 @@ ccosh(double complex z) if (ix < 0x7ff00000 && iy < 0x7ff00000) { if ((iy | ly) == 0) return (CMPLX(cosh(x), x * y)); + + sincos(y, &s, &c); if (ix < 0x40360000) /* |x| < 22: normal case */ - return (CMPLX(cosh(x) * cos(y), sinh(x) * sin(y))); + return (CMPLX(cosh(x) * c, sinh(x) * s)); /* |x| >= 22, so cosh(x) ~= exp(|x|) */ if (ix < 0x40862e42) { /* x < 710: exp(|x|) won't overflow */ - h = exp(fabs(x)) * 0.5; - return (CMPLX(h * cos(y), copysign(h, x) * sin(y))); + h = exp(fabs(x)) / 2; + return (CMPLX(h * c, copysign(h, x) * s)); } else if (ix < 0x4096bbaa) { /* x < 1455: scale to avoid overflow */ z = __ldexp_cexp(CMPLX(fabs(x), y), -1); @@ -80,7 +81,7 @@ ccosh(double complex z) } else { /* x >= 1455: the result always overflows */ h = huge * x; - return (CMPLX(h * h * cos(y), h * sin(y))); + return (CMPLX(h * h * c, h * s)); } } @@ -130,7 +131,9 @@ ccosh(double complex z) if (ix == 0x7ff00000 && lx == 0) { if (iy >= 0x7ff00000) return (CMPLX(INFINITY, x * (y - y))); - return (CMPLX(INFINITY * cos(y), x * sin(y))); + + sincos(y, &s, &c); + return (CMPLX(INFINITY * c, x * s)); } /* @@ -155,3 +158,8 @@ ccos(double complex z) /* ccos(z) = ccosh(I * z) */ return (ccosh(CMPLX(-cimag(z), creal(z)))); } + +#if (LDBL_MANT_DIG == 53) +__weak_reference(ccosh, ccoshl); +__weak_reference(ccos, ccosl); +#endif diff --git a/lib/msun/src/s_ccoshf.c b/lib/msun/src/s_ccoshf.c index ba97a390c832..fa41fdf4c4ea 100644 --- a/lib/msun/src/s_ccoshf.c +++ b/lib/msun/src/s_ccoshf.c @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2005 Bruce D. Evans and Steven G. Kargl + * Copyright (c) 2005-2025 Bruce D. Evans and Steven G. Kargl * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -30,7 +30,6 @@ * Float version of ccosh(). See s_ccosh.c for details. */ -#include <sys/cdefs.h> #include <complex.h> #include <math.h> @@ -41,7 +40,7 @@ static const float huge = 0x1p127; float complex ccoshf(float complex z) { - float x, y, h; + float c, h, s, x, y; int32_t hx, hy, ix, iy; x = crealf(z); @@ -56,14 +55,16 @@ ccoshf(float complex z) if (ix < 0x7f800000 && iy < 0x7f800000) { if (iy == 0) return (CMPLXF(coshf(x), x * y)); + + sincosf(y, &s, &c); if (ix < 0x41100000) /* |x| < 9: normal case */ - return (CMPLXF(coshf(x) * cosf(y), sinhf(x) * sinf(y))); + return (CMPLXF(coshf(x) * c, sinhf(x) * s)); /* |x| >= 9, so cosh(x) ~= exp(|x|) */ if (ix < 0x42b17218) { /* x < 88.7: expf(|x|) won't overflow */ - h = expf(fabsf(x)) * 0.5F; - return (CMPLXF(h * cosf(y), copysignf(h, x) * sinf(y))); + h = expf(fabsf(x)) / 2; + return (CMPLXF(h * c, copysignf(h, x) * s)); } else if (ix < 0x4340b1e7) { /* x < 192.7: scale to avoid overflow */ z = __ldexp_cexpf(CMPLXF(fabsf(x), y), -1); @@ -71,7 +72,7 @@ ccoshf(float complex z) } else { /* x >= 192.7: the result always overflows */ h = huge * x; - return (CMPLXF(h * h * cosf(y), h * sinf(y))); + return (CMPLXF(h * h * c, h * s)); } } @@ -87,7 +88,9 @@ ccoshf(float complex z) if (ix == 0x7f800000) { if (iy >= 0x7f800000) return (CMPLXF(INFINITY, x * (y - y))); - return (CMPLXF(INFINITY * cosf(y), x * sinf(y))); + + sincosf(y, &s, &c); + return (CMPLXF(INFINITY * c, x * s)); } return (CMPLXF(((long double)x * x) * (y - y), diff --git a/lib/msun/src/s_ceil.c b/lib/msun/src/s_ceil.c index 9c041b2a94e1..e6699bcb52d0 100644 --- a/lib/msun/src/s_ceil.c +++ b/lib/msun/src/s_ceil.c @@ -1,4 +1,3 @@ -/* @(#)s_ceil.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,7 +9,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* * ceil(x) * Return x rounded toward -inf to integral value diff --git a/lib/msun/src/s_ceilf.c b/lib/msun/src/s_ceilf.c index 3cb0e11688bf..cc19afa9dd96 100644 --- a/lib/msun/src/s_ceilf.c +++ b/lib/msun/src/s_ceilf.c @@ -13,7 +13,6 @@ * ==================================================== */ -#include <sys/cdefs.h> #include "math.h" #include "math_private.h" diff --git a/lib/msun/src/s_ceill.c b/lib/msun/src/s_ceill.c index 28c0881e8da6..ded36c1ebe1b 100644 --- a/lib/msun/src/s_ceill.c +++ b/lib/msun/src/s_ceill.c @@ -7,11 +7,8 @@ * software is freely granted, provided that this notice * is preserved. * ==================================================== - * - * From: @(#)s_ceil.c 5.1 93/09/24 */ -#include <sys/cdefs.h> /* * ceill(x) * Return x rounded toward -inf to integral value diff --git a/lib/msun/src/s_cexp.c b/lib/msun/src/s_cexp.c index 056d273f6932..0151768473c7 100644 --- a/lib/msun/src/s_cexp.c +++ b/lib/msun/src/s_cexp.c @@ -26,7 +26,6 @@ * SUCH DAMAGE. */ -#include <sys/cdefs.h> #include <complex.h> #include <float.h> #include <math.h> diff --git a/lib/msun/src/s_cexpf.c b/lib/msun/src/s_cexpf.c index 872e9253daa5..a6c0c995cf5e 100644 --- a/lib/msun/src/s_cexpf.c +++ b/lib/msun/src/s_cexpf.c @@ -26,7 +26,6 @@ * SUCH DAMAGE. */ -#include <sys/cdefs.h> #include <complex.h> #include <math.h> diff --git a/lib/msun/src/s_clog.c b/lib/msun/src/s_clog.c index e51ff5230e45..2129890f43de 100644 --- a/lib/msun/src/s_clog.c +++ b/lib/msun/src/s_clog.c @@ -24,7 +24,6 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include <sys/cdefs.h> #include <complex.h> #include <float.h> diff --git a/lib/msun/src/s_clogf.c b/lib/msun/src/s_clogf.c index 761f91b12efa..2204e1e59bb6 100644 --- a/lib/msun/src/s_clogf.c +++ b/lib/msun/src/s_clogf.c @@ -24,7 +24,6 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include <sys/cdefs.h> #include <complex.h> #include <float.h> diff --git a/lib/msun/src/s_clogl.c b/lib/msun/src/s_clogl.c index 78244961df5c..075bdb49f851 100644 --- a/lib/msun/src/s_clogl.c +++ b/lib/msun/src/s_clogl.c @@ -24,7 +24,6 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include <sys/cdefs.h> #include <complex.h> #include <float.h> #ifdef __i386__ diff --git a/lib/msun/src/s_copysign.c b/lib/msun/src/s_copysign.c index 2a9923a2480a..8d913a37a6d7 100644 --- a/lib/msun/src/s_copysign.c +++ b/lib/msun/src/s_copysign.c @@ -1,4 +1,3 @@ -/* @(#)s_copysign.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,7 +9,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* * copysign(double x, double y) * copysign(x,y) returns a value with the magnitude of x and diff --git a/lib/msun/src/s_copysignf.c b/lib/msun/src/s_copysignf.c index a35b07ccbb5b..68964e509b6c 100644 --- a/lib/msun/src/s_copysignf.c +++ b/lib/msun/src/s_copysignf.c @@ -13,7 +13,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* * copysignf(float x, float y) * copysignf(x,y) returns a value with the magnitude of x and diff --git a/lib/msun/src/s_cos.c b/lib/msun/src/s_cos.c index 97f72a15ce4d..44ecad9394f7 100644 --- a/lib/msun/src/s_cos.c +++ b/lib/msun/src/s_cos.c @@ -1,4 +1,3 @@ -/* @(#)s_cos.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,7 +9,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* cos(x) * Return cosine function of x. * diff --git a/lib/msun/src/s_cosf.c b/lib/msun/src/s_cosf.c index a0ba8598f7e6..6fc53f7b874f 100644 --- a/lib/msun/src/s_cosf.c +++ b/lib/msun/src/s_cosf.c @@ -14,7 +14,6 @@ * ==================================================== */ -#include <sys/cdefs.h> #include <float.h> #include "math.h" diff --git a/lib/msun/src/s_cosl.c b/lib/msun/src/s_cosl.c index 00c24ce13d12..32fc8b26a206 100644 --- a/lib/msun/src/s_cosl.c +++ b/lib/msun/src/s_cosl.c @@ -26,7 +26,6 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include <sys/cdefs.h> /* * Limited testing on pseudorandom numbers drawn within [-2e8:4e8] shows * an accuracy of <= 0.7412 ULP. diff --git a/lib/msun/src/s_cpow.c b/lib/msun/src/s_cpow.c index 735d38956380..2c20a8f3b48b 100644 --- a/lib/msun/src/s_cpow.c +++ b/lib/msun/src/s_cpow.c @@ -43,7 +43,6 @@ * */ -#include <sys/cdefs.h> #include <complex.h> #include <float.h> #include <math.h> @@ -59,7 +58,10 @@ cpow(double complex a, double complex z) y = cimag (z); absa = cabs (a); if (absa == 0.0) { - return (CMPLX(0.0, 0.0)); + if (x == 0 && y == 0) + return (CMPLX(1., 0.)); + else + return (CMPLX(0., 0.)); } arga = carg (a); r = pow (absa, x); diff --git a/lib/msun/src/s_cpowf.c b/lib/msun/src/s_cpowf.c index aefcd7619de1..b8bdbd9cb07b 100644 --- a/lib/msun/src/s_cpowf.c +++ b/lib/msun/src/s_cpowf.c @@ -43,7 +43,6 @@ * */ -#include <sys/cdefs.h> #include <complex.h> #include <math.h> #include "math_private.h" @@ -58,7 +57,10 @@ cpowf(float complex a, float complex z) y = cimagf(z); absa = cabsf (a); if (absa == 0.0f) { - return (CMPLXF(0.0f, 0.0f)); + if (x == 0 && y == 0) + return (CMPLXF(1.f, 0.f)); + else + return (CMPLXF(0.f, 0.f)); } arga = cargf (a); r = powf (absa, x); diff --git a/lib/msun/src/s_cpowl.c b/lib/msun/src/s_cpowl.c index 342dfcff8481..efbe4936895f 100644 --- a/lib/msun/src/s_cpowl.c +++ b/lib/msun/src/s_cpowl.c @@ -43,7 +43,6 @@ * */ -#include <sys/cdefs.h> #include <complex.h> #include <math.h> #include "math_private.h" @@ -58,7 +57,10 @@ cpowl(long double complex a, long double complex z) y = cimagl(z); absa = cabsl(a); if (absa == 0.0L) { - return (CMPLXL(0.0L, 0.0L)); + if (x == 0 && y == 0) + return (CMPLXL(1.L, 0.L)); + else + return (CMPLXL(0.L, 0.L)); } arga = cargl(a); r = powl(absa, x); diff --git a/lib/msun/src/s_cproj.c b/lib/msun/src/s_cproj.c index 75cb083baf17..9eebb450ae11 100644 --- a/lib/msun/src/s_cproj.c +++ b/lib/msun/src/s_cproj.c @@ -26,7 +26,6 @@ * SUCH DAMAGE. */ -#include <sys/cdefs.h> #include <complex.h> #include <float.h> #include <math.h> diff --git a/lib/msun/src/s_cprojf.c b/lib/msun/src/s_cprojf.c index aadc5ef35cbd..13d90ba6fb5e 100644 --- a/lib/msun/src/s_cprojf.c +++ b/lib/msun/src/s_cprojf.c @@ -26,7 +26,6 @@ * SUCH DAMAGE. */ -#include <sys/cdefs.h> #include <complex.h> #include <math.h> diff --git a/lib/msun/src/s_cprojl.c b/lib/msun/src/s_cprojl.c index 78e3e9a6fdca..083b5fa1c8f3 100644 --- a/lib/msun/src/s_cprojl.c +++ b/lib/msun/src/s_cprojl.c @@ -26,7 +26,6 @@ * SUCH DAMAGE. */ -#include <sys/cdefs.h> #include <complex.h> #include <math.h> diff --git a/lib/msun/src/s_csinh.c b/lib/msun/src/s_csinh.c index 1bd78b1e49bf..11c2ec345094 100644 --- a/lib/msun/src/s_csinh.c +++ b/lib/msun/src/s_csinh.c @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2005 Bruce D. Evans and Steven G. Kargl + * Copyright (c) 2005-2025 Bruce D. Evans and Steven G. Kargl * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -38,7 +38,6 @@ * must satisfy both sinh(conj(z)) == conj(sinh(z)) and sinh(-z) == -sinh(z). */ -#include <sys/cdefs.h> #include <complex.h> #include <math.h> @@ -49,7 +48,7 @@ static const double huge = 0x1p1023; double complex csinh(double complex z) { - double x, y, h; + double c, h, s, x, y; int32_t hx, hy, ix, iy, lx, ly; x = creal(z); @@ -65,14 +64,16 @@ csinh(double complex z) if (ix < 0x7ff00000 && iy < 0x7ff00000) { if ((iy | ly) == 0) return (CMPLX(sinh(x), y)); + + sincos(y, &s, &c); if (ix < 0x40360000) /* |x| < 22: normal case */ - return (CMPLX(sinh(x) * cos(y), cosh(x) * sin(y))); + return (CMPLX(sinh(x) * c, cosh(x) * s)); /* |x| >= 22, so cosh(x) ~= exp(|x|) */ if (ix < 0x40862e42) { /* x < 710: exp(|x|) won't overflow */ - h = exp(fabs(x)) * 0.5; - return (CMPLX(copysign(h, x) * cos(y), h * sin(y))); + h = exp(fabs(x)) / 2; + return (CMPLX(copysign(h, x) * c, h * s)); } else if (ix < 0x4096bbaa) { /* x < 1455: scale to avoid overflow */ z = __ldexp_cexp(CMPLX(fabs(x), y), -1); @@ -80,7 +81,7 @@ csinh(double complex z) } else { /* x >= 1455: the result always overflows */ h = huge * x; - return (CMPLX(h * cos(y), h * h * sin(y))); + return (CMPLX(h * c, h * h * s)); } } @@ -129,7 +130,9 @@ csinh(double complex z) if (ix == 0x7ff00000 && lx == 0) { if (iy >= 0x7ff00000) return (CMPLX(x, y - y)); - return (CMPLX(x * cos(y), INFINITY * sin(y))); + + sincos(y, &s, &c); + return (CMPLX(x * c, INFINITY * s)); } /* @@ -155,3 +158,8 @@ csin(double complex z) z = csinh(CMPLX(cimag(z), creal(z))); return (CMPLX(cimag(z), creal(z))); } + +#if (LDBL_MANT_DIG == 53) +__weak_reference(csinh, csinhl); +__weak_reference(csin, csinl); +#endif diff --git a/lib/msun/src/s_csinhf.c b/lib/msun/src/s_csinhf.c index b1f333955e53..fcfc011a2484 100644 --- a/lib/msun/src/s_csinhf.c +++ b/lib/msun/src/s_csinhf.c @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2005 Bruce D. Evans and Steven G. Kargl + * Copyright (c) 2005-2025 Bruce D. Evans and Steven G. Kargl * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -30,7 +30,6 @@ * Float version of csinh(). See s_csinh.c for details. */ -#include <sys/cdefs.h> #include <complex.h> #include <math.h> @@ -41,7 +40,7 @@ static const float huge = 0x1p127; float complex csinhf(float complex z) { - float x, y, h; + float c, h, s, x, y; int32_t hx, hy, ix, iy; x = crealf(z); @@ -56,14 +55,16 @@ csinhf(float complex z) if (ix < 0x7f800000 && iy < 0x7f800000) { if (iy == 0) return (CMPLXF(sinhf(x), y)); + + sincosf(y, &s, &c); if (ix < 0x41100000) /* |x| < 9: normal case */ - return (CMPLXF(sinhf(x) * cosf(y), coshf(x) * sinf(y))); + return (CMPLXF(sinhf(x) * c, coshf(x) * s)); /* |x| >= 9, so cosh(x) ~= exp(|x|) */ if (ix < 0x42b17218) { /* x < 88.7: expf(|x|) won't overflow */ - h = expf(fabsf(x)) * 0.5F; - return (CMPLXF(copysignf(h, x) * cosf(y), h * sinf(y))); + h = expf(fabsf(x)) / 2; + return (CMPLXF(copysignf(h, x) * c, h * s)); } else if (ix < 0x4340b1e7) { /* x < 192.7: scale to avoid overflow */ z = __ldexp_cexpf(CMPLXF(fabsf(x), y), -1); @@ -71,7 +72,7 @@ csinhf(float complex z) } else { /* x >= 192.7: the result always overflows */ h = huge * x; - return (CMPLXF(h * cosf(y), h * h * sinf(y))); + return (CMPLXF(h * c, h * h * s)); } } @@ -87,7 +88,9 @@ csinhf(float complex z) if (ix == 0x7f800000) { if (iy >= 0x7f800000) return (CMPLXF(x, y - y)); - return (CMPLXF(x * cosf(y), INFINITY * sinf(y))); + + sincosf(y, &s, &c); + return (CMPLXF(x * c, INFINITY * s)); } return (CMPLXF(((long double)x + x) * (y - y), diff --git a/lib/msun/src/s_csqrt.c b/lib/msun/src/s_csqrt.c index afac4db17b61..c40b5a6de907 100644 --- a/lib/msun/src/s_csqrt.c +++ b/lib/msun/src/s_csqrt.c @@ -26,7 +26,6 @@ * SUCH DAMAGE. */ -#include <sys/cdefs.h> #include <complex.h> #include <float.h> #include <math.h> diff --git a/lib/msun/src/s_csqrtf.c b/lib/msun/src/s_csqrtf.c index ece9f6c13657..b57245166078 100644 --- a/lib/msun/src/s_csqrtf.c +++ b/lib/msun/src/s_csqrtf.c @@ -26,7 +26,6 @@ * SUCH DAMAGE. */ -#include <sys/cdefs.h> #include <complex.h> #include <math.h> diff --git a/lib/msun/src/s_csqrtl.c b/lib/msun/src/s_csqrtl.c index b0fc37c902f1..0f375f3c2349 100644 --- a/lib/msun/src/s_csqrtl.c +++ b/lib/msun/src/s_csqrtl.c @@ -26,7 +26,6 @@ * SUCH DAMAGE. */ -#include <sys/cdefs.h> #include <complex.h> #include <float.h> #include <math.h> diff --git a/lib/msun/src/s_ctanh.c b/lib/msun/src/s_ctanh.c index 33186510a8a3..690436343437 100644 --- a/lib/msun/src/s_ctanh.c +++ b/lib/msun/src/s_ctanh.c @@ -65,7 +65,6 @@ * precision. I also handle large x differently. */ -#include <sys/cdefs.h> #include <complex.h> #include <math.h> diff --git a/lib/msun/src/s_ctanhf.c b/lib/msun/src/s_ctanhf.c index c2fb2f8618f6..551e143a3d27 100644 --- a/lib/msun/src/s_ctanhf.c +++ b/lib/msun/src/s_ctanhf.c @@ -30,7 +30,6 @@ * Hyperbolic tangent of a complex argument z. See s_ctanh.c for details. */ -#include <sys/cdefs.h> #include <complex.h> #include <math.h> diff --git a/lib/msun/src/s_erf.c b/lib/msun/src/s_erf.c index 6fc9e56d11af..a9de12274b50 100644 --- a/lib/msun/src/s_erf.c +++ b/lib/msun/src/s_erf.c @@ -1,4 +1,3 @@ -/* @(#)s_erf.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,7 +9,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* double erf(double x) * double erfc(double x) * x diff --git a/lib/msun/src/s_erff.c b/lib/msun/src/s_erff.c index bf011b312bfb..6c8f4060c802 100644 --- a/lib/msun/src/s_erff.c +++ b/lib/msun/src/s_erff.c @@ -13,7 +13,6 @@ * ==================================================== */ -#include <sys/cdefs.h> #include "math.h" #include "math_private.h" diff --git a/lib/msun/src/s_exp2.c b/lib/msun/src/s_exp2.c index 5bf9d65975e0..2064d22f44f3 100644 --- a/lib/msun/src/s_exp2.c +++ b/lib/msun/src/s_exp2.c @@ -26,7 +26,6 @@ * SUCH DAMAGE. */ -#include <sys/cdefs.h> #include <float.h> #include "math.h" @@ -315,7 +314,7 @@ static const double tbl[TBLSIZE * 2] = { * Method: (accurate tables) * * Reduce x: - * x = 2**k + y, for integer k and |y| <= 1/2. + * x = k + y, for integer k and |y| <= 1/2. * Thus we have exp2(x) = 2**k * exp2(y). * * Reduce y: diff --git a/lib/msun/src/s_exp2f.c b/lib/msun/src/s_exp2f.c index f94cfaf9ce96..c863b7512194 100644 --- a/lib/msun/src/s_exp2f.c +++ b/lib/msun/src/s_exp2f.c @@ -26,7 +26,6 @@ * SUCH DAMAGE. */ -#include <sys/cdefs.h> #include <float.h> #include "math.h" @@ -73,7 +72,7 @@ static const double exp2ft[TBLSIZE] = { * Method: (equally-spaced tables) * * Reduce x: - * x = 2**k + y, for integer k and |y| <= 1/2. + * x = k + y, for integer k and |y| <= 1/2. * Thus we have exp2f(x) = 2**k * exp2(y). * * Reduce y: diff --git a/lib/msun/src/s_expm1.c b/lib/msun/src/s_expm1.c index 154a5d8148a5..cdc225e8c001 100644 --- a/lib/msun/src/s_expm1.c +++ b/lib/msun/src/s_expm1.c @@ -1,4 +1,3 @@ -/* @(#)s_expm1.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,7 +9,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* expm1(x) * Returns exp(x)-1, the exponential of x minus 1. * diff --git a/lib/msun/src/s_expm1f.c b/lib/msun/src/s_expm1f.c index 831c0caa6db8..6887bf265272 100644 --- a/lib/msun/src/s_expm1f.c +++ b/lib/msun/src/s_expm1f.c @@ -13,7 +13,6 @@ * ==================================================== */ -#include <sys/cdefs.h> #include <float.h> #include "math.h" diff --git a/lib/msun/src/s_fabs.c b/lib/msun/src/s_fabs.c index ec071d481ac6..1f1ce64a8a1c 100644 --- a/lib/msun/src/s_fabs.c +++ b/lib/msun/src/s_fabs.c @@ -1,4 +1,3 @@ -/* @(#)s_fabs.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,7 +9,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* * fabs(x) returns the absolute value of x. */ diff --git a/lib/msun/src/s_fabsf.c b/lib/msun/src/s_fabsf.c index 501676253385..66d09534dbc5 100644 --- a/lib/msun/src/s_fabsf.c +++ b/lib/msun/src/s_fabsf.c @@ -13,7 +13,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* * fabsf(x) returns the absolute value of x. */ diff --git a/lib/msun/src/s_fdim.c b/lib/msun/src/s_fdim.c index 580ab4605f92..4f56ee4b3482 100644 --- a/lib/msun/src/s_fdim.c +++ b/lib/msun/src/s_fdim.c @@ -26,7 +26,6 @@ * SUCH DAMAGE. */ -#include <sys/cdefs.h> #include <math.h> #define DECL(type, fn) \ diff --git a/lib/msun/src/s_finite.c b/lib/msun/src/s_finite.c index c6b1cfa6d111..a3fd5994c100 100644 --- a/lib/msun/src/s_finite.c +++ b/lib/msun/src/s_finite.c @@ -1,4 +1,3 @@ -/* @(#)s_finite.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,7 +9,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* * finite(x) returns 1 is x is finite, else 0; * no branching! diff --git a/lib/msun/src/s_finitef.c b/lib/msun/src/s_finitef.c index 94e527257c06..9a4a876a791f 100644 --- a/lib/msun/src/s_finitef.c +++ b/lib/msun/src/s_finitef.c @@ -13,7 +13,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* * finitef(x) returns 1 is x is finite, else 0; * no branching! diff --git a/lib/msun/src/s_floor.c b/lib/msun/src/s_floor.c index 1746cf27f016..7ca65b1ebfb7 100644 --- a/lib/msun/src/s_floor.c +++ b/lib/msun/src/s_floor.c @@ -1,4 +1,3 @@ -/* @(#)s_floor.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,7 +9,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* * floor(x) * Return x rounded toward -inf to integral value diff --git a/lib/msun/src/s_floorf.c b/lib/msun/src/s_floorf.c index 145a50321046..d49715781428 100644 --- a/lib/msun/src/s_floorf.c +++ b/lib/msun/src/s_floorf.c @@ -13,7 +13,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* * floorf(x) * Return x rounded toward -inf to integral value diff --git a/lib/msun/src/s_floorl.c b/lib/msun/src/s_floorl.c index ee9a391ffe41..3b54cabe7237 100644 --- a/lib/msun/src/s_floorl.c +++ b/lib/msun/src/s_floorl.c @@ -7,11 +7,8 @@ * software is freely granted, provided that this notice * is preserved. * ==================================================== - * - * From: @(#)s_floor.c 5.1 93/09/24 */ -#include <sys/cdefs.h> /* * floorl(x) * Return x rounded toward -inf to integral value diff --git a/lib/msun/src/s_fma.c b/lib/msun/src/s_fma.c index 0788bb2d47e8..23a84491dd2a 100644 --- a/lib/msun/src/s_fma.c +++ b/lib/msun/src/s_fma.c @@ -26,7 +26,6 @@ * SUCH DAMAGE. */ -#include <sys/cdefs.h> #include <fenv.h> #include <float.h> #include <math.h> @@ -223,17 +222,17 @@ fma(double x, double y, double z) case FE_TONEAREST: return (z); case FE_TOWARDZERO: - if (x > 0.0 ^ y < 0.0 ^ z < 0.0) + if ((x > 0.0) ^ (y < 0.0) ^ (z < 0.0)) return (z); else return (nextafter(z, 0)); case FE_DOWNWARD: - if (x > 0.0 ^ y < 0.0) + if ((x > 0.0) ^ (y < 0.0)) return (z); else return (nextafter(z, -INFINITY)); default: /* FE_UPWARD */ - if (x > 0.0 ^ y < 0.0) + if ((x > 0.0) ^ (y < 0.0)) return (nextafter(z, INFINITY)); else return (z); @@ -245,7 +244,7 @@ fma(double x, double y, double z) zs = copysign(DBL_MIN, zs); fesetround(FE_TONEAREST); - /* work around clang bug 8100 */ + /* work around clang issue #8472 */ volatile double vxs = xs; /* @@ -261,14 +260,14 @@ fma(double x, double y, double z) spread = ex + ey; - if (r.hi == 0.0) { + if (r.hi == 0.0 && xy.lo == 0) { /* * When the addends cancel to 0, ensure that the result has * the correct sign. */ fesetround(oround); volatile double vzs = zs; /* XXX gcc CSE bug workaround */ - return (xy.hi + vzs + ldexp(xy.lo, spread)); + return (xy.hi + vzs); } if (oround != FE_TONEAREST) { @@ -277,7 +276,7 @@ fma(double x, double y, double z) * rounding modes. */ fesetround(oround); - /* work around clang bug 8100 */ + /* work around clang issue #8472 */ volatile double vrlo = r.lo; adj = vrlo + xy.lo; return (ldexp(r.hi + adj, spread)); diff --git a/lib/msun/src/s_fmaf.c b/lib/msun/src/s_fmaf.c index c433f523fe08..5f3d5d1b1b99 100644 --- a/lib/msun/src/s_fmaf.c +++ b/lib/msun/src/s_fmaf.c @@ -26,7 +26,6 @@ * SUCH DAMAGE. */ -#include <sys/cdefs.h> #include <fenv.h> #include "math.h" diff --git a/lib/msun/src/s_fmal.c b/lib/msun/src/s_fmal.c index 0d5e2c0bc98f..2fca20610157 100644 --- a/lib/msun/src/s_fmal.c +++ b/lib/msun/src/s_fmal.c @@ -26,7 +26,6 @@ * SUCH DAMAGE. */ -#include <sys/cdefs.h> #include <fenv.h> #include <float.h> #include <math.h> @@ -204,17 +203,17 @@ fmal(long double x, long double y, long double z) case FE_TONEAREST: return (z); case FE_TOWARDZERO: - if (x > 0.0 ^ y < 0.0 ^ z < 0.0) + if ((x > 0.0) ^ (y < 0.0) ^ (z < 0.0)) return (z); else return (nextafterl(z, 0)); case FE_DOWNWARD: - if (x > 0.0 ^ y < 0.0) + if ((x > 0.0) ^ (y < 0.0)) return (z); else return (nextafterl(z, -INFINITY)); default: /* FE_UPWARD */ - if (x > 0.0 ^ y < 0.0) + if ((x > 0.0) ^ (y < 0.0)) return (nextafterl(z, INFINITY)); else return (z); @@ -226,7 +225,7 @@ fmal(long double x, long double y, long double z) zs = copysignl(LDBL_MIN, zs); fesetround(FE_TONEAREST); - /* work around clang bug 8100 */ + /* work around clang issue #8472 */ volatile long double vxs = xs; /* @@ -242,14 +241,14 @@ fmal(long double x, long double y, long double z) spread = ex + ey; - if (r.hi == 0.0) { + if (r.hi == 0.0 && xy.lo == 0) { /* * When the addends cancel to 0, ensure that the result has * the correct sign. */ fesetround(oround); volatile long double vzs = zs; /* XXX gcc CSE bug workaround */ - return (xy.hi + vzs + ldexpl(xy.lo, spread)); + return (xy.hi + vzs); } if (oround != FE_TONEAREST) { @@ -258,7 +257,7 @@ fmal(long double x, long double y, long double z) * rounding modes. */ fesetround(oround); - /* work around clang bug 8100 */ + /* work around clang issue #8472 */ volatile long double vrlo = r.lo; adj = vrlo + xy.lo; return (ldexpl(r.hi + adj, spread)); diff --git a/lib/msun/src/s_fmax.c b/lib/msun/src/s_fmax.c index aca4e0585cdd..5d437fcefc9b 100644 --- a/lib/msun/src/s_fmax.c +++ b/lib/msun/src/s_fmax.c @@ -26,7 +26,6 @@ * SUCH DAMAGE. */ -#include <sys/cdefs.h> #include <float.h> #include <math.h> diff --git a/lib/msun/src/s_fmaxf.c b/lib/msun/src/s_fmaxf.c index 8684fb6bb68c..1572572e43a6 100644 --- a/lib/msun/src/s_fmaxf.c +++ b/lib/msun/src/s_fmaxf.c @@ -26,7 +26,6 @@ * SUCH DAMAGE. */ -#include <sys/cdefs.h> #include <math.h> #include "fpmath.h" diff --git a/lib/msun/src/s_fmaxl.c b/lib/msun/src/s_fmaxl.c index d0c1a806bdaf..73e2a4bb19fd 100644 --- a/lib/msun/src/s_fmaxl.c +++ b/lib/msun/src/s_fmaxl.c @@ -26,7 +26,6 @@ * SUCH DAMAGE. */ -#include <sys/cdefs.h> #include <math.h> #include "fpmath.h" diff --git a/lib/msun/src/s_fmin.c b/lib/msun/src/s_fmin.c index aa67d161ec34..a349e5ddaf0e 100644 --- a/lib/msun/src/s_fmin.c +++ b/lib/msun/src/s_fmin.c @@ -26,7 +26,6 @@ * SUCH DAMAGE. */ -#include <sys/cdefs.h> #include <float.h> #include <math.h> diff --git a/lib/msun/src/s_fminf.c b/lib/msun/src/s_fminf.c index 01e52d9becdc..5c2537e32d25 100644 --- a/lib/msun/src/s_fminf.c +++ b/lib/msun/src/s_fminf.c @@ -26,7 +26,6 @@ * SUCH DAMAGE. */ -#include <sys/cdefs.h> #include <math.h> #include "fpmath.h" diff --git a/lib/msun/src/s_fminl.c b/lib/msun/src/s_fminl.c index f79a08d6c774..7ac17e313440 100644 --- a/lib/msun/src/s_fminl.c +++ b/lib/msun/src/s_fminl.c @@ -26,7 +26,6 @@ * SUCH DAMAGE. */ -#include <sys/cdefs.h> #include <math.h> #include "fpmath.h" diff --git a/lib/msun/src/s_frexp.c b/lib/msun/src/s_frexp.c index ee234d247300..90aea67e06e3 100644 --- a/lib/msun/src/s_frexp.c +++ b/lib/msun/src/s_frexp.c @@ -1,4 +1,3 @@ -/* @(#)s_frexp.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,7 +9,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* * for non-zero x * x = frexp(arg,&exp); diff --git a/lib/msun/src/s_frexpf.c b/lib/msun/src/s_frexpf.c index 6b39e6ff8b2b..bca27b5147d8 100644 --- a/lib/msun/src/s_frexpf.c +++ b/lib/msun/src/s_frexpf.c @@ -13,7 +13,6 @@ * ==================================================== */ -#include <sys/cdefs.h> #include "math.h" #include "math_private.h" diff --git a/lib/msun/src/s_ilogb.c b/lib/msun/src/s_ilogb.c index 0b076edbd9b5..aa707d51d7b7 100644 --- a/lib/msun/src/s_ilogb.c +++ b/lib/msun/src/s_ilogb.c @@ -1,4 +1,3 @@ -/* @(#)s_ilogb.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,7 +9,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* ilogb(double x) * return the binary exponent of non-zero x * ilogb(0) = FP_ILOGB0 @@ -23,21 +21,18 @@ #include "math.h" #include "math_private.h" - int ilogb(double x) +int +ilogb(double x) { - int32_t hx,lx,ix; + int32_t hx, ix, lx; EXTRACT_WORDS(hx,lx,x); hx &= 0x7fffffff; if(hx<0x00100000) { if((hx|lx)==0) return FP_ILOGB0; - else /* subnormal x */ - if(hx==0) { - for (ix = -1043; lx>0; lx<<=1) ix -=1; - } else { - for (ix = -1022,hx<<=11; hx>0; hx<<=1) ix -=1; - } + else + ix = subnormal_ilogb(hx, lx); return ix; } else if (hx<0x7ff00000) return (hx>>20)-1023; diff --git a/lib/msun/src/s_ilogbf.c b/lib/msun/src/s_ilogbf.c index ff3df1fc5b90..5195e2331af3 100644 --- a/lib/msun/src/s_ilogbf.c +++ b/lib/msun/src/s_ilogbf.c @@ -13,13 +13,13 @@ * ==================================================== */ -#include <sys/cdefs.h> #include <limits.h> #include "math.h" #include "math_private.h" - int ilogbf(float x) +int +ilogbf(float x) { int32_t hx,ix; @@ -29,7 +29,7 @@ if(hx==0) return FP_ILOGB0; else /* subnormal x */ - for (ix = -126,hx<<=8; hx>0; hx<<=1) ix -=1; + ix = subnormal_ilogbf(hx); return ix; } else if (hx<0x7f800000) return (hx>>23)-127; diff --git a/lib/msun/src/s_ilogbl.c b/lib/msun/src/s_ilogbl.c index f45cd7b67159..4d8fb8fa3cde 100644 --- a/lib/msun/src/s_ilogbl.c +++ b/lib/msun/src/s_ilogbl.c @@ -1,5 +1,4 @@ /* - * From: @(#)s_ilogb.c 5.1 93/09/24 * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. * @@ -10,7 +9,6 @@ * ==================================================== */ -#include <sys/cdefs.h> #include <float.h> #include <limits.h> #include <math.h> diff --git a/lib/msun/src/s_llrint.c b/lib/msun/src/s_llrint.c index 460c4a07d5e3..5e2760381b8c 100644 --- a/lib/msun/src/s_llrint.c +++ b/lib/msun/src/s_llrint.c @@ -1,4 +1,3 @@ -#include <sys/cdefs.h> #define type double #define roundit rint #define dtype long long diff --git a/lib/msun/src/s_llrintf.c b/lib/msun/src/s_llrintf.c index 3ed16799f47f..b117f7c99dbc 100644 --- a/lib/msun/src/s_llrintf.c +++ b/lib/msun/src/s_llrintf.c @@ -1,4 +1,3 @@ -#include <sys/cdefs.h> #define type float #define roundit rintf #define dtype long long diff --git a/lib/msun/src/s_llrintl.c b/lib/msun/src/s_llrintl.c index fed23f32fd6f..82f4529dc815 100644 --- a/lib/msun/src/s_llrintl.c +++ b/lib/msun/src/s_llrintl.c @@ -1,4 +1,3 @@ -#include <sys/cdefs.h> #define type long double #define roundit rintl #define dtype long long diff --git a/lib/msun/src/s_llround.c b/lib/msun/src/s_llround.c index f8e76134b654..3983ce1edfca 100644 --- a/lib/msun/src/s_llround.c +++ b/lib/msun/src/s_llround.c @@ -1,4 +1,3 @@ -#include <sys/cdefs.h> #define type double #define roundit round #define dtype long long diff --git a/lib/msun/src/s_llroundf.c b/lib/msun/src/s_llroundf.c index 753fd96265aa..827d915ded9b 100644 --- a/lib/msun/src/s_llroundf.c +++ b/lib/msun/src/s_llroundf.c @@ -1,4 +1,3 @@ -#include <sys/cdefs.h> #define type float #define roundit roundf #define dtype long long diff --git a/lib/msun/src/s_llroundl.c b/lib/msun/src/s_llroundl.c index b5a97d97f2ae..40cad84c56f5 100644 --- a/lib/msun/src/s_llroundl.c +++ b/lib/msun/src/s_llroundl.c @@ -1,4 +1,3 @@ -#include <sys/cdefs.h> #define type long double #define roundit roundl #define dtype long long diff --git a/lib/msun/src/s_log1p.c b/lib/msun/src/s_log1p.c index 61b03f00f33b..7131beac1f3a 100644 --- a/lib/msun/src/s_log1p.c +++ b/lib/msun/src/s_log1p.c @@ -1,4 +1,3 @@ -/* @(#)s_log1p.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,7 +9,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* double log1p(double x) * * Method : diff --git a/lib/msun/src/s_log1pf.c b/lib/msun/src/s_log1pf.c index d53fc7144e1d..dad567b58573 100644 --- a/lib/msun/src/s_log1pf.c +++ b/lib/msun/src/s_log1pf.c @@ -13,7 +13,6 @@ * ==================================================== */ -#include <sys/cdefs.h> #include <float.h> #include "math.h" diff --git a/lib/msun/src/s_logb.c b/lib/msun/src/s_logb.c index b5ffff4fd11a..ec777fd26277 100644 --- a/lib/msun/src/s_logb.c +++ b/lib/msun/src/s_logb.c @@ -1,4 +1,3 @@ -/* @(#)s_logb.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,7 +9,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* * double logb(x) * IEEE 754 logb. Included to pass IEEE test suite. Not recommend. diff --git a/lib/msun/src/s_logbf.c b/lib/msun/src/s_logbf.c index 658c7d3a15c3..0416a9c4d101 100644 --- a/lib/msun/src/s_logbf.c +++ b/lib/msun/src/s_logbf.c @@ -13,7 +13,6 @@ * ==================================================== */ -#include <sys/cdefs.h> #include "math.h" #include "math_private.h" diff --git a/lib/msun/src/s_logbl.c b/lib/msun/src/s_logbl.c index 280c302ac014..1641dfb1a951 100644 --- a/lib/msun/src/s_logbl.c +++ b/lib/msun/src/s_logbl.c @@ -1,5 +1,4 @@ /* - * From: @(#)s_ilogb.c 5.1 93/09/24 * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. * @@ -10,7 +9,6 @@ * ==================================================== */ -#include <sys/cdefs.h> #include <float.h> #include <limits.h> #include <math.h> diff --git a/lib/msun/src/s_lrint.c b/lib/msun/src/s_lrint.c index f4e56ac34b69..b1e96546db52 100644 --- a/lib/msun/src/s_lrint.c +++ b/lib/msun/src/s_lrint.c @@ -26,7 +26,6 @@ * SUCH DAMAGE. */ -#include <sys/cdefs.h> #include <fenv.h> #include <math.h> diff --git a/lib/msun/src/s_lrintf.c b/lib/msun/src/s_lrintf.c index ca7cb99a3cf2..1c040e8d882b 100644 --- a/lib/msun/src/s_lrintf.c +++ b/lib/msun/src/s_lrintf.c @@ -1,4 +1,3 @@ -#include <sys/cdefs.h> #define type float #define roundit rintf #define dtype long diff --git a/lib/msun/src/s_lrintl.c b/lib/msun/src/s_lrintl.c index 7eedbc707c6e..91614e8ad264 100644 --- a/lib/msun/src/s_lrintl.c +++ b/lib/msun/src/s_lrintl.c @@ -1,4 +1,3 @@ -#include <sys/cdefs.h> #define type long double #define roundit rintl #define dtype long diff --git a/lib/msun/src/s_lround.c b/lib/msun/src/s_lround.c index 0b305918adc3..ae2f5ce7136a 100644 --- a/lib/msun/src/s_lround.c +++ b/lib/msun/src/s_lround.c @@ -26,7 +26,6 @@ * SUCH DAMAGE. */ -#include <sys/cdefs.h> #include <sys/limits.h> #include <fenv.h> #include <math.h> diff --git a/lib/msun/src/s_lroundf.c b/lib/msun/src/s_lroundf.c index e27e6a2fe187..86e63cc1d05c 100644 --- a/lib/msun/src/s_lroundf.c +++ b/lib/msun/src/s_lroundf.c @@ -1,4 +1,3 @@ -#include <sys/cdefs.h> #define type float #define roundit roundf #define dtype long diff --git a/lib/msun/src/s_lroundl.c b/lib/msun/src/s_lroundl.c index cfd43bc7fbf1..57a2e90fc48e 100644 --- a/lib/msun/src/s_lroundl.c +++ b/lib/msun/src/s_lroundl.c @@ -1,4 +1,3 @@ -#include <sys/cdefs.h> #define type long double #define roundit roundl #define dtype long diff --git a/lib/msun/src/s_modf.c b/lib/msun/src/s_modf.c index ab13191b9004..6ee2d5a0c112 100644 --- a/lib/msun/src/s_modf.c +++ b/lib/msun/src/s_modf.c @@ -1,4 +1,3 @@ -/* @(#)s_modf.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,10 +9,6 @@ * ==================================================== */ -#ifndef lint -static char rcsid[] = "$FreeBSD$"; -#endif - /* * modf(double x, double *iptr) * return fraction part of x, and return x's integral part in *iptr. diff --git a/lib/msun/src/s_modff.c b/lib/msun/src/s_modff.c index 57f59117a878..39f6c1c9f917 100644 --- a/lib/msun/src/s_modff.c +++ b/lib/msun/src/s_modff.c @@ -13,7 +13,6 @@ * ==================================================== */ -#include <sys/cdefs.h> #include "math.h" #include "math_private.h" diff --git a/lib/msun/src/s_nearbyint.c b/lib/msun/src/s_nearbyint.c index 96604594c499..3dcaf98b369a 100644 --- a/lib/msun/src/s_nearbyint.c +++ b/lib/msun/src/s_nearbyint.c @@ -26,7 +26,6 @@ * SUCH DAMAGE. */ -#include <sys/cdefs.h> #include <fenv.h> #include <math.h> diff --git a/lib/msun/src/s_nextafter.c b/lib/msun/src/s_nextafter.c index 99c65b11aeba..1b394e5109c2 100644 --- a/lib/msun/src/s_nextafter.c +++ b/lib/msun/src/s_nextafter.c @@ -1,4 +1,3 @@ -/* @(#)s_nextafter.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,7 +9,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* IEEE functions * nextafter(x,y) * return the next machine floating-point number of x in the diff --git a/lib/msun/src/s_nextafterf.c b/lib/msun/src/s_nextafterf.c index 18e046324957..418b126a27ab 100644 --- a/lib/msun/src/s_nextafterf.c +++ b/lib/msun/src/s_nextafterf.c @@ -13,7 +13,6 @@ * ==================================================== */ -#include <sys/cdefs.h> #include "math.h" #include "math_private.h" diff --git a/lib/msun/src/s_nextafterl.c b/lib/msun/src/s_nextafterl.c index 168dbb4ed093..fe5a010e89f5 100644 --- a/lib/msun/src/s_nextafterl.c +++ b/lib/msun/src/s_nextafterl.c @@ -1,4 +1,3 @@ -/* @(#)s_nextafter.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,7 +9,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* IEEE functions * nextafter(x,y) * return the next machine floating-point number of x in the diff --git a/lib/msun/src/s_nexttoward.c b/lib/msun/src/s_nexttoward.c index d876ba2bfebc..5482dc21606d 100644 --- a/lib/msun/src/s_nexttoward.c +++ b/lib/msun/src/s_nexttoward.c @@ -1,4 +1,3 @@ -/* @(#)s_nextafter.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,7 +9,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* * We assume that a long double has a 15-bit exponent. On systems * where long double is the same as double, nexttoward() is an alias diff --git a/lib/msun/src/s_nexttowardf.c b/lib/msun/src/s_nexttowardf.c index 03d8cc5e4729..05c89f4554ec 100644 --- a/lib/msun/src/s_nexttowardf.c +++ b/lib/msun/src/s_nexttowardf.c @@ -9,7 +9,6 @@ * ==================================================== */ -#include <sys/cdefs.h> #include <float.h> #include "fpmath.h" diff --git a/lib/msun/src/s_remquo.c b/lib/msun/src/s_remquo.c index e3aac25230e0..b26b5619f3ad 100644 --- a/lib/msun/src/s_remquo.c +++ b/lib/msun/src/s_remquo.c @@ -1,16 +1,14 @@ -/* @(#)e_fmod.c 1.3 95/01/18 */ /*- * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. * * Developed at SunSoft, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ -#include <sys/cdefs.h> #include <float.h> #include "math.h" @@ -29,7 +27,7 @@ static const double Zero[] = {0.0, -0.0,}; double remquo(double x, double y, int *quo) { - int32_t n,hx,hy,hz,ix,iy,sx,i; + int32_t hx,hy,hz,ix,iy,n,sx; u_int32_t lx,ly,lz,q,sxy; EXTRACT_WORDS(hx,lx,x); @@ -55,25 +53,19 @@ remquo(double x, double y, int *quo) } /* determine ix = ilogb(x) */ - if(hx<0x00100000) { /* subnormal x */ - if(hx==0) { - for (ix = -1043, i=lx; i>0; i<<=1) ix -=1; - } else { - for (ix = -1022,i=(hx<<11); i>0; i<<=1) ix -=1; - } - } else ix = (hx>>20)-1023; + if(hx<0x00100000) + ix = subnormal_ilogb(hx, lx); + else + ix = (hx>>20)-1023; /* determine iy = ilogb(y) */ - if(hy<0x00100000) { /* subnormal y */ - if(hy==0) { - for (iy = -1043, i=ly; i>0; i<<=1) iy -=1; - } else { - for (iy = -1022,i=(hy<<11); i>0; i<<=1) iy -=1; - } - } else iy = (hy>>20)-1023; + if(hy<0x00100000) + iy = subnormal_ilogb(hy, ly); + else + iy = (hy>>20)-1023; /* set up {hx,lx}, {hy,ly} and align y to x */ - if(ix >= -1022) + if(ix >= -1022) hx = 0x00100000|(0x000fffff&hx); else { /* subnormal x, shift x to normal */ n = -1022-ix; @@ -85,7 +77,7 @@ remquo(double x, double y, int *quo) lx = 0; } } - if(iy >= -1022) + if(iy >= -1022) hy = 0x00100000|(0x000fffff&hy); else { /* subnormal y, shift y to normal */ n = -1022-iy; diff --git a/lib/msun/src/s_remquof.c b/lib/msun/src/s_remquof.c index c42bd8c4320d..e4adb8321559 100644 --- a/lib/msun/src/s_remquof.c +++ b/lib/msun/src/s_remquof.c @@ -1,4 +1,3 @@ -/* @(#)e_fmod.c 1.3 95/01/18 */ /*- * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,7 +9,6 @@ * ==================================================== */ -#include <sys/cdefs.h> #include "math.h" #include "math_private.h" @@ -27,7 +25,7 @@ static const float Zero[] = {0.0, -0.0,}; float remquof(float x, float y, int *quo) { - int32_t n,hx,hy,hz,ix,iy,sx,i; + int32_t hx, hy, hz, ix, iy, n, sx; u_int32_t q,sxy; GET_FLOAT_WORD(hx,x); @@ -49,14 +47,16 @@ remquof(float x, float y, int *quo) } /* determine ix = ilogb(x) */ - if(hx<0x00800000) { /* subnormal x */ - for (ix = -126,i=(hx<<8); i>0; i<<=1) ix -=1; - } else ix = (hx>>23)-127; + if(hx<0x00800000) + ix = subnormal_ilogbf(hx); + else + ix = (hx>>23)-127; /* determine iy = ilogb(y) */ - if(hy<0x00800000) { /* subnormal y */ - for (iy = -126,i=(hy<<8); i>0; i<<=1) iy -=1; - } else iy = (hy>>23)-127; + if(hy<0x00800000) + iy = subnormal_ilogbf(hy); + else + iy = (hy>>23)-127; /* set up {hx,lx}, {hy,ly} and align y to x */ if(ix >= -126) diff --git a/lib/msun/src/s_remquol.c b/lib/msun/src/s_remquol.c index a0f93d4fcae0..0dadceaf5aa7 100644 --- a/lib/msun/src/s_remquol.c +++ b/lib/msun/src/s_remquol.c @@ -1,4 +1,3 @@ -/* @(#)e_fmod.c 1.3 95/01/18 */ /*- * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,7 +9,6 @@ * ==================================================== */ -#include <sys/cdefs.h> #include <float.h> #include <stdint.h> diff --git a/lib/msun/src/s_rint.c b/lib/msun/src/s_rint.c index 96faf6a007ee..d82a9d0abb69 100644 --- a/lib/msun/src/s_rint.c +++ b/lib/msun/src/s_rint.c @@ -1,4 +1,3 @@ -/* @(#)s_rint.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,7 +9,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* * rint(x) * Return x rounded to integral value according to the prevailing diff --git a/lib/msun/src/s_rintf.c b/lib/msun/src/s_rintf.c index 328738f0ba0c..3f0cb906ae85 100644 --- a/lib/msun/src/s_rintf.c +++ b/lib/msun/src/s_rintf.c @@ -13,7 +13,6 @@ * ==================================================== */ -#include <sys/cdefs.h> #include <float.h> #include <stdint.h> diff --git a/lib/msun/src/s_rintl.c b/lib/msun/src/s_rintl.c index 15bce02e219d..72c9cabd1a91 100644 --- a/lib/msun/src/s_rintl.c +++ b/lib/msun/src/s_rintl.c @@ -26,7 +26,6 @@ * SUCH DAMAGE. */ -#include <sys/cdefs.h> #include <float.h> #include <math.h> diff --git a/lib/msun/src/s_round.c b/lib/msun/src/s_round.c index 04d49c220973..c1b55f58765e 100644 --- a/lib/msun/src/s_round.c +++ b/lib/msun/src/s_round.c @@ -26,7 +26,6 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include <sys/cdefs.h> #include <float.h> #include "math.h" diff --git a/lib/msun/src/s_roundf.c b/lib/msun/src/s_roundf.c index 795d88df3050..7c09e090ff9a 100644 --- a/lib/msun/src/s_roundf.c +++ b/lib/msun/src/s_roundf.c @@ -26,7 +26,6 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include <sys/cdefs.h> #include "math.h" #include "math_private.h" diff --git a/lib/msun/src/s_roundl.c b/lib/msun/src/s_roundl.c index 05cb3e9f4918..bc5dfe550165 100644 --- a/lib/msun/src/s_roundl.c +++ b/lib/msun/src/s_roundl.c @@ -26,7 +26,6 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include <sys/cdefs.h> #include <float.h> #ifdef __i386__ #include <ieeefp.h> diff --git a/lib/msun/src/s_scalbln.c b/lib/msun/src/s_scalbln.c index ff402b0f8fab..42e4669b3986 100644 --- a/lib/msun/src/s_scalbln.c +++ b/lib/msun/src/s_scalbln.c @@ -26,7 +26,6 @@ * SUCH DAMAGE. */ -#include <sys/cdefs.h> #include <math.h> #define NMAX 65536 diff --git a/lib/msun/src/s_significand.c b/lib/msun/src/s_significand.c index 29ff0cc29807..62571bb464dd 100644 --- a/lib/msun/src/s_significand.c +++ b/lib/msun/src/s_significand.c @@ -1,4 +1,3 @@ -/* @(#)s_signif.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,7 +9,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* * significand(x) computes just * scalb(x, (double) -ilogb(x)), diff --git a/lib/msun/src/s_significandf.c b/lib/msun/src/s_significandf.c index 9fd919d65a91..3cdaa4daa753 100644 --- a/lib/msun/src/s_significandf.c +++ b/lib/msun/src/s_significandf.c @@ -13,7 +13,6 @@ * ==================================================== */ -#include <sys/cdefs.h> #include "math.h" #include "math_private.h" diff --git a/lib/msun/src/s_sin.c b/lib/msun/src/s_sin.c index e9cd928d300b..614bcc2056f3 100644 --- a/lib/msun/src/s_sin.c +++ b/lib/msun/src/s_sin.c @@ -1,4 +1,3 @@ -/* @(#)s_sin.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,7 +9,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* sin(x) * Return sine function of x. * diff --git a/lib/msun/src/s_sincos.c b/lib/msun/src/s_sincos.c index 028ce416280a..4e819ea89128 100644 --- a/lib/msun/src/s_sincos.c +++ b/lib/msun/src/s_sincos.c @@ -12,7 +12,6 @@ * algorithms are contained in the original files. */ -#include <sys/cdefs.h> #include <float.h> #include "math.h" diff --git a/lib/msun/src/s_sincosf.c b/lib/msun/src/s_sincosf.c index ee9f03444944..eaf7be84ee35 100644 --- a/lib/msun/src/s_sincosf.c +++ b/lib/msun/src/s_sincosf.c @@ -15,7 +15,6 @@ * Merged s_sinf.c and s_cosf.c by Steven G. Kargl. */ -#include <sys/cdefs.h> #include <float.h> #include "math.h" diff --git a/lib/msun/src/s_sincosl.c b/lib/msun/src/s_sincosl.c index 2d3833c93d46..7fb69aa4d4dd 100644 --- a/lib/msun/src/s_sincosl.c +++ b/lib/msun/src/s_sincosl.c @@ -26,7 +26,6 @@ * s_sinl.c and s_cosl.c merged by Steven G. Kargl. */ -#include <sys/cdefs.h> #include <float.h> #ifdef __i386__ #include <ieeefp.h> diff --git a/lib/msun/src/s_sinf.c b/lib/msun/src/s_sinf.c index 9837e80bb6ff..85fb11540a7d 100644 --- a/lib/msun/src/s_sinf.c +++ b/lib/msun/src/s_sinf.c @@ -14,7 +14,6 @@ * ==================================================== */ -#include <sys/cdefs.h> #include <float.h> #include "math.h" diff --git a/lib/msun/src/s_sinl.c b/lib/msun/src/s_sinl.c index 605a4b4b6272..d0b7b34718f8 100644 --- a/lib/msun/src/s_sinl.c +++ b/lib/msun/src/s_sinl.c @@ -26,7 +26,6 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include <sys/cdefs.h> #include <float.h> #ifdef __i386__ #include <ieeefp.h> diff --git a/lib/msun/src/s_tan.c b/lib/msun/src/s_tan.c index be5154e89468..20b95163e4a7 100644 --- a/lib/msun/src/s_tan.c +++ b/lib/msun/src/s_tan.c @@ -1,4 +1,3 @@ -/* @(#)s_tan.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,7 +9,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* tan(x) * Return tangent function of x. * diff --git a/lib/msun/src/s_tanf.c b/lib/msun/src/s_tanf.c index 1b72cd6cae91..2462f96ba45f 100644 --- a/lib/msun/src/s_tanf.c +++ b/lib/msun/src/s_tanf.c @@ -14,7 +14,6 @@ * ==================================================== */ -#include <sys/cdefs.h> #include <float.h> #include "math.h" diff --git a/lib/msun/src/s_tanh.c b/lib/msun/src/s_tanh.c index 1dbd1d4630eb..cc8daeddda0b 100644 --- a/lib/msun/src/s_tanh.c +++ b/lib/msun/src/s_tanh.c @@ -1,4 +1,3 @@ -/* @(#)s_tanh.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,7 +9,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* Tanh(x) * Return the Hyperbolic Tangent of x * diff --git a/lib/msun/src/s_tanhf.c b/lib/msun/src/s_tanhf.c index 986404f52f5a..e56813adfdc2 100644 --- a/lib/msun/src/s_tanhf.c +++ b/lib/msun/src/s_tanhf.c @@ -13,7 +13,6 @@ * ==================================================== */ -#include <sys/cdefs.h> #include "math.h" #include "math_private.h" diff --git a/lib/msun/src/s_tanhl.c b/lib/msun/src/s_tanhl.c index 3ee5b50bd2c8..3285b9afd0bd 100644 --- a/lib/msun/src/s_tanhl.c +++ b/lib/msun/src/s_tanhl.c @@ -1,6 +1,5 @@ /* from: FreeBSD: head/lib/msun/src/s_tanhl.c XXX */ -/* @(#)s_tanh.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -12,7 +11,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* * See s_tanh.c for complete comments. * diff --git a/lib/msun/src/s_tanl.c b/lib/msun/src/s_tanl.c index 1e9d7263c289..3736477922dc 100644 --- a/lib/msun/src/s_tanl.c +++ b/lib/msun/src/s_tanl.c @@ -26,7 +26,6 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include <sys/cdefs.h> /* * Limited testing on pseudorandom numbers drawn within [0:4e8] shows * an accuracy of <= 1.5 ULP where 247024 values of x out of 40 million diff --git a/lib/msun/src/s_tgammaf.c b/lib/msun/src/s_tgammaf.c index 3bf937ce958d..9fa9df9ece72 100644 --- a/lib/msun/src/s_tgammaf.c +++ b/lib/msun/src/s_tgammaf.c @@ -26,7 +26,6 @@ * SUCH DAMAGE. */ -#include <sys/cdefs.h> #include <math.h> /* diff --git a/lib/msun/src/s_trunc.c b/lib/msun/src/s_trunc.c index 4bd1249544ea..3ec59f22ead3 100644 --- a/lib/msun/src/s_trunc.c +++ b/lib/msun/src/s_trunc.c @@ -1,4 +1,3 @@ -/* @(#)s_floor.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,7 +9,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* * trunc(x) * Return x rounded toward 0 to integral value diff --git a/lib/msun/src/s_truncf.c b/lib/msun/src/s_truncf.c index 8d15c78d69da..3f4db30b5646 100644 --- a/lib/msun/src/s_truncf.c +++ b/lib/msun/src/s_truncf.c @@ -1,4 +1,3 @@ -/* @(#)s_floor.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,7 +9,6 @@ * ==================================================== */ -#include <sys/cdefs.h> /* * truncf(x) * Return x rounded toward 0 to integral value diff --git a/lib/msun/src/s_truncl.c b/lib/msun/src/s_truncl.c index f54608ac7ab0..81e794d71b79 100644 --- a/lib/msun/src/s_truncl.c +++ b/lib/msun/src/s_truncl.c @@ -7,11 +7,8 @@ * software is freely granted, provided that this notice * is preserved. * ==================================================== - * - * From: @(#)s_floor.c 5.1 93/09/24 */ -#include <sys/cdefs.h> /* * truncl(x) * Return x rounded toward 0 to integral value diff --git a/lib/msun/src/w_cabs.c b/lib/msun/src/w_cabs.c index dfae649b9906..49864619b072 100644 --- a/lib/msun/src/w_cabs.c +++ b/lib/msun/src/w_cabs.c @@ -5,7 +5,6 @@ * Placed into the Public Domain, 1994. */ -#include <sys/cdefs.h> #include <complex.h> #include <float.h> #include <math.h> diff --git a/lib/msun/src/w_cabsf.c b/lib/msun/src/w_cabsf.c index b5065c8a5683..aedbdef217ca 100644 --- a/lib/msun/src/w_cabsf.c +++ b/lib/msun/src/w_cabsf.c @@ -5,11 +5,6 @@ * Placed into the Public Domain, 1994. */ -#ifndef lint -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - #include <complex.h> #include <math.h> #include "math_private.h" diff --git a/lib/msun/src/w_cabsl.c b/lib/msun/src/w_cabsl.c index 943413c31106..1539944faf6c 100644 --- a/lib/msun/src/w_cabsl.c +++ b/lib/msun/src/w_cabsl.c @@ -7,7 +7,6 @@ * Modified by Steven G. Kargl for the long double type. */ -#include <sys/cdefs.h> #include <complex.h> #include <math.h> diff --git a/lib/msun/tests/Makefile b/lib/msun/tests/Makefile index ccea2ad82fc3..d2a3ebffadb3 100644 --- a/lib/msun/tests/Makefile +++ b/lib/msun/tests/Makefile @@ -1,4 +1,3 @@ - .include <bsd.own.mk> TESTSRC= ${SRCTOP}/contrib/netbsd-tests/lib/libm diff --git a/lib/msun/tests/cexp_test.c b/lib/msun/tests/cexp_test.c index a23e448ee62a..35b23990a3f3 100644 --- a/lib/msun/tests/cexp_test.c +++ b/lib/msun/tests/cexp_test.c @@ -28,7 +28,6 @@ * Tests for corner cases in cexp*(). */ -#include <sys/cdefs.h> #include <sys/param.h> #include <complex.h> diff --git a/lib/msun/tests/csqrt_test.c b/lib/msun/tests/csqrt_test.c index 1154c0fc016a..b9ae2b3b6ae7 100644 --- a/lib/msun/tests/csqrt_test.c +++ b/lib/msun/tests/csqrt_test.c @@ -28,7 +28,6 @@ * Tests for csqrt{,f}() */ -#include <sys/cdefs.h> #include <sys/param.h> #include <complex.h> diff --git a/lib/msun/tests/ctrig_test.c b/lib/msun/tests/ctrig_test.c index dd03d11fdbd1..ac1b79f2a1ce 100644 --- a/lib/msun/tests/ctrig_test.c +++ b/lib/msun/tests/ctrig_test.c @@ -28,7 +28,6 @@ * Tests for csin[h](), ccos[h](), and ctan[h](). */ -#include <sys/cdefs.h> #include <sys/param.h> #include <complex.h> #include <fenv.h> diff --git a/lib/msun/tests/fenv_test.c b/lib/msun/tests/fenv_test.c index 9069921d8eaf..d85671827d37 100644 --- a/lib/msun/tests/fenv_test.c +++ b/lib/msun/tests/fenv_test.c @@ -28,7 +28,6 @@ * Test the correctness and C99-compliance of various fenv.h features. */ -#include <sys/cdefs.h> #include <sys/types.h> #include <sys/wait.h> #include <assert.h> diff --git a/lib/msun/tests/fma_test.c b/lib/msun/tests/fma_test.c index e6a34e0f2afa..f1aa855df6f2 100644 --- a/lib/msun/tests/fma_test.c +++ b/lib/msun/tests/fma_test.c @@ -28,7 +28,6 @@ * Tests for fma{,f,l}(). */ -#include <sys/cdefs.h> #include <sys/param.h> #include <fenv.h> #include <float.h> diff --git a/lib/msun/tests/invctrig_test.c b/lib/msun/tests/invctrig_test.c index 170fb1cad3a3..18d59e6f5416 100644 --- a/lib/msun/tests/invctrig_test.c +++ b/lib/msun/tests/invctrig_test.c @@ -28,7 +28,6 @@ * Tests for casin[h](), cacos[h](), and catan[h](). */ -#include <sys/cdefs.h> #include <sys/param.h> #include <complex.h> #include <fenv.h> diff --git a/lib/msun/tests/logarithm_test.c b/lib/msun/tests/logarithm_test.c index 9da4ad3ba407..de80b5b45615 100644 --- a/lib/msun/tests/logarithm_test.c +++ b/lib/msun/tests/logarithm_test.c @@ -28,7 +28,6 @@ * Tests for corner cases in log*(). */ -#include <sys/cdefs.h> #include <sys/param.h> #include <fenv.h> #include <float.h> diff --git a/lib/msun/tests/nan_test.c b/lib/msun/tests/nan_test.c index 75c28d45fb78..32c5c39af0c1 100644 --- a/lib/msun/tests/nan_test.c +++ b/lib/msun/tests/nan_test.c @@ -29,7 +29,6 @@ * and sscanf("nan(...)", ...) work identically. */ -#include <sys/cdefs.h> #include <sys/param.h> #include <fenv.h> #include <float.h> diff --git a/lib/msun/tests/nearbyint_test.c b/lib/msun/tests/nearbyint_test.c index 9dcdbdf6b852..749c2bb23c99 100644 --- a/lib/msun/tests/nearbyint_test.c +++ b/lib/msun/tests/nearbyint_test.c @@ -32,7 +32,6 @@ * - tests for harder values (more mantissa bits than float) */ -#include <sys/cdefs.h> #include <sys/param.h> #include <fenv.h> #include <math.h> diff --git a/lib/msun/tests/rem_test.c b/lib/msun/tests/rem_test.c index 9e5b8c302948..c96dc5ecd074 100644 --- a/lib/msun/tests/rem_test.c +++ b/lib/msun/tests/rem_test.c @@ -30,7 +30,6 @@ * Missing tests: fmod, fmodf. */ -#include <sys/cdefs.h> #include <float.h> #include <math.h> #include <stdio.h> diff --git a/lib/msun/tests/trig_test.c b/lib/msun/tests/trig_test.c index d1d831e07c71..fe8c5298093a 100644 --- a/lib/msun/tests/trig_test.c +++ b/lib/msun/tests/trig_test.c @@ -33,7 +33,6 @@ * available at http://www.cs.berkeley.edu/~wkahan/testpi/ . */ -#include <sys/cdefs.h> #include <sys/param.h> #include <fenv.h> |