diff options
Diffstat (limited to 'sysdeps')
165 files changed, 1843 insertions, 2875 deletions
diff --git a/sysdeps/i386/fpu/e_acos.S b/sysdeps/i386/fpu/e_acos.S index b9d07b1..d3505ba 100644 --- a/sysdeps/i386/fpu/e_acos.S +++ b/sysdeps/i386/fpu/e_acos.S @@ -19,3 +19,4 @@ ENTRY(__ieee754_acos) fpatan /* atan (sqrt(1 - x^2) / x) */ ret END (__ieee754_acos) +strong_alias (__ieee754_acos, __acos_finite) diff --git a/sysdeps/i386/fpu/e_acosf.S b/sysdeps/i386/fpu/e_acosf.S index 50b13fd..6a843a5 100644 --- a/sysdeps/i386/fpu/e_acosf.S +++ b/sysdeps/i386/fpu/e_acosf.S @@ -20,3 +20,4 @@ ENTRY(__ieee754_acosf) fpatan ret END (__ieee754_acosf) +strong_alias (__ieee754_acosf, __acosf_finite) diff --git a/sysdeps/i386/fpu/e_acosh.S b/sysdeps/i386/fpu/e_acosh.S index 62a2324..fc65c29 100644 --- a/sysdeps/i386/fpu/e_acosh.S +++ b/sysdeps/i386/fpu/e_acosh.S @@ -1,5 +1,5 @@ /* ix87 specific implementation of arcsinh. - Copyright (C) 1996, 2005 Free Software Foundation, Inc. + Copyright (C) 1996, 2005, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. @@ -21,12 +21,12 @@ #include <machine/asm.h> #ifdef __ELF__ - .section .rodata + .section .rodata.cst8,"aM",@progbits,8 #else .text #endif - .align ALIGNARG(4) + .p2align 3 ASM_TYPE_DIRECTIVE(one,@object) one: .double 1.0 ASM_SIZE_DIRECTIVE(one) @@ -101,3 +101,4 @@ ENTRY(__ieee754_acosh) fdiv %st, %st(0) ret END(__ieee754_acosh) +strong_alias (__ieee754_acosh, __acosh_finite) diff --git a/sysdeps/i386/fpu/e_acoshf.S b/sysdeps/i386/fpu/e_acoshf.S index 1906c60..b55004b 100644 --- a/sysdeps/i386/fpu/e_acoshf.S +++ b/sysdeps/i386/fpu/e_acoshf.S @@ -1,5 +1,5 @@ /* ix87 specific implementation of arcsinh. - Copyright (C) 1996, 1997, 2005 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 2005, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. @@ -21,12 +21,12 @@ #include <machine/asm.h> #ifdef __ELF__ - .section .rodata + .section .rodata.cst8,"aM",@progbits,8 #else .text #endif - .align ALIGNARG(4) + .p2align 3 ASM_TYPE_DIRECTIVE(one,@object) one: .double 1.0 ASM_SIZE_DIRECTIVE(one) @@ -101,3 +101,4 @@ ENTRY(__ieee754_acoshf) fdiv %st, %st(0) ret END(__ieee754_acoshf) +strong_alias (__ieee754_acoshf, __acoshf_finite) diff --git a/sysdeps/i386/fpu/e_acoshl.S b/sysdeps/i386/fpu/e_acoshl.S index c7b548d..76bc0d7 100644 --- a/sysdeps/i386/fpu/e_acoshl.S +++ b/sysdeps/i386/fpu/e_acoshl.S @@ -1,5 +1,5 @@ /* ix87 specific implementation of arcsinh. - Copyright (C) 1996, 1997, 2005 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 2005, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. @@ -21,12 +21,12 @@ #include <machine/asm.h> #ifdef __ELF__ - .section .rodata + .section .rodata.cst8,"aM",@progbits,8 #else .text #endif - .align ALIGNARG(4) + .p2align 3 /* Please note that we use double value for 1.0. This number has an exact representation and so we don't get accuracy problems. The advantage is that the code is simpler. */ @@ -108,3 +108,4 @@ ENTRY(__ieee754_acoshl) fdiv %st, %st(0) ret END(__ieee754_acoshl) +strong_alias (__ieee754_acoshl, __acoshl_finite) diff --git a/sysdeps/i386/fpu/e_acosl.c b/sysdeps/i386/fpu/e_acosl.c index 0c3e039..ec516ff 100644 --- a/sysdeps/i386/fpu/e_acosl.c +++ b/sysdeps/i386/fpu/e_acosl.c @@ -23,3 +23,4 @@ __ieee754_acosl (long double x) : "=t" (res) : "0" (x) : "st(1)"); return res; } +strong_alias (__ieee754_acosl, __acosl_finite) diff --git a/sysdeps/i386/fpu/e_asin.S b/sysdeps/i386/fpu/e_asin.S index 945e308..a17e922 100644 --- a/sysdeps/i386/fpu/e_asin.S +++ b/sysdeps/i386/fpu/e_asin.S @@ -18,3 +18,4 @@ ENTRY(__ieee754_asin) fpatan ret END (__ieee754_asin) +strong_alias (__ieee754_asin, __asin_finite) diff --git a/sysdeps/i386/fpu/e_asinf.S b/sysdeps/i386/fpu/e_asinf.S index d450e9a..5c1065d 100644 --- a/sysdeps/i386/fpu/e_asinf.S +++ b/sysdeps/i386/fpu/e_asinf.S @@ -19,3 +19,4 @@ ENTRY(__ieee754_asinf) fpatan ret END (__ieee754_asinf) +strong_alias (__ieee754_asinf, __asinf_finite) diff --git a/sysdeps/i386/fpu/e_atan2.S b/sysdeps/i386/fpu/e_atan2.S index 8df04e4..e76f8e2 100644 --- a/sysdeps/i386/fpu/e_atan2.S +++ b/sysdeps/i386/fpu/e_atan2.S @@ -13,3 +13,4 @@ ENTRY(__ieee754_atan2) fpatan ret END (__ieee754_atan2) +strong_alias (__ieee754_atan2, __atan2_finite) diff --git a/sysdeps/i386/fpu/e_atan2f.S b/sysdeps/i386/fpu/e_atan2f.S index fc6621f..9ffa637 100644 --- a/sysdeps/i386/fpu/e_atan2f.S +++ b/sysdeps/i386/fpu/e_atan2f.S @@ -13,3 +13,4 @@ ENTRY(__ieee754_atan2f) fpatan ret END (__ieee754_atan2f) +strong_alias (__ieee754_atan2f, __atan2f_finite) diff --git a/sysdeps/i386/fpu/e_atan2l.c b/sysdeps/i386/fpu/e_atan2l.c index 19a2a60..9f88bfc 100644 --- a/sysdeps/i386/fpu/e_atan2l.c +++ b/sysdeps/i386/fpu/e_atan2l.c @@ -16,3 +16,4 @@ __ieee754_atan2l (long double y, long double x) return res; } +strong_alias (__ieee754_atan2l, __atan2l_finite) diff --git a/sysdeps/i386/fpu/e_atanh.S b/sysdeps/i386/fpu/e_atanh.S index 3566ec6..d7e53a2 100644 --- a/sysdeps/i386/fpu/e_atanh.S +++ b/sysdeps/i386/fpu/e_atanh.S @@ -1,5 +1,5 @@ /* ix87 specific implementation of arctanh function. - Copyright (C) 1996, 1999, 2005 Free Software Foundation, Inc. + Copyright (C) 1996, 1999, 2005, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. @@ -114,3 +114,4 @@ ENTRY(__ieee754_atanh) 6: fldl 4(%esp) ret END(__ieee754_atanh) +strong_alias (__ieee754_atanh, __atanh_finite) diff --git a/sysdeps/i386/fpu/e_atanhf.S b/sysdeps/i386/fpu/e_atanhf.S index 10ce6ae..00ad914 100644 --- a/sysdeps/i386/fpu/e_atanhf.S +++ b/sysdeps/i386/fpu/e_atanhf.S @@ -1,5 +1,5 @@ /* ix87 specific implementation of arctanh function. - Copyright (C) 1996, 1999, 2005 Free Software Foundation, Inc. + Copyright (C) 1996, 1999, 2005, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. @@ -107,3 +107,4 @@ ENTRY(__ieee754_atanhf) 5: flds 4(%esp) ret END(__ieee754_atanhf) +strong_alias (__ieee754_atanhf, __atanhf_finite) diff --git a/sysdeps/i386/fpu/e_atanhl.S b/sysdeps/i386/fpu/e_atanhl.S index 8618c3f..cc70e73 100644 --- a/sysdeps/i386/fpu/e_atanhl.S +++ b/sysdeps/i386/fpu/e_atanhl.S @@ -1,5 +1,5 @@ /* ix87 specific implementation of arctanh function. - Copyright (C) 1996, 1999 Free Software Foundation, Inc. + Copyright (C) 1996, 1999, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. @@ -118,3 +118,4 @@ ENTRY(__ieee754_atanhl) 6: fldt 4(%esp) ret END(__ieee754_atanhl) +strong_alias (__ieee754_atanhl, __atanhl_finite) diff --git a/sysdeps/i386/fpu/e_exp10.S b/sysdeps/i386/fpu/e_exp10.S index 6bfcdbb..1e32b07 100644 --- a/sysdeps/i386/fpu/e_exp10.S +++ b/sysdeps/i386/fpu/e_exp10.S @@ -36,3 +36,4 @@ ENTRY(__ieee754_exp10) fldz /* Set result to 0. */ 2: ret END (__ieee754_exp10) +strong_alias (__ieee754_exp10, __exp10_finite) diff --git a/sysdeps/i386/fpu/e_exp10f.S b/sysdeps/i386/fpu/e_exp10f.S index 4791b99..6144964 100644 --- a/sysdeps/i386/fpu/e_exp10f.S +++ b/sysdeps/i386/fpu/e_exp10f.S @@ -4,7 +4,7 @@ #include <machine/asm.h> -/* e^x = 2^(x * log2(10)) */ +/* 10^x = 2^(x * log2(10)) */ ENTRY(__ieee754_exp10f) flds 4(%esp) /* I added the following ugly construct because exp(+-Inf) resulted @@ -36,3 +36,4 @@ ENTRY(__ieee754_exp10f) fldz /* Set result to 0. */ 2: ret END (__ieee754_exp10f) +strong_alias (__ieee754_exp10f, __exp10f_finite) diff --git a/sysdeps/i386/fpu/e_exp10l.S b/sysdeps/i386/fpu/e_exp10l.S index 71f0da7..04ec800 100644 --- a/sysdeps/i386/fpu/e_exp10l.S +++ b/sysdeps/i386/fpu/e_exp10l.S @@ -4,7 +4,7 @@ #include <machine/asm.h> -/* e^x = 2^(x * log2l(10)) */ +/* 10^x = 2^(x * log2l(10)) */ ENTRY(__ieee754_exp10l) fldt 4(%esp) /* I added the following ugly construct because expl(+-Inf) resulted @@ -36,3 +36,4 @@ ENTRY(__ieee754_exp10l) fldz /* Set result to 0. */ 2: ret END (__ieee754_exp10l) +strong_alias (__ieee754_exp10l, __exp10l_finite) diff --git a/sysdeps/i386/fpu/e_exp2.S b/sysdeps/i386/fpu/e_exp2.S index 778c0c0..f802cf8 100644 --- a/sysdeps/i386/fpu/e_exp2.S +++ b/sysdeps/i386/fpu/e_exp2.S @@ -35,3 +35,4 @@ ENTRY(__ieee754_exp2) fldz /* Set result to 0. */ 2: ret END (__ieee754_exp2) +strong_alias (__ieee754_exp2, __exp2_finite) diff --git a/sysdeps/i386/fpu/e_exp2f.S b/sysdeps/i386/fpu/e_exp2f.S index c2d1af1..f867d0d 100644 --- a/sysdeps/i386/fpu/e_exp2f.S +++ b/sysdeps/i386/fpu/e_exp2f.S @@ -35,3 +35,4 @@ ENTRY(__ieee754_exp2f) fldz /* Set result to 0. */ 2: ret END (__ieee754_exp2f) +strong_alias (__ieee754_exp2f, __exp2f_finite) diff --git a/sysdeps/i386/fpu/e_exp2l.S b/sysdeps/i386/fpu/e_exp2l.S index fa1fdc9..203dd00 100644 --- a/sysdeps/i386/fpu/e_exp2l.S +++ b/sysdeps/i386/fpu/e_exp2l.S @@ -35,3 +35,4 @@ ENTRY(__ieee754_exp2l) fldz /* Set result to 0. */ 2: ret END (__ieee754_exp2l) +strong_alias (__ieee754_exp2l, __exp2l_finite) diff --git a/sysdeps/i386/fpu/e_fmod.S b/sysdeps/i386/fpu/e_fmod.S index 4cf6e92..26b3acc 100644 --- a/sysdeps/i386/fpu/e_fmod.S +++ b/sysdeps/i386/fpu/e_fmod.S @@ -5,8 +5,6 @@ #include <machine/asm.h> -RCSID("$NetBSD: e_fmod.S,v 1.4 1995/05/08 23:47:56 jtc Exp $") - ENTRY(__ieee754_fmod) fldl 12(%esp) fldl 4(%esp) @@ -17,3 +15,4 @@ ENTRY(__ieee754_fmod) fstp %st(1) ret END (__ieee754_fmod) +strong_alias (__ieee754_fmod, __fmod_finite) diff --git a/sysdeps/i386/fpu/e_fmodf.S b/sysdeps/i386/fpu/e_fmodf.S index bbce409..ece4d98 100644 --- a/sysdeps/i386/fpu/e_fmodf.S +++ b/sysdeps/i386/fpu/e_fmodf.S @@ -6,8 +6,6 @@ #include <machine/asm.h> -RCSID("$NetBSD: $") - ENTRY(__ieee754_fmodf) flds 8(%esp) flds 4(%esp) @@ -18,3 +16,4 @@ ENTRY(__ieee754_fmodf) fstp %st(1) ret END(__ieee754_fmodf) +strong_alias (__ieee754_fmodf, __fmodf_finite) diff --git a/sysdeps/i386/fpu/e_fmodl.c b/sysdeps/i386/fpu/e_fmodl.c index c7c9a60..49700ae 100644 --- a/sysdeps/i386/fpu/e_fmodl.c +++ b/sysdeps/i386/fpu/e_fmodl.c @@ -20,3 +20,4 @@ __ieee754_fmodl (long double x, long double y) : "=t" (res) : "0" (x), "u" (y) : "ax", "st(1)"); return res; } +strong_alias (__ieee754_fmodl, __fmodl_finite) diff --git a/sysdeps/i386/fpu/e_hypot.S b/sysdeps/i386/fpu/e_hypot.S index 0435857..0baa011 100644 --- a/sysdeps/i386/fpu/e_hypot.S +++ b/sysdeps/i386/fpu/e_hypot.S @@ -1,5 +1,5 @@ /* Compute the hypothenuse of X and Y. - Copyright (C) 1998 Free Software Foundation, Inc. + Copyright (C) 1998, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. @@ -58,5 +58,6 @@ ENTRY(__ieee754_hypot) fxch 5: fstp %st(1) jmp 2b - + END(__ieee754_hypot) +strong_alias (__ieee754_hypot, __hypot_finite) diff --git a/sysdeps/i386/fpu/e_hypotf.S b/sysdeps/i386/fpu/e_hypotf.S index 5967dae..eb95d6e 100644 --- a/sysdeps/i386/fpu/e_hypotf.S +++ b/sysdeps/i386/fpu/e_hypotf.S @@ -1,5 +1,5 @@ /* Compute the hypothenuse of X and Y. - Copyright (C) 1998 Free Software Foundation, Inc. + Copyright (C) 1998, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. @@ -58,5 +58,6 @@ ENTRY(__ieee754_hypotf) fxch 5: fstp %st(1) jmp 2b - + END(__ieee754_hypotf) +strong_alias (__ieee754_hypotf, __hypotf_finite) diff --git a/sysdeps/i386/fpu/e_log.S b/sysdeps/i386/fpu/e_log.S index ce55b72..8110a84 100644 --- a/sysdeps/i386/fpu/e_log.S +++ b/sysdeps/i386/fpu/e_log.S @@ -7,14 +7,12 @@ #include <machine/asm.h> -RCSID("$NetBSD: e_log.S,v 1.4 1995/05/08 23:48:39 jtc Exp $") - #ifdef __ELF__ - .section .rodata + .section .rodata.cst8,"aM",@progbits,8 #else .text #endif - .align ALIGNARG(4) + .p2align 3 ASM_TYPE_DIRECTIVE(one,@object) one: .double 1.0 ASM_SIZE_DIRECTIVE(one) @@ -27,9 +25,9 @@ limit: .double 0.29 #ifdef PIC -#define MO(op) op##@GOTOFF(%edx) +# define MO(op) op##@GOTOFF(%edx) #else -#define MO(op) op +# define MO(op) op #endif .text @@ -64,3 +62,4 @@ ENTRY(__ieee754_log) fstp %st(1) ret END (__ieee754_log) +strong_alias (__ieee754_log, __log_finite) diff --git a/sysdeps/i386/fpu/e_log10.S b/sysdeps/i386/fpu/e_log10.S index 525f08c..9d24d74 100644 --- a/sysdeps/i386/fpu/e_log10.S +++ b/sysdeps/i386/fpu/e_log10.S @@ -7,14 +7,12 @@ #include <machine/asm.h> -RCSID("$NetBSD: e_log10.S,v 1.4 1995/05/08 23:49:24 jtc Exp $") - #ifdef __ELF__ - .section .rodata + .section .rodata.cst8,"aM",@progbits,8 #else .text #endif - .align ALIGNARG(4) + .p2align 3 ASM_TYPE_DIRECTIVE(one,@object) one: .double 1.0 ASM_SIZE_DIRECTIVE(one) @@ -27,9 +25,9 @@ limit: .double 0.29 #ifdef PIC -#define MO(op) op##@GOTOFF(%edx) +# define MO(op) op##@GOTOFF(%edx) #else -#define MO(op) op +# define MO(op) op #endif .text @@ -64,3 +62,4 @@ ENTRY(__ieee754_log10) fstp %st(1) ret END (__ieee754_log10) +strong_alias (__ieee754_log10, __log10_finite) diff --git a/sysdeps/i386/fpu/e_log10f.S b/sysdeps/i386/fpu/e_log10f.S index da5069d..38a4833 100644 --- a/sysdeps/i386/fpu/e_log10f.S +++ b/sysdeps/i386/fpu/e_log10f.S @@ -8,14 +8,12 @@ #include <machine/asm.h> -RCSID("$NetBSD: $") - #ifdef __ELF__ - .section .rodata + .section .rodata.cst8,"aM",@progbits,8 #else .text #endif - .align ALIGNARG(4) + .p2align 3 ASM_TYPE_DIRECTIVE(one,@object) one: .double 1.0 ASM_SIZE_DIRECTIVE(one) @@ -28,9 +26,9 @@ limit: .double 0.29 #ifdef PIC -#define MO(op) op##@GOTOFF(%edx) +# define MO(op) op##@GOTOFF(%edx) #else -#define MO(op) op +# define MO(op) op #endif .text @@ -65,3 +63,4 @@ ENTRY(__ieee754_log10f) fstp %st(1) ret END (__ieee754_log10f) +strong_alias (__ieee754_log10f, __log10f_finite) diff --git a/sysdeps/i386/fpu/e_log10l.S b/sysdeps/i386/fpu/e_log10l.S index 3811516..88b309d 100644 --- a/sysdeps/i386/fpu/e_log10l.S +++ b/sysdeps/i386/fpu/e_log10l.S @@ -9,14 +9,12 @@ #include <machine/asm.h> -RCSID("$NetBSD: $") - #ifdef __ELF__ - .section .rodata + .section .rodata.cst8,"aM",@progbits,8 #else .text #endif - .align ALIGNARG(4) + .p2align 3 ASM_TYPE_DIRECTIVE(one,@object) one: .double 1.0 ASM_SIZE_DIRECTIVE(one) @@ -29,9 +27,9 @@ limit: .double 0.29 #ifdef PIC -#define MO(op) op##@GOTOFF(%edx) +# define MO(op) op##@GOTOFF(%edx) #else -#define MO(op) op +# define MO(op) op #endif .text @@ -66,3 +64,4 @@ ENTRY(__ieee754_log10l) fstp %st(1) ret END(__ieee754_log10l) +strong_alias (__ieee754_log10l, __log10l_finite) diff --git a/sysdeps/i386/fpu/e_log2.S b/sysdeps/i386/fpu/e_log2.S index d80bf80..88aee7f 100644 --- a/sysdeps/i386/fpu/e_log2.S +++ b/sysdeps/i386/fpu/e_log2.S @@ -9,11 +9,11 @@ #include <machine/asm.h> #ifdef __ELF__ - .section .rodata + .section .rodata.cst8,"aM",@progbits,8 #else .text #endif - .align ALIGNARG(4) + .p2align 3 ASM_TYPE_DIRECTIVE(one,@object) one: .double 1.0 ASM_SIZE_DIRECTIVE(one) @@ -26,9 +26,9 @@ limit: .double 0.29 #ifdef PIC -#define MO(op) op##@GOTOFF(%edx) +# define MO(op) op##@GOTOFF(%edx) #else -#define MO(op) op +# define MO(op) op #endif .text @@ -63,3 +63,4 @@ ENTRY(__ieee754_log2) fstp %st(1) ret END (__ieee754_log2) +strong_alias (__ieee754_log2, __log2_finite) diff --git a/sysdeps/i386/fpu/e_log2f.S b/sysdeps/i386/fpu/e_log2f.S index 9eb7b2a..2014487 100644 --- a/sysdeps/i386/fpu/e_log2f.S +++ b/sysdeps/i386/fpu/e_log2f.S @@ -9,11 +9,11 @@ #include <machine/asm.h> #ifdef __ELF__ - .section .rodata + .section .rodata.cst8,"aM",@progbits,8 #else .text #endif - .align ALIGNARG(4) + .p2align 3 ASM_TYPE_DIRECTIVE(one,@object) one: .double 1.0 ASM_SIZE_DIRECTIVE(one) @@ -26,9 +26,9 @@ limit: .double 0.29 #ifdef PIC -#define MO(op) op##@GOTOFF(%edx) +# define MO(op) op##@GOTOFF(%edx) #else -#define MO(op) op +# define MO(op) op #endif .text @@ -63,3 +63,4 @@ ENTRY(__ieee754_log2f) fstp %st(1) ret END (__ieee754_log2f) +strong_alias (__ieee754_log2f, __log2f_finite) diff --git a/sysdeps/i386/fpu/e_log2l.S b/sysdeps/i386/fpu/e_log2l.S index 9de08f5..bc79dea 100644 --- a/sysdeps/i386/fpu/e_log2l.S +++ b/sysdeps/i386/fpu/e_log2l.S @@ -9,11 +9,11 @@ #include <machine/asm.h> #ifdef __ELF__ - .section .rodata + .section .rodata.cst8,"aM",@progbits,8 #else .text #endif - .align ALIGNARG(4) + .p2align 3 ASM_TYPE_DIRECTIVE(one,@object) one: .double 1.0 ASM_SIZE_DIRECTIVE(one) @@ -26,9 +26,9 @@ limit: .double 0.29 #ifdef PIC -#define MO(op) op##@GOTOFF(%edx) +# define MO(op) op##@GOTOFF(%edx) #else -#define MO(op) op +# define MO(op) op #endif .text @@ -63,3 +63,4 @@ ENTRY(__ieee754_log2l) fstp %st(1) ret END (__ieee754_log2l) +strong_alias (__ieee754_log2l, __log2l_finite) diff --git a/sysdeps/i386/fpu/e_logf.S b/sysdeps/i386/fpu/e_logf.S index cd4538b..b683e13 100644 --- a/sysdeps/i386/fpu/e_logf.S +++ b/sysdeps/i386/fpu/e_logf.S @@ -8,14 +8,12 @@ #include <machine/asm.h> -RCSID("$NetBSD: e_log.S,v 1.4 1995/05/08 23:48:39 jtc Exp $") - #ifdef __ELF__ - .section .rodata + .section .rodata.cst8,"aM",@progbits,8 #else .text #endif - .align ALIGNARG(4) + .p2align 3 ASM_TYPE_DIRECTIVE(one,@object) one: .double 1.0 ASM_SIZE_DIRECTIVE(one) @@ -28,9 +26,9 @@ limit: .double 0.29 #ifdef PIC -#define MO(op) op##@GOTOFF(%edx) +# define MO(op) op##@GOTOFF(%edx) #else -#define MO(op) op +# define MO(op) op #endif .text @@ -65,3 +63,4 @@ ENTRY(__ieee754_logf) fstp %st(1) ret END (__ieee754_logf) +strong_alias (__ieee754_logf, __logf_finite) diff --git a/sysdeps/i386/fpu/e_logl.S b/sysdeps/i386/fpu/e_logl.S index 551dcf1..ee1fb16 100644 --- a/sysdeps/i386/fpu/e_logl.S +++ b/sysdeps/i386/fpu/e_logl.S @@ -7,15 +7,13 @@ #include <machine/asm.h> -RCSID("$NetBSD: $") - #ifdef __ELF__ - .section .rodata + .section .rodata.cst8,"aM",@progbits,8 #else .text #endif - .align ALIGNARG(4) + .p2align 3 ASM_TYPE_DIRECTIVE(one,@object) one: .double 1.0 ASM_SIZE_DIRECTIVE(one) @@ -28,9 +26,9 @@ limit: .double 0.29 #ifdef PIC -#define MO(op) op##@GOTOFF(%edx) +# define MO(op) op##@GOTOFF(%edx) #else -#define MO(op) op +# define MO(op) op #endif .text @@ -65,3 +63,4 @@ ENTRY(__ieee754_logl) fstp %st(1) ret END (__ieee754_logl) +strong_alias (__ieee754_logl, __logl_finite) diff --git a/sysdeps/i386/fpu/e_pow.S b/sysdeps/i386/fpu/e_pow.S index 792f926..dccc677 100644 --- a/sysdeps/i386/fpu/e_pow.S +++ b/sysdeps/i386/fpu/e_pow.S @@ -1,5 +1,5 @@ /* ix87 specific implementation of pow function. - Copyright (C) 1996, 1997, 1998, 1999, 2001, 2004, 2005, 2007 + Copyright (C) 1996, 1997, 1998, 1999, 2001, 2004, 2005, 2007, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. @@ -22,12 +22,27 @@ #include <machine/asm.h> #ifdef __ELF__ - .section .rodata + .section .rodata.cst8,"aM",@progbits,8 #else .text #endif + .p2align 3 + ASM_TYPE_DIRECTIVE(one,@object) +one: .double 1.0 + ASM_SIZE_DIRECTIVE(one) + ASM_TYPE_DIRECTIVE(limit,@object) +limit: .double 0.29 + ASM_SIZE_DIRECTIVE(limit) + ASM_TYPE_DIRECTIVE(p63,@object) +p63: .byte 0, 0, 0, 0, 0, 0, 0xe0, 0x43 + ASM_SIZE_DIRECTIVE(p63) - .align ALIGNARG(4) +#ifdef __ELF__ + .section .rodata.cst16,"aM",@progbits,16 +#else + .text +#endif + .p2align 3 ASM_TYPE_DIRECTIVE(infinity,@object) inf_zero: infinity: @@ -43,22 +58,13 @@ minfinity: mzero: .byte 0, 0, 0, 0, 0, 0, 0, 0x80 ASM_SIZE_DIRECTIVE(minf_mzero) - ASM_TYPE_DIRECTIVE(one,@object) -one: .double 1.0 - ASM_SIZE_DIRECTIVE(one) - ASM_TYPE_DIRECTIVE(limit,@object) -limit: .double 0.29 - ASM_SIZE_DIRECTIVE(limit) - ASM_TYPE_DIRECTIVE(p63,@object) -p63: .byte 0, 0, 0, 0, 0, 0, 0xe0, 0x43 - ASM_SIZE_DIRECTIVE(p63) #ifdef PIC -#define MO(op) op##@GOTOFF(%ecx) -#define MOX(op,x,f) op##@GOTOFF(%ecx,x,f) +# define MO(op) op##@GOTOFF(%ecx) +# define MOX(op,x,f) op##@GOTOFF(%ecx,x,f) #else -#define MO(op) op -#define MOX(op,x,f) op(,x,f) +# define MO(op) op +# define MOX(op,x,f) op(,x,f) #endif .text @@ -360,3 +366,4 @@ ENTRY(__ieee754_pow) ret END(__ieee754_pow) +strong_alias (__ieee754_pow, __pow_finite) diff --git a/sysdeps/i386/fpu/e_powf.S b/sysdeps/i386/fpu/e_powf.S index c915454..99c95bb 100644 --- a/sysdeps/i386/fpu/e_powf.S +++ b/sysdeps/i386/fpu/e_powf.S @@ -1,5 +1,5 @@ /* ix87 specific implementation of pow function. - Copyright (C) 1996, 1997, 1999, 2001, 2004, 2005, 2007 + Copyright (C) 1996, 1997, 1999, 2001, 2004, 2005, 2007, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. @@ -22,12 +22,27 @@ #include <machine/asm.h> #ifdef __ELF__ - .section .rodata + .section .rodata.cst8,"aM",@progbits,8 #else .text #endif + .p2align 3 + ASM_TYPE_DIRECTIVE(one,@object) +one: .double 1.0 + ASM_SIZE_DIRECTIVE(one) + ASM_TYPE_DIRECTIVE(limit,@object) +limit: .double 0.29 + ASM_SIZE_DIRECTIVE(limit) + ASM_TYPE_DIRECTIVE(p31,@object) +p31: .byte 0, 0, 0, 0, 0, 0, 0xe0, 0x41 + ASM_SIZE_DIRECTIVE(p31) - .align ALIGNARG(4) +#ifdef __ELF__ + .section .rodata.cst16,"aM",@progbits,16 +#else + .text +#endif + .p2align 3 ASM_TYPE_DIRECTIVE(infinity,@object) inf_zero: infinity: @@ -43,22 +58,13 @@ minfinity: mzero: .byte 0, 0, 0, 0, 0, 0, 0, 0x80 ASM_SIZE_DIRECTIVE(minf_mzero) - ASM_TYPE_DIRECTIVE(one,@object) -one: .double 1.0 - ASM_SIZE_DIRECTIVE(one) - ASM_TYPE_DIRECTIVE(limit,@object) -limit: .double 0.29 - ASM_SIZE_DIRECTIVE(limit) - ASM_TYPE_DIRECTIVE(p31,@object) -p31: .byte 0, 0, 0, 0, 0, 0, 0xe0, 0x41 - ASM_SIZE_DIRECTIVE(p31) #ifdef PIC -#define MO(op) op##@GOTOFF(%ecx) -#define MOX(op,x,f) op##@GOTOFF(%ecx,x,f) +# define MO(op) op##@GOTOFF(%ecx) +# define MOX(op,x,f) op##@GOTOFF(%ecx,x,f) #else -#define MO(op) op -#define MOX(op,x,f) op(,x,f) +# define MO(op) op +# define MOX(op,x,f) op(,x,f) #endif .text @@ -348,3 +354,4 @@ ENTRY(__ieee754_powf) ret END(__ieee754_powf) +strong_alias (__ieee754_powf, __powf_finite) diff --git a/sysdeps/i386/fpu/e_powl.S b/sysdeps/i386/fpu/e_powl.S index 6215496..34ace35 100644 --- a/sysdeps/i386/fpu/e_powl.S +++ b/sysdeps/i386/fpu/e_powl.S @@ -1,5 +1,5 @@ /* ix87 specific implementation of pow function. - Copyright (C) 1996, 1997, 1998, 1999, 2001, 2004, 2005, 2007 + Copyright (C) 1996, 1997, 1998, 1999, 2001, 2004, 2005, 2007, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. @@ -22,12 +22,27 @@ #include <machine/asm.h> #ifdef __ELF__ - .section .rodata + .section .rodata.cst8,"aM",@progbits,8 #else .text #endif + .p2align 3 + ASM_TYPE_DIRECTIVE(one,@object) +one: .double 1.0 + ASM_SIZE_DIRECTIVE(one) + ASM_TYPE_DIRECTIVE(limit,@object) +limit: .double 0.29 + ASM_SIZE_DIRECTIVE(limit) + ASM_TYPE_DIRECTIVE(p63,@object) +p63: .byte 0, 0, 0, 0, 0, 0, 0xe0, 0x43 + ASM_SIZE_DIRECTIVE(p63) - .align ALIGNARG(4) +#ifdef __ELF__ + .section .rodata.cst16,"aM",@progbits,16 +#else + .text +#endif + .p2align 3 ASM_TYPE_DIRECTIVE(infinity,@object) inf_zero: infinity: @@ -43,22 +58,13 @@ minfinity: mzero: .byte 0, 0, 0, 0, 0, 0, 0, 0x80 ASM_SIZE_DIRECTIVE(minf_mzero) - ASM_TYPE_DIRECTIVE(one,@object) -one: .double 1.0 - ASM_SIZE_DIRECTIVE(one) - ASM_TYPE_DIRECTIVE(limit,@object) -limit: .double 0.29 - ASM_SIZE_DIRECTIVE(limit) - ASM_TYPE_DIRECTIVE(p63,@object) -p63: .byte 0, 0, 0, 0, 0, 0, 0xe0, 0x43 - ASM_SIZE_DIRECTIVE(p63) #ifdef PIC -#define MO(op) op##@GOTOFF(%ecx) -#define MOX(op,x,f) op##@GOTOFF(%ecx,x,f) +# define MO(op) op##@GOTOFF(%ecx) +# define MOX(op,x,f) op##@GOTOFF(%ecx,x,f) #else -#define MO(op) op -#define MOX(op,x,f) op(,x,f) +# define MO(op) op +# define MOX(op,x,f) op(,x,f) #endif .text @@ -360,3 +366,4 @@ ENTRY(__ieee754_powl) ret END(__ieee754_powl) +strong_alias (__ieee754_powl, __powl_finite) diff --git a/sysdeps/i386/fpu/e_remainder.S b/sysdeps/i386/fpu/e_remainder.S index 2f43cb8..f7867aa 100644 --- a/sysdeps/i386/fpu/e_remainder.S +++ b/sysdeps/i386/fpu/e_remainder.S @@ -5,8 +5,6 @@ #include <machine/asm.h> -RCSID("$NetBSD: e_remainder.S,v 1.4 1995/05/08 23:49:37 jtc Exp $") - ENTRY(__ieee754_remainder) fldl 12(%esp) fldl 4(%esp) @@ -17,3 +15,4 @@ ENTRY(__ieee754_remainder) fstp %st(1) ret END (__ieee754_remainder) +strong_alias (__ieee754_remainder, __remainder_finite) diff --git a/sysdeps/i386/fpu/e_remainderf.S b/sysdeps/i386/fpu/e_remainderf.S index 79f8219..cfd390b 100644 --- a/sysdeps/i386/fpu/e_remainderf.S +++ b/sysdeps/i386/fpu/e_remainderf.S @@ -5,8 +5,6 @@ #include <machine/asm.h> -RCSID("$NetBSD: e_remainderf.S,v 1.2 1995/05/08 23:49:47 jtc Exp $") - ENTRY(__ieee754_remainderf) flds 8(%esp) flds 4(%esp) @@ -17,3 +15,4 @@ ENTRY(__ieee754_remainderf) fstp %st(1) ret END (__ieee754_remainderf) +strong_alias (__ieee754_remainderf, __remainderf_finite) diff --git a/sysdeps/i386/fpu/e_remainderl.S b/sysdeps/i386/fpu/e_remainderl.S index 5f50b62..5ec23a3 100644 --- a/sysdeps/i386/fpu/e_remainderl.S +++ b/sysdeps/i386/fpu/e_remainderl.S @@ -7,8 +7,6 @@ #include <machine/asm.h> -RCSID("$NetBSD: $") - ENTRY(__ieee754_remainderl) fldt 16(%esp) fldt 4(%esp) @@ -19,3 +17,4 @@ ENTRY(__ieee754_remainderl) fstp %st(1) ret END (__ieee754_remainderl) +strong_alias (__ieee754_remainderl, __remainderl_finite) diff --git a/sysdeps/i386/fpu/e_scalb.S b/sysdeps/i386/fpu/e_scalb.S index 7e334a3..0f3ec96 100644 --- a/sysdeps/i386/fpu/e_scalb.S +++ b/sysdeps/i386/fpu/e_scalb.S @@ -7,8 +7,6 @@ #include <machine/asm.h> -RCSID("$NetBSD: e_scalb.S,v 1.4 1995/05/08 23:49:52 jtc Exp $") - #ifdef __ELF__ .section .rodata #else @@ -20,18 +18,17 @@ RCSID("$NetBSD: e_scalb.S,v 1.4 1995/05/08 23:49:52 jtc Exp $") zero_nan: .double 0.0 nan: .byte 0, 0, 0, 0, 0, 0, 0xff, 0x7f -minus_zero: .byte 0, 0, 0, 0, 0, 0, 0, 0x80 .byte 0, 0, 0, 0, 0, 0, 0xff, 0x7f ASM_SIZE_DIRECTIVE(zero_nan) #ifdef PIC -#define MO(op) op##@GOTOFF(%ecx) -#define MOX(op,x,f) op##@GOTOFF(%ecx,x,f) +# define MO(op) op##@GOTOFF(%ecx) +# define MOX(op,x,f) op##@GOTOFF(%ecx,x,f) #else -#define MO(op) op -#define MOX(op,x,f) op(,x,f) +# define MO(op) op +# define MOX(op,x,f) op(,x,f) #endif .text @@ -100,3 +97,4 @@ ENTRY(__ieee754_scalb) fdiv %st ret END(__ieee754_scalb) +strong_alias (__ieee754_scalb, __scalb_finite) diff --git a/sysdeps/i386/fpu/e_scalbf.S b/sysdeps/i386/fpu/e_scalbf.S index e99ee92..d11ca66 100644 --- a/sysdeps/i386/fpu/e_scalbf.S +++ b/sysdeps/i386/fpu/e_scalbf.S @@ -8,8 +8,6 @@ #include <machine/asm.h> -RCSID("$NetBSD: $") - #ifdef __ELF__ .section .rodata #else @@ -21,18 +19,17 @@ RCSID("$NetBSD: $") zero_nan: .double 0.0 nan: .byte 0, 0, 0, 0, 0, 0, 0xff, 0x7f -minus_zero: .byte 0, 0, 0, 0, 0, 0, 0, 0x80 .byte 0, 0, 0, 0, 0, 0, 0xff, 0x7f ASM_SIZE_DIRECTIVE(zero_nan) #ifdef PIC -#define MO(op) op##@GOTOFF(%ecx) -#define MOX(op,x,f) op##@GOTOFF(%ecx,x,f) +# define MO(op) op##@GOTOFF(%ecx) +# define MOX(op,x,f) op##@GOTOFF(%ecx,x,f) #else -#define MO(op) op -#define MOX(op,x,f) op(,x,f) +# define MO(op) op +# define MOX(op,x,f) op(,x,f) #endif @@ -102,3 +99,4 @@ ENTRY(__ieee754_scalbf) fdiv %st ret END(__ieee754_scalbf) +strong_alias (__ieee754_scalbf, __scalbf_finite) diff --git a/sysdeps/i386/fpu/e_scalbl.S b/sysdeps/i386/fpu/e_scalbl.S index 3f67d0b..d8b2169 100644 --- a/sysdeps/i386/fpu/e_scalbl.S +++ b/sysdeps/i386/fpu/e_scalbl.S @@ -9,8 +9,6 @@ #include <machine/asm.h> -RCSID("$NetBSD: $") - #ifdef __ELF__ .section .rodata #else @@ -22,18 +20,17 @@ RCSID("$NetBSD: $") zero_nan: .double 0.0 nan: .byte 0, 0, 0, 0, 0, 0, 0xff, 0x7f -minus_zero: .byte 0, 0, 0, 0, 0, 0, 0, 0x80 .byte 0, 0, 0, 0, 0, 0, 0xff, 0x7f ASM_SIZE_DIRECTIVE(zero_nan) #ifdef PIC -#define MO(op) op##@GOTOFF(%ecx) -#define MOX(op,x,f) op##@GOTOFF(%ecx,x,f) +# define MO(op) op##@GOTOFF(%ecx) +# define MOX(op,x,f) op##@GOTOFF(%ecx,x,f) #else -#define MO(op) op -#define MOX(op,x,f) op(,x,f) +# define MO(op) op +# define MOX(op,x,f) op(,x,f) #endif .text @@ -102,3 +99,4 @@ ENTRY(__ieee754_scalbl) fdiv %st ret END(__ieee754_scalbl) +strong_alias (__ieee754_scalbl, __scalbl_finite) diff --git a/sysdeps/i386/fpu/e_sqrt.S b/sysdeps/i386/fpu/e_sqrt.S index 6f253d5..1054ba4 100644 --- a/sysdeps/i386/fpu/e_sqrt.S +++ b/sysdeps/i386/fpu/e_sqrt.S @@ -5,10 +5,9 @@ #include <machine/asm.h> -RCSID("$NetBSD: e_sqrt.S,v 1.4 1995/05/08 23:49:57 jtc Exp $") - ENTRY(__ieee754_sqrt) fldl 4(%esp) fsqrt ret END (__ieee754_sqrt) +strong_alias (__ieee754_sqrt, __sqrt_finite) diff --git a/sysdeps/i386/fpu/e_sqrtf.S b/sysdeps/i386/fpu/e_sqrtf.S index 5ce1ad0..6f7e4b0 100644 --- a/sysdeps/i386/fpu/e_sqrtf.S +++ b/sysdeps/i386/fpu/e_sqrtf.S @@ -5,10 +5,9 @@ #include <machine/asm.h> -RCSID("$NetBSD: e_sqrtf.S,v 1.2 1995/05/08 23:50:14 jtc Exp $") - ENTRY(__ieee754_sqrtf) flds 4(%esp) fsqrt ret END (__ieee754_sqrtf) +strong_alias (__ieee754_sqrtf, __sqrtf_finite) diff --git a/sysdeps/i386/fpu/e_sqrtl.c b/sysdeps/i386/fpu/e_sqrtl.c index 85f61bb..41bcd7e 100644 --- a/sysdeps/i386/fpu/e_sqrtl.c +++ b/sysdeps/i386/fpu/e_sqrtl.c @@ -7,6 +7,7 @@ #include <math_private.h> +#undef __ieee754_sqrtl long double __ieee754_sqrtl (long double x) { @@ -16,3 +17,4 @@ __ieee754_sqrtl (long double x) return res; } +strong_alias (__ieee754_sqrtl, __sqrtl_finite) diff --git a/sysdeps/ia64/fpu/bits/math-finite.h b/sysdeps/ia64/fpu/bits/math-finite.h new file mode 100644 index 0000000..8901b2d --- /dev/null +++ b/sysdeps/ia64/fpu/bits/math-finite.h @@ -0,0 +1,25 @@ +/* Entry points to finite-math-only compiler runs. + Copyright (C) 2011 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _MATH_H +# error "Never use <bits/math-finite.h> directly; include <math.h> instead." +#endif + +/* Nothing can be done for IA-64 since the math functions differ in their + structure. */ diff --git a/sysdeps/ieee754/dbl-64/e_acosh.c b/sysdeps/ieee754/dbl-64/e_acosh.c index 27c29cd..f474e9a 100644 --- a/sysdeps/ieee754/dbl-64/e_acosh.c +++ b/sysdeps/ieee754/dbl-64/e_acosh.c @@ -5,18 +5,14 @@ * * Developed at SunPro, 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. * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: e_acosh.c,v 1.9 1995/05/12 04:57:18 jtc Exp $"; -#endif - /* __ieee754_acosh(x) * Method : - * Based on + * Based on * acosh(x) = log [ x + sqrt(x*x-1) ] * we have * acosh(x) := log(x)+ln2, if x is large; else @@ -31,21 +27,13 @@ static char rcsid[] = "$NetBSD: e_acosh.c,v 1.9 1995/05/12 04:57:18 jtc Exp $"; #include "math.h" #include "math_private.h" -#ifdef __STDC__ -static const double -#else -static double -#endif +static const double one = 1.0, ln2 = 6.93147180559945286227e-01; /* 0x3FE62E42, 0xFEFA39EF */ -#ifdef __STDC__ - double __ieee754_acosh(double x) -#else - double __ieee754_acosh(x) - double x; -#endif -{ +double +__ieee754_acosh(double x) +{ double t; int32_t hx; u_int32_t lx; @@ -54,8 +42,8 @@ ln2 = 6.93147180559945286227e-01; /* 0x3FE62E42, 0xFEFA39EF */ return (x-x)/(x-x); } else if(hx >=0x41b00000) { /* x > 2**28 */ if(hx >=0x7ff00000) { /* x is inf of NaN */ - return x+x; - } else + return x+x; + } else return __ieee754_log(x)+ln2; /* acosh(huge)=log(2x) */ } else if(((hx-0x3ff00000)|lx)==0) { return 0.0; /* acosh(1) = 0 */ @@ -67,3 +55,4 @@ ln2 = 6.93147180559945286227e-01; /* 0x3FE62E42, 0xFEFA39EF */ return __log1p(t+__sqrt(2.0*t+t*t)); } } +strong_alias (__ieee754_acosh, __acosh_finite) diff --git a/sysdeps/ieee754/dbl-64/e_asin.c b/sysdeps/ieee754/dbl-64/e_asin.c index ce5d227..02efb7a 100644 --- a/sysdeps/ieee754/dbl-64/e_asin.c +++ b/sysdeps/ieee754/dbl-64/e_asin.c @@ -1,7 +1,7 @@ /* * IBM Accurate Mathematical Library * written by International Business Machines Corp. - * Copyright (C) 2001 Free Software Foundation + * Copyright (C) 2001, 2011 Free Software Foundation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -209,9 +209,9 @@ double __ieee754_asin(double x){ else xx = -x - asncs.x[n]; t = asncs.x[n+1]*xx; p=xx*xx*(asncs.x[n+2]+xx*(asncs.x[n+3]+xx*(asncs.x[n+4]+ - xx*(asncs.x[n+5]+xx*(asncs.x[n+6] + xx*(asncs.x[n+5]+xx*(asncs.x[n+6] +xx*(asncs.x[n+7]+xx*(asncs.x[n+8]+ - xx*asncs.x[n+9])))))))+asncs.x[n+10]; + xx*asncs.x[n+9])))))))+asncs.x[n+10]; t+=p; res =asncs.x[n+11] +t; cor = (asncs.x[n+11]-res)+t; @@ -248,9 +248,9 @@ double __ieee754_asin(double x){ else xx = -x - asncs.x[n]; t = asncs.x[n+1]*xx; p=xx*xx*(asncs.x[n+2]+xx*(asncs.x[n+3]+xx*(asncs.x[n+4]+ - xx*(asncs.x[n+5]+xx*(asncs.x[n+6] + xx*(asncs.x[n+5]+xx*(asncs.x[n+6] +xx*(asncs.x[n+7]+xx*(asncs.x[n+8]+ - xx*(asncs.x[n+9]+xx*asncs.x[n+10]))))))))+asncs.x[n+11]; + xx*(asncs.x[n+9]+xx*asncs.x[n+10]))))))))+asncs.x[n+11]; t+=p; res =asncs.x[n+12] +t; cor = (asncs.x[n+12]-res)+t; @@ -324,6 +324,7 @@ double __ieee754_asin(double x){ return u.x/v.x; /* NaN */ } } +strong_alias (__ieee754_asin, __asin_finite) /*******************************************************************/ /* */ @@ -397,7 +398,7 @@ double __ieee754_acos(double x) else xx = -x - asncs.x[n]; t = asncs.x[n+1]*xx; p=xx*xx*(asncs.x[n+2]+xx*(asncs.x[n+3]+xx*(asncs.x[n+4]+ - xx*(asncs.x[n+5]+xx*asncs.x[n+6]))))+asncs.x[n+7]; + xx*(asncs.x[n+5]+xx*asncs.x[n+6]))))+asncs.x[n+7]; t+=p; y = (m>0)?(hp0.x-asncs.x[n+8]):(hp0.x+asncs.x[n+8]); t = (m>0)?(hp1.x-t):(hp1.x+t); @@ -433,8 +434,8 @@ double __ieee754_acos(double x) else {xx = -x - asncs.x[n]; eps=1.02; } t = asncs.x[n+1]*xx; p=xx*xx*(asncs.x[n+2]+xx*(asncs.x[n+3]+xx*(asncs.x[n+4]+ - xx*(asncs.x[n+5]+xx*(asncs.x[n+6]+ - xx*asncs.x[n+7])))))+asncs.x[n+8]; + xx*(asncs.x[n+5]+xx*(asncs.x[n+6]+ + xx*asncs.x[n+7])))))+asncs.x[n+8]; t+=p; y = (m>0)?(hp0.x-asncs.x[n+9]):(hp0.x+asncs.x[n+9]); t = (m>0)?(hp1.x-t):(hp1.x+t); @@ -468,8 +469,8 @@ double __ieee754_acos(double x) else {xx = -x - asncs.x[n]; eps = 1.01; } t = asncs.x[n+1]*xx; p=xx*xx*(asncs.x[n+2]+xx*(asncs.x[n+3]+xx*(asncs.x[n+4]+ - xx*(asncs.x[n+5]+xx*(asncs.x[n+6]+xx*(asncs.x[n+7]+ - xx*asncs.x[n+8]))))))+asncs.x[n+9]; + xx*(asncs.x[n+5]+xx*(asncs.x[n+6]+xx*(asncs.x[n+7]+ + xx*asncs.x[n+8]))))))+asncs.x[n+9]; t+=p; y = (m>0)?(hp0.x-asncs.x[n+10]):(hp0.x+asncs.x[n+10]); t = (m>0)?(hp1.x-t):(hp1.x+t); @@ -503,9 +504,9 @@ double __ieee754_acos(double x) else {xx = -x - asncs.x[n]; eps =1.005; } t = asncs.x[n+1]*xx; p=xx*xx*(asncs.x[n+2]+xx*(asncs.x[n+3]+xx*(asncs.x[n+4]+ - xx*(asncs.x[n+5]+xx*(asncs.x[n+6] + xx*(asncs.x[n+5]+xx*(asncs.x[n+6] +xx*(asncs.x[n+7]+xx*(asncs.x[n+8]+ - xx*asncs.x[n+9])))))))+asncs.x[n+10]; + xx*asncs.x[n+9])))))))+asncs.x[n+10]; t+=p; y = (m>0)?(hp0.x-asncs.x[n+11]):(hp0.x+asncs.x[n+11]); t = (m>0)?(hp1.x-t):(hp1.x+t); @@ -539,9 +540,9 @@ double __ieee754_acos(double x) else {xx = -x - asncs.x[n]; eps=1.005;} t = asncs.x[n+1]*xx; p=xx*xx*(asncs.x[n+2]+xx*(asncs.x[n+3]+xx*(asncs.x[n+4]+ - xx*(asncs.x[n+5]+xx*(asncs.x[n+6] + xx*(asncs.x[n+5]+xx*(asncs.x[n+6] +xx*(asncs.x[n+7]+xx*(asncs.x[n+8]+xx*(asncs.x[n+9]+ - xx*asncs.x[n+10]))))))))+asncs.x[n+11]; + xx*asncs.x[n+10]))))))))+asncs.x[n+11]; t+=p; y = (m>0)?(hp0.x-asncs.x[n+12]):(hp0.x+asncs.x[n+12]); t = (m>0)?(hp1.x-t):(hp1.x+t); @@ -635,3 +636,4 @@ double __ieee754_acos(double x) return u.x/v.x; } } +strong_alias (__ieee754_acos, __acos_finite) diff --git a/sysdeps/ieee754/dbl-64/e_atan2.c b/sysdeps/ieee754/dbl-64/e_atan2.c index 9e1a794..784fc5a 100644 --- a/sysdeps/ieee754/dbl-64/e_atan2.c +++ b/sysdeps/ieee754/dbl-64/e_atan2.c @@ -63,7 +63,7 @@ double __ieee754_atan2(double y,double x) { #endif static const int pr[MM]={6,8,10,20,32}; double ax,ay,u,du,u9,ua,v,vv,dv,t1,t2,t3,t4,t5,t6,t7,t8, - z,zz,cor,s1,ss1,s2,ss2; + z,zz,cor,s1,ss1,s2,ss2; #if 0 double z1,z2; #endif @@ -73,7 +73,7 @@ double __ieee754_atan2(double y,double x) { #endif static const int ep= 59768832, /* 57*16**5 */ - em=-59768832; /* -57*16**5 */ + em=-59768832; /* -57*16**5 */ /* x=NaN or y=NaN */ num.d = x; ux = num.i[HIGH_HALF]; dx = num.i[LOW_HALF]; @@ -102,23 +102,23 @@ double __ieee754_atan2(double y,double x) { if (ux==0x7ff00000) { if (dx==0x00000000) { if (uy==0x7ff00000) { - if (dy==0x00000000) return qpi.d; } + if (dy==0x00000000) return qpi.d; } else if (uy==0xfff00000) { - if (dy==0x00000000) return mqpi.d; } + if (dy==0x00000000) return mqpi.d; } else { - if ((uy&0x80000000)==0x00000000) return ZERO; - else return MZERO; } + if ((uy&0x80000000)==0x00000000) return ZERO; + else return MZERO; } } } else if (ux==0xfff00000) { if (dx==0x00000000) { if (uy==0x7ff00000) { - if (dy==0x00000000) return tqpi.d; } + if (dy==0x00000000) return tqpi.d; } else if (uy==0xfff00000) { - if (dy==0x00000000) return mtqpi.d; } + if (dy==0x00000000) return mtqpi.d; } else { - if ((uy&0x80000000)==0x00000000) return opi.d; - else return mopi.d; } + if ((uy&0x80000000)==0x00000000) return opi.d; + else return mopi.d; } } } @@ -156,108 +156,108 @@ double __ieee754_atan2(double y,double x) { /* (i) x>0, abs(y)< abs(x): atan(ay/ax) */ if (ay<ax) { if (u<inv16.d) { - v=u*u; zz=du+u*v*(d3.d+v*(d5.d+v*(d7.d+v*(d9.d+v*(d11.d+v*d13.d))))); - if ((z=u+(zz-u1.d*u)) == u+(zz+u1.d*u)) return signArctan2(y,z); + v=u*u; zz=du+u*v*(d3.d+v*(d5.d+v*(d7.d+v*(d9.d+v*(d11.d+v*d13.d))))); + if ((z=u+(zz-u1.d*u)) == u+(zz+u1.d*u)) return signArctan2(y,z); - MUL2(u,du,u,du,v,vv,t1,t2,t3,t4,t5,t6,t7,t8) - s1=v*(f11.d+v*(f13.d+v*(f15.d+v*(f17.d+v*f19.d)))); - ADD2(f9.d,ff9.d,s1,ZERO,s2,ss2,t1,t2) - MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8) - ADD2(f7.d,ff7.d,s1,ss1,s2,ss2,t1,t2) - MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8) - ADD2(f5.d,ff5.d,s1,ss1,s2,ss2,t1,t2) - MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8) - ADD2(f3.d,ff3.d,s1,ss1,s2,ss2,t1,t2) - MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8) - MUL2(u,du,s1,ss1,s2,ss2,t1,t2,t3,t4,t5,t6,t7,t8) - ADD2(u,du,s2,ss2,s1,ss1,t1,t2) - if ((z=s1+(ss1-u5.d*s1)) == s1+(ss1+u5.d*s1)) return signArctan2(y,z); - return atan2Mp(x,y,pr); + MUL2(u,du,u,du,v,vv,t1,t2,t3,t4,t5,t6,t7,t8) + s1=v*(f11.d+v*(f13.d+v*(f15.d+v*(f17.d+v*f19.d)))); + ADD2(f9.d,ff9.d,s1,ZERO,s2,ss2,t1,t2) + MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8) + ADD2(f7.d,ff7.d,s1,ss1,s2,ss2,t1,t2) + MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8) + ADD2(f5.d,ff5.d,s1,ss1,s2,ss2,t1,t2) + MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8) + ADD2(f3.d,ff3.d,s1,ss1,s2,ss2,t1,t2) + MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8) + MUL2(u,du,s1,ss1,s2,ss2,t1,t2,t3,t4,t5,t6,t7,t8) + ADD2(u,du,s2,ss2,s1,ss1,t1,t2) + if ((z=s1+(ss1-u5.d*s1)) == s1+(ss1+u5.d*s1)) return signArctan2(y,z); + return atan2Mp(x,y,pr); } else { - i=(TWO52+TWO8*u)-TWO52; i-=16; - t3=u-cij[i][0].d; - EADD(t3,du,v,dv) - t1=cij[i][1].d; t2=cij[i][2].d; - zz=v*t2+(dv*t2+v*v*(cij[i][3].d+v*(cij[i][4].d+ - v*(cij[i][5].d+v* cij[i][6].d)))); - if (i<112) { - if (i<48) u9=u91.d; /* u < 1/4 */ - else u9=u92.d; } /* 1/4 <= u < 1/2 */ - else { - if (i<176) u9=u93.d; /* 1/2 <= u < 3/4 */ - else u9=u94.d; } /* 3/4 <= u <= 1 */ - if ((z=t1+(zz-u9*t1)) == t1+(zz+u9*t1)) return signArctan2(y,z); + i=(TWO52+TWO8*u)-TWO52; i-=16; + t3=u-cij[i][0].d; + EADD(t3,du,v,dv) + t1=cij[i][1].d; t2=cij[i][2].d; + zz=v*t2+(dv*t2+v*v*(cij[i][3].d+v*(cij[i][4].d+ + v*(cij[i][5].d+v* cij[i][6].d)))); + if (i<112) { + if (i<48) u9=u91.d; /* u < 1/4 */ + else u9=u92.d; } /* 1/4 <= u < 1/2 */ + else { + if (i<176) u9=u93.d; /* 1/2 <= u < 3/4 */ + else u9=u94.d; } /* 3/4 <= u <= 1 */ + if ((z=t1+(zz-u9*t1)) == t1+(zz+u9*t1)) return signArctan2(y,z); - t1=u-hij[i][0].d; - EADD(t1,du,v,vv) - s1=v*(hij[i][11].d+v*(hij[i][12].d+v*(hij[i][13].d+ - v*(hij[i][14].d+v* hij[i][15].d)))); - ADD2(hij[i][9].d,hij[i][10].d,s1,ZERO,s2,ss2,t1,t2) - MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8) - ADD2(hij[i][7].d,hij[i][8].d,s1,ss1,s2,ss2,t1,t2) - MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8) - ADD2(hij[i][5].d,hij[i][6].d,s1,ss1,s2,ss2,t1,t2) - MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8) - ADD2(hij[i][3].d,hij[i][4].d,s1,ss1,s2,ss2,t1,t2) - MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8) - ADD2(hij[i][1].d,hij[i][2].d,s1,ss1,s2,ss2,t1,t2) - if ((z=s2+(ss2-ub.d*s2)) == s2+(ss2+ub.d*s2)) return signArctan2(y,z); - return atan2Mp(x,y,pr); + t1=u-hij[i][0].d; + EADD(t1,du,v,vv) + s1=v*(hij[i][11].d+v*(hij[i][12].d+v*(hij[i][13].d+ + v*(hij[i][14].d+v* hij[i][15].d)))); + ADD2(hij[i][9].d,hij[i][10].d,s1,ZERO,s2,ss2,t1,t2) + MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8) + ADD2(hij[i][7].d,hij[i][8].d,s1,ss1,s2,ss2,t1,t2) + MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8) + ADD2(hij[i][5].d,hij[i][6].d,s1,ss1,s2,ss2,t1,t2) + MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8) + ADD2(hij[i][3].d,hij[i][4].d,s1,ss1,s2,ss2,t1,t2) + MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8) + ADD2(hij[i][1].d,hij[i][2].d,s1,ss1,s2,ss2,t1,t2) + if ((z=s2+(ss2-ub.d*s2)) == s2+(ss2+ub.d*s2)) return signArctan2(y,z); + return atan2Mp(x,y,pr); } } /* (ii) x>0, abs(x)<=abs(y): pi/2-atan(ax/ay) */ else { if (u<inv16.d) { - v=u*u; - zz=u*v*(d3.d+v*(d5.d+v*(d7.d+v*(d9.d+v*(d11.d+v*d13.d))))); - ESUB(hpi.d,u,t2,cor) - t3=((hpi1.d+cor)-du)-zz; - if ((z=t2+(t3-u2.d)) == t2+(t3+u2.d)) return signArctan2(y,z); + v=u*u; + zz=u*v*(d3.d+v*(d5.d+v*(d7.d+v*(d9.d+v*(d11.d+v*d13.d))))); + ESUB(hpi.d,u,t2,cor) + t3=((hpi1.d+cor)-du)-zz; + if ((z=t2+(t3-u2.d)) == t2+(t3+u2.d)) return signArctan2(y,z); - MUL2(u,du,u,du,v,vv,t1,t2,t3,t4,t5,t6,t7,t8) - s1=v*(f11.d+v*(f13.d+v*(f15.d+v*(f17.d+v*f19.d)))); - ADD2(f9.d,ff9.d,s1,ZERO,s2,ss2,t1,t2) - MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8) - ADD2(f7.d,ff7.d,s1,ss1,s2,ss2,t1,t2) - MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8) - ADD2(f5.d,ff5.d,s1,ss1,s2,ss2,t1,t2) - MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8) - ADD2(f3.d,ff3.d,s1,ss1,s2,ss2,t1,t2) - MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8) - MUL2(u,du,s1,ss1,s2,ss2,t1,t2,t3,t4,t5,t6,t7,t8) - ADD2(u,du,s2,ss2,s1,ss1,t1,t2) - SUB2(hpi.d,hpi1.d,s1,ss1,s2,ss2,t1,t2) - if ((z=s2+(ss2-u6.d)) == s2+(ss2+u6.d)) return signArctan2(y,z); - return atan2Mp(x,y,pr); + MUL2(u,du,u,du,v,vv,t1,t2,t3,t4,t5,t6,t7,t8) + s1=v*(f11.d+v*(f13.d+v*(f15.d+v*(f17.d+v*f19.d)))); + ADD2(f9.d,ff9.d,s1,ZERO,s2,ss2,t1,t2) + MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8) + ADD2(f7.d,ff7.d,s1,ss1,s2,ss2,t1,t2) + MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8) + ADD2(f5.d,ff5.d,s1,ss1,s2,ss2,t1,t2) + MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8) + ADD2(f3.d,ff3.d,s1,ss1,s2,ss2,t1,t2) + MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8) + MUL2(u,du,s1,ss1,s2,ss2,t1,t2,t3,t4,t5,t6,t7,t8) + ADD2(u,du,s2,ss2,s1,ss1,t1,t2) + SUB2(hpi.d,hpi1.d,s1,ss1,s2,ss2,t1,t2) + if ((z=s2+(ss2-u6.d)) == s2+(ss2+u6.d)) return signArctan2(y,z); + return atan2Mp(x,y,pr); } else { - i=(TWO52+TWO8*u)-TWO52; i-=16; - v=(u-cij[i][0].d)+du; - zz=hpi1.d-v*(cij[i][2].d+v*(cij[i][3].d+v*(cij[i][4].d+ - v*(cij[i][5].d+v* cij[i][6].d)))); - t1=hpi.d-cij[i][1].d; - if (i<112) ua=ua1.d; /* w < 1/2 */ - else ua=ua2.d; /* w >= 1/2 */ - if ((z=t1+(zz-ua)) == t1+(zz+ua)) return signArctan2(y,z); + i=(TWO52+TWO8*u)-TWO52; i-=16; + v=(u-cij[i][0].d)+du; + zz=hpi1.d-v*(cij[i][2].d+v*(cij[i][3].d+v*(cij[i][4].d+ + v*(cij[i][5].d+v* cij[i][6].d)))); + t1=hpi.d-cij[i][1].d; + if (i<112) ua=ua1.d; /* w < 1/2 */ + else ua=ua2.d; /* w >= 1/2 */ + if ((z=t1+(zz-ua)) == t1+(zz+ua)) return signArctan2(y,z); - t1=u-hij[i][0].d; - EADD(t1,du,v,vv) - s1=v*(hij[i][11].d+v*(hij[i][12].d+v*(hij[i][13].d+ - v*(hij[i][14].d+v* hij[i][15].d)))); - ADD2(hij[i][9].d,hij[i][10].d,s1,ZERO,s2,ss2,t1,t2) - MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8) - ADD2(hij[i][7].d,hij[i][8].d,s1,ss1,s2,ss2,t1,t2) - MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8) - ADD2(hij[i][5].d,hij[i][6].d,s1,ss1,s2,ss2,t1,t2) - MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8) - ADD2(hij[i][3].d,hij[i][4].d,s1,ss1,s2,ss2,t1,t2) - MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8) - ADD2(hij[i][1].d,hij[i][2].d,s1,ss1,s2,ss2,t1,t2) - SUB2(hpi.d,hpi1.d,s2,ss2,s1,ss1,t1,t2) - if ((z=s1+(ss1-uc.d)) == s1+(ss1+uc.d)) return signArctan2(y,z); - return atan2Mp(x,y,pr); + t1=u-hij[i][0].d; + EADD(t1,du,v,vv) + s1=v*(hij[i][11].d+v*(hij[i][12].d+v*(hij[i][13].d+ + v*(hij[i][14].d+v* hij[i][15].d)))); + ADD2(hij[i][9].d,hij[i][10].d,s1,ZERO,s2,ss2,t1,t2) + MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8) + ADD2(hij[i][7].d,hij[i][8].d,s1,ss1,s2,ss2,t1,t2) + MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8) + ADD2(hij[i][5].d,hij[i][6].d,s1,ss1,s2,ss2,t1,t2) + MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8) + ADD2(hij[i][3].d,hij[i][4].d,s1,ss1,s2,ss2,t1,t2) + MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8) + ADD2(hij[i][1].d,hij[i][2].d,s1,ss1,s2,ss2,t1,t2) + SUB2(hpi.d,hpi1.d,s2,ss2,s1,ss1,t1,t2) + if ((z=s1+(ss1-uc.d)) == s1+(ss1+uc.d)) return signArctan2(y,z); + return atan2Mp(x,y,pr); } } } @@ -266,112 +266,114 @@ double __ieee754_atan2(double y,double x) { /* (iii) x<0, abs(x)< abs(y): pi/2+atan(ax/ay) */ if (ax<ay) { if (u<inv16.d) { - v=u*u; - zz=u*v*(d3.d+v*(d5.d+v*(d7.d+v*(d9.d+v*(d11.d+v*d13.d))))); - EADD(hpi.d,u,t2,cor) - t3=((hpi1.d+cor)+du)+zz; - if ((z=t2+(t3-u3.d)) == t2+(t3+u3.d)) return signArctan2(y,z); + v=u*u; + zz=u*v*(d3.d+v*(d5.d+v*(d7.d+v*(d9.d+v*(d11.d+v*d13.d))))); + EADD(hpi.d,u,t2,cor) + t3=((hpi1.d+cor)+du)+zz; + if ((z=t2+(t3-u3.d)) == t2+(t3+u3.d)) return signArctan2(y,z); - MUL2(u,du,u,du,v,vv,t1,t2,t3,t4,t5,t6,t7,t8) - s1=v*(f11.d+v*(f13.d+v*(f15.d+v*(f17.d+v*f19.d)))); - ADD2(f9.d,ff9.d,s1,ZERO,s2,ss2,t1,t2) - MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8) - ADD2(f7.d,ff7.d,s1,ss1,s2,ss2,t1,t2) - MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8) - ADD2(f5.d,ff5.d,s1,ss1,s2,ss2,t1,t2) - MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8) - ADD2(f3.d,ff3.d,s1,ss1,s2,ss2,t1,t2) - MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8) - MUL2(u,du,s1,ss1,s2,ss2,t1,t2,t3,t4,t5,t6,t7,t8) - ADD2(u,du,s2,ss2,s1,ss1,t1,t2) - ADD2(hpi.d,hpi1.d,s1,ss1,s2,ss2,t1,t2) - if ((z=s2+(ss2-u7.d)) == s2+(ss2+u7.d)) return signArctan2(y,z); - return atan2Mp(x,y,pr); + MUL2(u,du,u,du,v,vv,t1,t2,t3,t4,t5,t6,t7,t8) + s1=v*(f11.d+v*(f13.d+v*(f15.d+v*(f17.d+v*f19.d)))); + ADD2(f9.d,ff9.d,s1,ZERO,s2,ss2,t1,t2) + MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8) + ADD2(f7.d,ff7.d,s1,ss1,s2,ss2,t1,t2) + MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8) + ADD2(f5.d,ff5.d,s1,ss1,s2,ss2,t1,t2) + MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8) + ADD2(f3.d,ff3.d,s1,ss1,s2,ss2,t1,t2) + MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8) + MUL2(u,du,s1,ss1,s2,ss2,t1,t2,t3,t4,t5,t6,t7,t8) + ADD2(u,du,s2,ss2,s1,ss1,t1,t2) + ADD2(hpi.d,hpi1.d,s1,ss1,s2,ss2,t1,t2) + if ((z=s2+(ss2-u7.d)) == s2+(ss2+u7.d)) return signArctan2(y,z); + return atan2Mp(x,y,pr); } else { - i=(TWO52+TWO8*u)-TWO52; i-=16; - v=(u-cij[i][0].d)+du; - zz=hpi1.d+v*(cij[i][2].d+v*(cij[i][3].d+v*(cij[i][4].d+ - v*(cij[i][5].d+v* cij[i][6].d)))); - t1=hpi.d+cij[i][1].d; - if (i<112) ua=ua1.d; /* w < 1/2 */ - else ua=ua2.d; /* w >= 1/2 */ - if ((z=t1+(zz-ua)) == t1+(zz+ua)) return signArctan2(y,z); + i=(TWO52+TWO8*u)-TWO52; i-=16; + v=(u-cij[i][0].d)+du; + zz=hpi1.d+v*(cij[i][2].d+v*(cij[i][3].d+v*(cij[i][4].d+ + v*(cij[i][5].d+v* cij[i][6].d)))); + t1=hpi.d+cij[i][1].d; + if (i<112) ua=ua1.d; /* w < 1/2 */ + else ua=ua2.d; /* w >= 1/2 */ + if ((z=t1+(zz-ua)) == t1+(zz+ua)) return signArctan2(y,z); - t1=u-hij[i][0].d; - EADD(t1,du,v,vv) - s1=v*(hij[i][11].d+v*(hij[i][12].d+v*(hij[i][13].d+ - v*(hij[i][14].d+v* hij[i][15].d)))); - ADD2(hij[i][9].d,hij[i][10].d,s1,ZERO,s2,ss2,t1,t2) - MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8) - ADD2(hij[i][7].d,hij[i][8].d,s1,ss1,s2,ss2,t1,t2) - MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8) - ADD2(hij[i][5].d,hij[i][6].d,s1,ss1,s2,ss2,t1,t2) - MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8) - ADD2(hij[i][3].d,hij[i][4].d,s1,ss1,s2,ss2,t1,t2) - MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8) - ADD2(hij[i][1].d,hij[i][2].d,s1,ss1,s2,ss2,t1,t2) - ADD2(hpi.d,hpi1.d,s2,ss2,s1,ss1,t1,t2) - if ((z=s1+(ss1-uc.d)) == s1+(ss1+uc.d)) return signArctan2(y,z); - return atan2Mp(x,y,pr); + t1=u-hij[i][0].d; + EADD(t1,du,v,vv) + s1=v*(hij[i][11].d+v*(hij[i][12].d+v*(hij[i][13].d+ + v*(hij[i][14].d+v* hij[i][15].d)))); + ADD2(hij[i][9].d,hij[i][10].d,s1,ZERO,s2,ss2,t1,t2) + MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8) + ADD2(hij[i][7].d,hij[i][8].d,s1,ss1,s2,ss2,t1,t2) + MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8) + ADD2(hij[i][5].d,hij[i][6].d,s1,ss1,s2,ss2,t1,t2) + MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8) + ADD2(hij[i][3].d,hij[i][4].d,s1,ss1,s2,ss2,t1,t2) + MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8) + ADD2(hij[i][1].d,hij[i][2].d,s1,ss1,s2,ss2,t1,t2) + ADD2(hpi.d,hpi1.d,s2,ss2,s1,ss1,t1,t2) + if ((z=s1+(ss1-uc.d)) == s1+(ss1+uc.d)) return signArctan2(y,z); + return atan2Mp(x,y,pr); } } /* (iv) x<0, abs(y)<=abs(x): pi-atan(ax/ay) */ else { if (u<inv16.d) { - v=u*u; - zz=u*v*(d3.d+v*(d5.d+v*(d7.d+v*(d9.d+v*(d11.d+v*d13.d))))); - ESUB(opi.d,u,t2,cor) - t3=((opi1.d+cor)-du)-zz; - if ((z=t2+(t3-u4.d)) == t2+(t3+u4.d)) return signArctan2(y,z); + v=u*u; + zz=u*v*(d3.d+v*(d5.d+v*(d7.d+v*(d9.d+v*(d11.d+v*d13.d))))); + ESUB(opi.d,u,t2,cor) + t3=((opi1.d+cor)-du)-zz; + if ((z=t2+(t3-u4.d)) == t2+(t3+u4.d)) return signArctan2(y,z); - MUL2(u,du,u,du,v,vv,t1,t2,t3,t4,t5,t6,t7,t8) - s1=v*(f11.d+v*(f13.d+v*(f15.d+v*(f17.d+v*f19.d)))); - ADD2(f9.d,ff9.d,s1,ZERO,s2,ss2,t1,t2) - MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8) - ADD2(f7.d,ff7.d,s1,ss1,s2,ss2,t1,t2) - MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8) - ADD2(f5.d,ff5.d,s1,ss1,s2,ss2,t1,t2) - MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8) - ADD2(f3.d,ff3.d,s1,ss1,s2,ss2,t1,t2) - MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8) - MUL2(u,du,s1,ss1,s2,ss2,t1,t2,t3,t4,t5,t6,t7,t8) - ADD2(u,du,s2,ss2,s1,ss1,t1,t2) - SUB2(opi.d,opi1.d,s1,ss1,s2,ss2,t1,t2) - if ((z=s2+(ss2-u8.d)) == s2+(ss2+u8.d)) return signArctan2(y,z); - return atan2Mp(x,y,pr); + MUL2(u,du,u,du,v,vv,t1,t2,t3,t4,t5,t6,t7,t8) + s1=v*(f11.d+v*(f13.d+v*(f15.d+v*(f17.d+v*f19.d)))); + ADD2(f9.d,ff9.d,s1,ZERO,s2,ss2,t1,t2) + MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8) + ADD2(f7.d,ff7.d,s1,ss1,s2,ss2,t1,t2) + MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8) + ADD2(f5.d,ff5.d,s1,ss1,s2,ss2,t1,t2) + MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8) + ADD2(f3.d,ff3.d,s1,ss1,s2,ss2,t1,t2) + MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8) + MUL2(u,du,s1,ss1,s2,ss2,t1,t2,t3,t4,t5,t6,t7,t8) + ADD2(u,du,s2,ss2,s1,ss1,t1,t2) + SUB2(opi.d,opi1.d,s1,ss1,s2,ss2,t1,t2) + if ((z=s2+(ss2-u8.d)) == s2+(ss2+u8.d)) return signArctan2(y,z); + return atan2Mp(x,y,pr); } else { - i=(TWO52+TWO8*u)-TWO52; i-=16; - v=(u-cij[i][0].d)+du; - zz=opi1.d-v*(cij[i][2].d+v*(cij[i][3].d+v*(cij[i][4].d+ - v*(cij[i][5].d+v* cij[i][6].d)))); - t1=opi.d-cij[i][1].d; - if (i<112) ua=ua1.d; /* w < 1/2 */ - else ua=ua2.d; /* w >= 1/2 */ - if ((z=t1+(zz-ua)) == t1+(zz+ua)) return signArctan2(y,z); + i=(TWO52+TWO8*u)-TWO52; i-=16; + v=(u-cij[i][0].d)+du; + zz=opi1.d-v*(cij[i][2].d+v*(cij[i][3].d+v*(cij[i][4].d+ + v*(cij[i][5].d+v* cij[i][6].d)))); + t1=opi.d-cij[i][1].d; + if (i<112) ua=ua1.d; /* w < 1/2 */ + else ua=ua2.d; /* w >= 1/2 */ + if ((z=t1+(zz-ua)) == t1+(zz+ua)) return signArctan2(y,z); - t1=u-hij[i][0].d; - EADD(t1,du,v,vv) - s1=v*(hij[i][11].d+v*(hij[i][12].d+v*(hij[i][13].d+ - v*(hij[i][14].d+v* hij[i][15].d)))); - ADD2(hij[i][9].d,hij[i][10].d,s1,ZERO,s2,ss2,t1,t2) - MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8) - ADD2(hij[i][7].d,hij[i][8].d,s1,ss1,s2,ss2,t1,t2) - MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8) - ADD2(hij[i][5].d,hij[i][6].d,s1,ss1,s2,ss2,t1,t2) - MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8) - ADD2(hij[i][3].d,hij[i][4].d,s1,ss1,s2,ss2,t1,t2) - MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8) - ADD2(hij[i][1].d,hij[i][2].d,s1,ss1,s2,ss2,t1,t2) - SUB2(opi.d,opi1.d,s2,ss2,s1,ss1,t1,t2) - if ((z=s1+(ss1-uc.d)) == s1+(ss1+uc.d)) return signArctan2(y,z); - return atan2Mp(x,y,pr); + t1=u-hij[i][0].d; + EADD(t1,du,v,vv) + s1=v*(hij[i][11].d+v*(hij[i][12].d+v*(hij[i][13].d+ + v*(hij[i][14].d+v* hij[i][15].d)))); + ADD2(hij[i][9].d,hij[i][10].d,s1,ZERO,s2,ss2,t1,t2) + MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8) + ADD2(hij[i][7].d,hij[i][8].d,s1,ss1,s2,ss2,t1,t2) + MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8) + ADD2(hij[i][5].d,hij[i][6].d,s1,ss1,s2,ss2,t1,t2) + MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8) + ADD2(hij[i][3].d,hij[i][4].d,s1,ss1,s2,ss2,t1,t2) + MUL2(v,vv,s2,ss2,s1,ss1,t1,t2,t3,t4,t5,t6,t7,t8) + ADD2(hij[i][1].d,hij[i][2].d,s1,ss1,s2,ss2,t1,t2) + SUB2(opi.d,opi1.d,s2,ss2,s1,ss1,t1,t2) + if ((z=s1+(ss1-uc.d)) == s1+(ss1+uc.d)) return signArctan2(y,z); + return atan2Mp(x,y,pr); } } } } +strong_alias (__ieee754_atan2, __atan2_finite) + /* Treat the Denormalized case */ static double normalized(double ax,double ay,double y, double z) { int p; diff --git a/sysdeps/ieee754/dbl-64/e_atanh.c b/sysdeps/ieee754/dbl-64/e_atanh.c index fa4fe67..de3bc8f 100644 --- a/sysdeps/ieee754/dbl-64/e_atanh.c +++ b/sysdeps/ieee754/dbl-64/e_atanh.c @@ -1,74 +1,70 @@ -/* @(#)e_atanh.c 5.1 93/09/24 */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ +/* Copyright (C) 2011 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@gmail.com>, 2011. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: e_atanh.c,v 1.8 1995/05/10 20:44:55 jtc Exp $"; -#endif /* __ieee754_atanh(x) - * Method : - * 1.Reduced x to positive by atanh(-x) = -atanh(x) - * 2.For x>=0.5 - * 1 2x x - * atanh(x) = --- * log(1 + -------) = 0.5 * log1p(2 * --------) - * 2 1 - x 1 - x - * - * For x<0.5 - * atanh(x) = 0.5*log1p(2x+2x*x/(1-x)) - * - * Special cases: - * atanh(x) is NaN if |x| > 1 with signal; - * atanh(NaN) is that NaN with no signal; - * atanh(+-1) is +-INF with signal. - * + Method : + 1.Reduced x to positive by atanh(-x) = -atanh(x) + 2.For x>=0.5 + 1 2x x + atanh(x) = --- * log(1 + -------) = 0.5 * log1p(2 * --------) + 2 1 - x 1 - x + + For x<0.5 + atanh(x) = 0.5*log1p(2x+2x*x/(1-x)) + + Special cases: + atanh(x) is NaN if |x| > 1 with signal; + atanh(NaN) is that NaN with no signal; + atanh(+-1) is +-INF with signal. + */ +#include <inttypes.h> #include "math.h" #include "math_private.h" -#ifdef __STDC__ -static const double one = 1.0, huge = 1e300; -#else -static double one = 1.0, huge = 1e300; -#endif - -#ifdef __STDC__ -static const double zero = 0.0; -#else -static double zero = 0.0; -#endif +static const double huge = 1e300; -#ifdef __STDC__ - double __ieee754_atanh(double x) -#else - double __ieee754_atanh(x) - double x; -#endif +double +__ieee754_atanh (double x) { - double t; - int32_t hx,ix; - u_int32_t lx; - EXTRACT_WORDS(hx,lx,x); - ix = hx&0x7fffffff; - if ((ix|((lx|(-lx))>>31))>0x3ff00000) /* |x|>1 */ - return (x-x)/(x-x); - if(ix==0x3ff00000) - return x/zero; - if(ix<0x3e300000&&(huge+x)>zero) return x; /* x<2**-28 */ - SET_HIGH_WORD(x,ix); - if(ix<0x3fe00000) { /* x < 0.5 */ - t = x+x; - t = 0.5*__log1p(t+t*x/(one-x)); - } else - t = 0.5*__log1p((x+x)/(one-x)); - if(hx>=0) return t; else return -t; + double xa = fabs (x); + double t; + if (xa < 0.5) + { + if (__builtin_expect (xa < 0x1.0p-28, 0) && (huge + x) > 0.0) + return x; + + t = xa + xa; + t = 0.5 * __log1p (t + t * xa / (1.0 - xa)); + } + else if (__builtin_expect (xa < 1.0, 1)) + t = 0.5 * __log1p ((xa + xa) / (1.0 - xa)); + else + { + if (xa > 1.0) + return (x - x) / (x - x); + + return x / 0.0; + } + + return __copysign (t, x); } +strong_alias (__ieee754_atanh, __atanh_finite) diff --git a/sysdeps/ieee754/dbl-64/e_cosh.c b/sysdeps/ieee754/dbl-64/e_cosh.c index 65106b9..180ca42 100644 --- a/sysdeps/ieee754/dbl-64/e_cosh.c +++ b/sysdeps/ieee754/dbl-64/e_cosh.c @@ -1,11 +1,11 @@ -/* @(#)e_cosh.c 5.1 93/09/24 */ +/* Optimized by Ulrich Drepper <drepper@gmail.com>, 2011 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. * * Developed at SunPro, 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. * ==================================================== */ @@ -15,18 +15,18 @@ static char rcsid[] = "$NetBSD: e_cosh.c,v 1.7 1995/05/10 20:44:58 jtc Exp $"; #endif /* __ieee754_cosh(x) - * Method : + * Method : * mathematically cosh(x) if defined to be (exp(x)+exp(-x))/2 - * 1. Replace x by |x| (cosh(x) = cosh(-x)). - * 2. - * [ exp(x) - 1 ]^2 + * 1. Replace x by |x| (cosh(x) = cosh(-x)). + * 2. + * [ exp(x) - 1 ]^2 * 0 <= x <= ln2/2 : cosh(x) := 1 + ------------------- - * 2*exp(x) + * 2*exp(x) * - * exp(x) + 1/exp(x) + * exp(x) + 1/exp(x) * ln2/2 <= x <= 22 : cosh(x) := ------------------- - * 2 - * 22 <= x <= lnovft : cosh(x) := exp(x)/2 + * 2 + * 22 <= x <= lnovft : cosh(x) := exp(x)/2 * lnovft <= x <= ln2ovft: cosh(x) := exp(x/2)/2 * exp(x/2) * ln2ovft < x : cosh(x) := huge*huge (overflow) * @@ -38,19 +38,11 @@ static char rcsid[] = "$NetBSD: e_cosh.c,v 1.7 1995/05/10 20:44:58 jtc Exp $"; #include "math.h" #include "math_private.h" -#ifdef __STDC__ static const double one = 1.0, half=0.5, huge = 1.0e300; -#else -static double one = 1.0, half=0.5, huge = 1.0e300; -#endif -#ifdef __STDC__ - double __ieee754_cosh(double x) -#else - double __ieee754_cosh(x) - double x; -#endif -{ +double +__ieee754_cosh (double x) +{ double t,w; int32_t ix; u_int32_t lx; @@ -59,19 +51,17 @@ static double one = 1.0, half=0.5, huge = 1.0e300; GET_HIGH_WORD(ix,x); ix &= 0x7fffffff; - /* x is INF or NaN */ - if(ix>=0x7ff00000) return x*x; - - /* |x| in [0,0.5*ln2], return 1+expm1(|x|)^2/(2*exp(|x|)) */ - if(ix<0x3fd62e43) { - t = __expm1(fabs(x)); - w = one+t; - if (ix<0x3c800000) return w; /* cosh(tiny) = 1 */ - return one+(t*t)/(w+w); - } - - /* |x| in [0.5*ln2,22], return (exp(|x|)+1/exp(|x|)/2; */ + /* |x| in [0,22] */ if (ix < 0x40360000) { + /* |x| in [0,0.5*ln2], return 1+expm1(|x|)^2/(2*exp(|x|)) */ + if(ix<0x3fd62e43) { + t = __expm1(fabs(x)); + w = one+t; + if (ix<0x3c800000) return w; /* cosh(tiny) = 1 */ + return one+(t*t)/(w+w); + } + + /* |x| in [0.5*ln2,22], return (exp(|x|)+1/exp(|x|)/2; */ t = __ieee754_exp(fabs(x)); return half*t+half/t; } @@ -87,6 +77,10 @@ static double one = 1.0, half=0.5, huge = 1.0e300; return t*w; } + /* x is INF or NaN */ + if(ix>=0x7ff00000) return x*x; + /* |x| > overflowthresold, cosh(x) overflow */ return huge*huge; } +strong_alias (__ieee754_cosh, __cosh_finite) diff --git a/sysdeps/ieee754/dbl-64/e_exp2.c b/sysdeps/ieee754/dbl-64/e_exp2.c index ce6368b..674cdb0 100644 --- a/sysdeps/ieee754/dbl-64/e_exp2.c +++ b/sysdeps/ieee754/dbl-64/e_exp2.c @@ -1,5 +1,6 @@ /* Double-precision floating point 2^x. - Copyright (C) 1997,1998,2000,2001,2005,2006 Free Software Foundation, Inc. + Copyright (C) 1997,1998,2000,2001,2005,2006,2011 + Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Geoffrey Keating <geoffk@ozemail.com.au> @@ -133,3 +134,4 @@ __ieee754_exp2 (double x) /* Return x, if x is a NaN or Inf; or overflow, otherwise. */ return TWO1023*x; } +strong_alias (__ieee754_exp2, __exp2_finite) diff --git a/sysdeps/ieee754/dbl-64/e_fmod.c b/sysdeps/ieee754/dbl-64/e_fmod.c index 2ce6135..a575f61 100644 --- a/sysdeps/ieee754/dbl-64/e_fmod.c +++ b/sysdeps/ieee754/dbl-64/e_fmod.c @@ -5,16 +5,12 @@ * * Developed at SunPro, 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. * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: e_fmod.c,v 1.8 1995/05/10 20:45:07 jtc Exp $"; -#endif - -/* +/* * __ieee754_fmod(x,y) * Return x mod y in exact arithmetic * Method: shift and subtract @@ -23,18 +19,10 @@ static char rcsid[] = "$NetBSD: e_fmod.c,v 1.8 1995/05/10 20:45:07 jtc Exp $"; #include "math.h" #include "math_private.h" -#ifdef __STDC__ static const double one = 1.0, Zero[] = {0.0, -0.0,}; -#else -static double one = 1.0, Zero[] = {0.0, -0.0,}; -#endif -#ifdef __STDC__ - double __ieee754_fmod(double x, double y) -#else - double __ieee754_fmod(x,y) - double x,y ; -#endif +double +__ieee754_fmod (double x, double y) { int32_t n,hx,hy,hz,ix,iy,sx,i; u_int32_t lx,ly,lz; @@ -51,7 +39,7 @@ static double one = 1.0, Zero[] = {0.0, -0.0,}; return (x*y)/(x*y); if(hx<=hy) { if((hx<hy)||(lx<ly)) return x; /* |x|<|y| return x */ - if(lx==ly) + if(lx==ly) return Zero[(u_int32_t)sx>>31]; /* |x|=|y| return x*0*/ } @@ -74,25 +62,25 @@ static double one = 1.0, Zero[] = {0.0, -0.0,}; } 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; if(n<=31) { - hx = (hx<<n)|(lx>>(32-n)); - lx <<= n; + hx = (hx<<n)|(lx>>(32-n)); + lx <<= n; } else { hx = lx<<(n-32); lx = 0; } } - if(iy >= -1022) + if(iy >= -1022) hy = 0x00100000|(0x000fffff&hy); else { /* subnormal y, shift y to normal */ n = -1022-iy; if(n<=31) { - hy = (hy<<n)|(ly>>(32-n)); - ly <<= n; + hy = (hy<<n)|(ly>>(32-n)); + ly <<= n; } else { hy = ly<<(n-32); ly = 0; @@ -105,17 +93,17 @@ static double one = 1.0, Zero[] = {0.0, -0.0,}; hz=hx-hy;lz=lx-ly; if(lx<ly) hz -= 1; if(hz<0){hx = hx+hx+(lx>>31); lx = lx+lx;} else { - if((hz|lz)==0) /* return sign(x)*0 */ + if((hz|lz)==0) /* return sign(x)*0 */ return Zero[(u_int32_t)sx>>31]; - hx = hz+hz+(lz>>31); lx = lz+lz; + hx = hz+hz+(lz>>31); lx = lz+lz; } } hz=hx-hy;lz=lx-ly; if(lx<ly) hz -= 1; if(hz>=0) {hx=hz;lx=lz;} /* convert back to floating value and restore the sign */ - if((hx|lx)==0) /* return sign(x)*0 */ - return Zero[(u_int32_t)sx>>31]; + if((hx|lx)==0) /* return sign(x)*0 */ + return Zero[(u_int32_t)sx>>31]; while(hx<0x00100000) { /* normalize x */ hx = hx+hx+(lx>>31); lx = lx+lx; iy -= 1; @@ -138,3 +126,4 @@ static double one = 1.0, Zero[] = {0.0, -0.0,}; } return x; /* exact output */ } +strong_alias (__ieee754_fmod, __fmod_finite) diff --git a/sysdeps/ieee754/dbl-64/e_gamma_r.c b/sysdeps/ieee754/dbl-64/e_gamma_r.c index f323093..c4b7470 100644 --- a/sysdeps/ieee754/dbl-64/e_gamma_r.c +++ b/sysdeps/ieee754/dbl-64/e_gamma_r.c @@ -1,5 +1,5 @@ /* Implementation of gamma function according to ISO C. - Copyright (C) 1997, 1999, 2001, 2004 Free Software Foundation, Inc. + Copyright (C) 1997, 1999, 2001, 2004, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -33,19 +33,20 @@ __ieee754_gamma_r (double x, int *signgamp) EXTRACT_WORDS (hx, lx, x); - if (((hx & 0x7fffffff) | lx) == 0) + if (__builtin_expect (((hx & 0x7fffffff) | lx) == 0, 0)) { /* Return value for x == 0 is Inf with divide by zero exception. */ *signgamp = 0; return 1.0 / x; } - if (hx < 0 && (u_int32_t) hx < 0xfff00000 && __rint (x) == x) + if (__builtin_expect (hx < 0, 0) + && (u_int32_t) hx < 0xfff00000 && __rint (x) == x) { /* Return value for integer x < 0 is NaN with invalid exception. */ *signgamp = 0; return (x - x) / (x - x); } - if ((unsigned int) hx == 0xfff00000 && lx==0) + if (__builtin_expect ((unsigned int) hx == 0xfff00000 && lx==0, 0)) { /* x == -Inf. According to ISO this is NaN. */ *signgamp = 0; @@ -55,3 +56,4 @@ __ieee754_gamma_r (double x, int *signgamp) /* XXX FIXME. */ return __ieee754_exp (__ieee754_lgamma_r (x, signgamp)); } +strong_alias (__ieee754_gamma_r, __gamma_r_finite) diff --git a/sysdeps/ieee754/dbl-64/e_hypot.c b/sysdeps/ieee754/dbl-64/e_hypot.c index 76a77ec..a89ccaa 100644 --- a/sysdeps/ieee754/dbl-64/e_hypot.c +++ b/sysdeps/ieee754/dbl-64/e_hypot.c @@ -10,10 +10,6 @@ * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: e_hypot.c,v 1.9 1995/05/12 04:57:27 jtc Exp $"; -#endif - /* __ieee754_hypot(x,y) * * Method : @@ -42,19 +38,15 @@ static char rcsid[] = "$NetBSD: e_hypot.c,v 1.9 1995/05/12 04:57:27 jtc Exp $"; * hypot(x,y) is NAN if x or y is NAN. * * Accuracy: - * hypot(x,y) returns sqrt(x^2+y^2) with error less - * than 1 ulps (units in the last place) + * hypot(x,y) returns sqrt(x^2+y^2) with error less + * than 1 ulps (units in the last place) */ #include "math.h" #include "math_private.h" -#ifdef __STDC__ - double __ieee754_hypot(double x, double y) -#else - double __ieee754_hypot(x,y) - double x, y; -#endif +double +__ieee754_hypot(double x, double y) { double a,b,t1,t2,y1,y2,w; int32_t j,k,ha,hb; @@ -68,7 +60,7 @@ static char rcsid[] = "$NetBSD: e_hypot.c,v 1.9 1995/05/12 04:57:27 jtc Exp $"; SET_HIGH_WORD(b,hb); /* b <- |b| */ if((ha-hb)>0x3c00000) {return a+b;} /* x/y > 2**60 */ k=0; - if(ha > 0x5f300000) { /* a>2**500 */ + if(__builtin_expect(ha > 0x5f300000, 0)) { /* a>2**500 */ if(ha >= 0x7ff00000) { /* Inf or NaN */ u_int32_t low; w = a+b; /* for sNaN */ @@ -83,9 +75,9 @@ static char rcsid[] = "$NetBSD: e_hypot.c,v 1.9 1995/05/12 04:57:27 jtc Exp $"; SET_HIGH_WORD(a,ha); SET_HIGH_WORD(b,hb); } - if(hb < 0x20b00000) { /* b < 2**-500 */ + if(__builtin_expect(hb < 0x20b00000, 0)) { /* b < 2**-500 */ if(hb <= 0x000fffff) { /* subnormal b or 0 */ - u_int32_t low; + u_int32_t low; GET_LOW_WORD(low,b); if((hb|low)==0) return a; t1=0; @@ -94,7 +86,7 @@ static char rcsid[] = "$NetBSD: e_hypot.c,v 1.9 1995/05/12 04:57:27 jtc Exp $"; a *= t1; k -= 1022; } else { /* scale a and b by 2^600 */ - ha += 0x25800000; /* a *= 2^600 */ + ha += 0x25800000; /* a *= 2^600 */ hb += 0x25800000; /* b *= 2^600 */ k -= 600; SET_HIGH_WORD(a,ha); @@ -126,3 +118,4 @@ static char rcsid[] = "$NetBSD: e_hypot.c,v 1.9 1995/05/12 04:57:27 jtc Exp $"; return t1*w; } else return w; } +strong_alias (__ieee754_hypot, __hypot_finite) diff --git a/sysdeps/ieee754/dbl-64/e_j0.c b/sysdeps/ieee754/dbl-64/e_j0.c index 302df49..5ebf205 100644 --- a/sysdeps/ieee754/dbl-64/e_j0.c +++ b/sysdeps/ieee754/dbl-64/e_j0.c @@ -13,10 +13,6 @@ for performance improvement on pipelined processors. */ -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: e_j0.c,v 1.8 1995/05/10 20:45:23 jtc Exp $"; -#endif - /* __ieee754_j0(x), __ieee754_y0(x) * Bessel function of the first and second kinds of order zero. * Method -- j0(x): @@ -26,16 +22,16 @@ static char rcsid[] = "$NetBSD: e_j0.c,v 1.8 1995/05/10 20:45:23 jtc Exp $"; * j0(x) = 1-z/4+ z^2*R0/S0, where z = x*x; * (precision: |j0-1+z/4-z^2R0/S0 |<2**-63.67 ) * for x in (2,inf) - * j0(x) = sqrt(2/(pi*x))*(p0(x)*cos(x0)-q0(x)*sin(x0)) - * where x0 = x-pi/4. It is better to compute sin(x0),cos(x0) + * j0(x) = sqrt(2/(pi*x))*(p0(x)*cos(x0)-q0(x)*sin(x0)) + * where x0 = x-pi/4. It is better to compute sin(x0),cos(x0) * as follow: * cos(x0) = cos(x)cos(pi/4)+sin(x)sin(pi/4) * = 1/sqrt(2) * (cos(x) + sin(x)) * sin(x0) = sin(x)cos(pi/4)-cos(x)sin(pi/4) * = 1/sqrt(2) * (sin(x) - cos(x)) - * (To avoid cancellation, use + * (To avoid cancellation, use * sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x)) - * to compute the worse one.) + * to compute the worse one.) * * 3 Special cases * j0(nan)= nan @@ -56,8 +52,8 @@ static char rcsid[] = "$NetBSD: e_j0.c,v 1.8 1995/05/10 20:45:23 jtc Exp $"; * Note: For tiny x, U/V = u0 and j0(x)~1, hence * y0(tiny) = u0 + (2/pi)*ln(tiny), (choose tiny<2**-27) * 2. For x>=2. - * y0(x) = sqrt(2/(pi*x))*(p0(x)*cos(x0)+q0(x)*sin(x0)) - * where x0 = x-pi/4. It is better to compute sin(x0),cos(x0) + * y0(x) = sqrt(2/(pi*x))*(p0(x)*cos(x0)+q0(x)*sin(x0)) + * where x0 = x-pi/4. It is better to compute sin(x0),cos(x0) * by the method mentioned above. * 3. Special cases: y0(0)=-inf, y0(x<0)=NaN, y0(inf)=0. */ @@ -65,22 +61,14 @@ static char rcsid[] = "$NetBSD: e_j0.c,v 1.8 1995/05/10 20:45:23 jtc Exp $"; #include "math.h" #include "math_private.h" -#ifdef __STDC__ static double pzero(double), qzero(double); -#else -static double pzero(), qzero(); -#endif -#ifdef __STDC__ static const double -#else -static double -#endif -huge = 1e300, +huge = 1e300, one = 1.0, invsqrtpi= 5.64189583547756279280e-01, /* 0x3FE20DD7, 0x50429B6D */ tpi = 6.36619772367581382433e-01, /* 0x3FE45F30, 0x6DC9C883 */ - /* R0/S0 on [0, 2.00] */ + /* R0/S0 on [0, 2.00] */ R[] = {0.0, 0.0, 1.56249999999999947958e-02, /* 0x3F8FFFFF, 0xFFFFFFFD */ -1.89979294238854721751e-04, /* 0xBF28E6A5, 0xB61AC6E9 */ 1.82954049532700665670e-06, /* 0x3EBEB1D1, 0x0C503919 */ @@ -90,18 +78,10 @@ S[] = {0.0, 1.56191029464890010492e-02, /* 0x3F8FFCE8, 0x82C8C2A4 */ 5.13546550207318111446e-07, /* 0x3EA13B54, 0xCE84D5A9 */ 1.16614003333790000205e-09}; /* 0x3E1408BC, 0xF4745D8F */ -#ifdef __STDC__ static const double zero = 0.0; -#else -static double zero = 0.0; -#endif -#ifdef __STDC__ - double __ieee754_j0(double x) -#else - double __ieee754_j0(x) - double x; -#endif +double +__ieee754_j0(double x) { double z, s,c,ss,cc,r,u,v,r1,r2,s1,s2,z2,z4; int32_t hx,ix; @@ -117,7 +97,7 @@ static double zero = 0.0; if(ix<0x7fe00000) { /* make sure x+x not overflow */ z = -__cos(x+x); if ((s*c)<zero) cc = z/ss; - else ss = z/cc; + else ss = z/cc; } /* * j0(x) = 1/sqrt(pi) * (P(0,x)*cc - Q(0,x)*ss) / sqrt(x) @@ -132,8 +112,8 @@ static double zero = 0.0; } if(ix<0x3f200000) { /* |x| < 2**-13 */ if(huge+x>one) { /* raise inexact if x != 0 */ - if(ix<0x3e400000) return one; /* |x|<2**-27 */ - else return one - 0.25*x*x; + if(ix<0x3e400000) return one; /* |x|<2**-27 */ + else return one - 0.25*x*x; } } z = x*x; @@ -155,12 +135,9 @@ static double zero = 0.0; return((one+u)*(one-u)+z*(r/s)); } } +strong_alias (__ieee754_j0, __j0_finite) -#ifdef __STDC__ static const double -#else -static double -#endif U[] = {-7.38042951086872317523e-02, /* 0xBFB2E4D6, 0x99CBD01F */ 1.76666452509181115538e-01, /* 0x3FC69D01, 0x9DE9E3FC */ -1.38185671945596898896e-02, /* 0xBF8C4CE8, 0xB16CFA97 */ @@ -173,52 +150,48 @@ V[] = {1.27304834834123699328e-02, /* 0x3F8A1270, 0x91C9C71A */ 2.59150851840457805467e-07, /* 0x3E91642D, 0x7FF202FD */ 4.41110311332675467403e-10}; /* 0x3DFE5018, 0x3BD6D9EF */ -#ifdef __STDC__ - double __ieee754_y0(double x) -#else - double __ieee754_y0(x) - double x; -#endif +double +__ieee754_y0(double x) { double z, s,c,ss,cc,u,v,z2,z4,z6,u1,u2,u3,v1,v2; int32_t hx,ix,lx; EXTRACT_WORDS(hx,lx,x); - ix = 0x7fffffff&hx; + ix = 0x7fffffff&hx; /* Y0(NaN) is NaN, y0(-inf) is Nan, y0(inf) is 0, y0(0) is -inf. */ if(ix>=0x7ff00000) return one/(x+x*x); - if((ix|lx)==0) return -HUGE_VAL+x; /* -inf and overflow exception. */ - if(hx<0) return zero/(zero*x); - if(ix >= 0x40000000) { /* |x| >= 2.0 */ - /* y0(x) = sqrt(2/(pi*x))*(p0(x)*sin(x0)+q0(x)*cos(x0)) - * where x0 = x-pi/4 - * Better formula: - * cos(x0) = cos(x)cos(pi/4)+sin(x)sin(pi/4) - * = 1/sqrt(2) * (sin(x) + cos(x)) - * sin(x0) = sin(x)cos(3pi/4)-cos(x)sin(3pi/4) - * = 1/sqrt(2) * (sin(x) - cos(x)) - * To avoid cancellation, use - * sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x)) - * to compute the worse one. - */ + if((ix|lx)==0) return -HUGE_VAL+x; /* -inf and overflow exception. */ + if(hx<0) return zero/(zero*x); + if(ix >= 0x40000000) { /* |x| >= 2.0 */ + /* y0(x) = sqrt(2/(pi*x))*(p0(x)*sin(x0)+q0(x)*cos(x0)) + * where x0 = x-pi/4 + * Better formula: + * cos(x0) = cos(x)cos(pi/4)+sin(x)sin(pi/4) + * = 1/sqrt(2) * (sin(x) + cos(x)) + * sin(x0) = sin(x)cos(3pi/4)-cos(x)sin(3pi/4) + * = 1/sqrt(2) * (sin(x) - cos(x)) + * To avoid cancellation, use + * sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x)) + * to compute the worse one. + */ __sincos (x, &s, &c); - ss = s-c; - cc = s+c; + ss = s-c; + cc = s+c; /* * j0(x) = 1/sqrt(pi) * (P(0,x)*cc - Q(0,x)*ss) / sqrt(x) * y0(x) = 1/sqrt(pi) * (P(0,x)*ss + Q(0,x)*cc) / sqrt(x) */ - if(ix<0x7fe00000) { /* make sure x+x not overflow */ - z = -__cos(x+x); - if ((s*c)<zero) cc = z/ss; - else ss = z/cc; - } - if(ix>0x48000000) z = (invsqrtpi*ss)/__ieee754_sqrt(x); - else { - u = pzero(x); v = qzero(x); - z = invsqrtpi*(u*ss+v*cc)/__ieee754_sqrt(x); - } - return z; + if(ix<0x7fe00000) { /* make sure x+x not overflow */ + z = -__cos(x+x); + if ((s*c)<zero) cc = z/ss; + else ss = z/cc; + } + if(ix>0x48000000) z = (invsqrtpi*ss)/__ieee754_sqrt(x); + else { + u = pzero(x); v = qzero(x); + z = invsqrtpi*(u*ss+v*cc)/__ieee754_sqrt(x); + } + return z; } if(ix<=0x3e400000) { /* x < 2**-27 */ return(U[0] + tpi*__ieee754_log(x)); @@ -238,21 +211,18 @@ V[] = {1.27304834834123699328e-02, /* 0x3F8A1270, 0x91C9C71A */ #endif return(u/v + tpi*(__ieee754_j0(x)*__ieee754_log(x))); } +strong_alias (__ieee754_y0, __y0_finite) /* The asymptotic expansions of pzero is * 1 - 9/128 s^2 + 11025/98304 s^4 - ..., where s = 1/x. * For x >= 2, We approximate pzero by - * pzero(x) = 1 + (R/S) + * pzero(x) = 1 + (R/S) * where R = pR0 + pR1*s^2 + pR2*s^4 + ... + pR5*s^10 - * S = 1 + pS0*s^2 + ... + pS4*s^10 + * S = 1 + pS0*s^2 + ... + pS4*s^10 * and * | pzero(x)-1-R/S | <= 2 ** ( -60.26) */ -#ifdef __STDC__ static const double pR8[6] = { /* for x in [inf, 8]=1/[0,0.125] */ -#else -static double pR8[6] = { /* for x in [inf, 8]=1/[0,0.125] */ -#endif 0.00000000000000000000e+00, /* 0x00000000, 0x00000000 */ -7.03124999999900357484e-02, /* 0xBFB1FFFF, 0xFFFFFD32 */ -8.08167041275349795626e+00, /* 0xC02029D0, 0xB44FA779 */ @@ -260,11 +230,7 @@ static double pR8[6] = { /* for x in [inf, 8]=1/[0,0.125] */ -2.48521641009428822144e+03, /* 0xC0A36A6E, 0xCD4DCAFC */ -5.25304380490729545272e+03, /* 0xC0B4850B, 0x36CC643D */ }; -#ifdef __STDC__ static const double pS8[5] = { -#else -static double pS8[5] = { -#endif 1.16534364619668181717e+02, /* 0x405D2233, 0x07A96751 */ 3.83374475364121826715e+03, /* 0x40ADF37D, 0x50596938 */ 4.05978572648472545552e+04, /* 0x40E3D2BB, 0x6EB6B05F */ @@ -272,11 +238,7 @@ static double pS8[5] = { 4.76277284146730962675e+04, /* 0x40E74177, 0x4F2C49DC */ }; -#ifdef __STDC__ static const double pR5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */ -#else -static double pR5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */ -#endif -1.14125464691894502584e-11, /* 0xBDA918B1, 0x47E495CC */ -7.03124940873599280078e-02, /* 0xBFB1FFFF, 0xE69AFBC6 */ -4.15961064470587782438e+00, /* 0xC010A370, 0xF90C6BBF */ @@ -284,11 +246,7 @@ static double pR5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */ -3.31231299649172967747e+02, /* 0xC074B3B3, 0x6742CC63 */ -3.46433388365604912451e+02, /* 0xC075A6EF, 0x28A38BD7 */ }; -#ifdef __STDC__ static const double pS5[5] = { -#else -static double pS5[5] = { -#endif 6.07539382692300335975e+01, /* 0x404E6081, 0x0C98C5DE */ 1.05125230595704579173e+03, /* 0x40906D02, 0x5C7E2864 */ 5.97897094333855784498e+03, /* 0x40B75AF8, 0x8FBE1D60 */ @@ -296,11 +254,7 @@ static double pS5[5] = { 2.40605815922939109441e+03, /* 0x40A2CC1D, 0xC70BE864 */ }; -#ifdef __STDC__ static const double pR3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */ -#else -static double pR3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */ -#endif -2.54704601771951915620e-09, /* 0xBE25E103, 0x6FE1AA86 */ -7.03119616381481654654e-02, /* 0xBFB1FFF6, 0xF7C0E24B */ -2.40903221549529611423e+00, /* 0xC00345B2, 0xAEA48074 */ @@ -308,11 +262,7 @@ static double pR3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */ -5.80791704701737572236e+01, /* 0xC04D0A22, 0x420A1A45 */ -3.14479470594888503854e+01, /* 0xC03F72AC, 0xA892D80F */ }; -#ifdef __STDC__ static const double pS3[5] = { -#else -static double pS3[5] = { -#endif 3.58560338055209726349e+01, /* 0x4041ED92, 0x84077DD3 */ 3.61513983050303863820e+02, /* 0x40769839, 0x464A7C0E */ 1.19360783792111533330e+03, /* 0x4092A66E, 0x6D1061D6 */ @@ -320,11 +270,7 @@ static double pS3[5] = { 1.73580930813335754692e+02, /* 0x4065B296, 0xFC379081 */ }; -#ifdef __STDC__ static const double pR2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */ -#else -static double pR2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */ -#endif -8.87534333032526411254e-08, /* 0xBE77D316, 0xE927026D */ -7.03030995483624743247e-02, /* 0xBFB1FF62, 0x495E1E42 */ -1.45073846780952986357e+00, /* 0xBFF73639, 0x8A24A843 */ @@ -332,11 +278,7 @@ static double pR2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */ -1.11931668860356747786e+01, /* 0xC02662E6, 0xC5246303 */ -3.23364579351335335033e+00, /* 0xC009DE81, 0xAF8FE70F */ }; -#ifdef __STDC__ static const double pS2[5] = { -#else -static double pS2[5] = { -#endif 2.22202997532088808441e+01, /* 0x40363865, 0x908B5959 */ 1.36206794218215208048e+02, /* 0x4061069E, 0x0EE8878F */ 2.70470278658083486789e+02, /* 0x4070E786, 0x42EA079B */ @@ -344,18 +286,10 @@ static double pS2[5] = { 1.46576176948256193810e+01, /* 0x402D50B3, 0x44391809 */ }; -#ifdef __STDC__ - static double pzero(double x) -#else - static double pzero(x) - double x; -#endif +static double +pzero(double x) { -#ifdef __STDC__ const double *p,*q; -#else - double *p,*q; -#endif double z,r,s,z2,z4,r1,r2,r3,s1,s2,s3; int32_t ix; GET_HIGH_WORD(ix,x); @@ -385,17 +319,13 @@ static double pS2[5] = { /* For x >= 8, the asymptotic expansions of qzero is * -1/8 s + 75/1024 s^3 - ..., where s = 1/x. * We approximate pzero by - * qzero(x) = s*(-1.25 + (R/S)) + * qzero(x) = s*(-1.25 + (R/S)) * where R = qR0 + qR1*s^2 + qR2*s^4 + ... + qR5*s^10 - * S = 1 + qS0*s^2 + ... + qS5*s^12 + * S = 1 + qS0*s^2 + ... + qS5*s^12 * and * | qzero(x)/s +1.25-R/S | <= 2 ** ( -61.22) */ -#ifdef __STDC__ static const double qR8[6] = { /* for x in [inf, 8]=1/[0,0.125] */ -#else -static double qR8[6] = { /* for x in [inf, 8]=1/[0,0.125] */ -#endif 0.00000000000000000000e+00, /* 0x00000000, 0x00000000 */ 7.32421874999935051953e-02, /* 0x3FB2BFFF, 0xFFFFFE2C */ 1.17682064682252693899e+01, /* 0x40278952, 0x5BB334D6 */ @@ -403,11 +333,7 @@ static double qR8[6] = { /* for x in [inf, 8]=1/[0,0.125] */ 8.85919720756468632317e+03, /* 0x40C14D99, 0x3E18F46D */ 3.70146267776887834771e+04, /* 0x40E212D4, 0x0E901566 */ }; -#ifdef __STDC__ static const double qS8[6] = { -#else -static double qS8[6] = { -#endif 1.63776026895689824414e+02, /* 0x406478D5, 0x365B39BC */ 8.09834494656449805916e+03, /* 0x40BFA258, 0x4E6B0563 */ 1.42538291419120476348e+05, /* 0x41016652, 0x54D38C3F */ @@ -416,11 +342,7 @@ static double qS8[6] = { -3.43899293537866615225e+05, /* 0xC114FD6D, 0x2C9530C5 */ }; -#ifdef __STDC__ static const double qR5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */ -#else -static double qR5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */ -#endif 1.84085963594515531381e-11, /* 0x3DB43D8F, 0x29CC8CD9 */ 7.32421766612684765896e-02, /* 0x3FB2BFFF, 0xD172B04C */ 5.83563508962056953777e+00, /* 0x401757B0, 0xB9953DD3 */ @@ -428,11 +350,7 @@ static double qR5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */ 1.02724376596164097464e+03, /* 0x40900CF9, 0x9DC8C481 */ 1.98997785864605384631e+03, /* 0x409F17E9, 0x53C6E3A6 */ }; -#ifdef __STDC__ static const double qS5[6] = { -#else -static double qS5[6] = { -#endif 8.27766102236537761883e+01, /* 0x4054B1B3, 0xFB5E1543 */ 2.07781416421392987104e+03, /* 0x40A03BA0, 0xDA21C0CE */ 1.88472887785718085070e+04, /* 0x40D267D2, 0x7B591E6D */ @@ -441,11 +359,7 @@ static double qS5[6] = { -5.35434275601944773371e+03, /* 0xC0B4EA57, 0xBEDBC609 */ }; -#ifdef __STDC__ static const double qR3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */ -#else -static double qR3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */ -#endif 4.37741014089738620906e-09, /* 0x3E32CD03, 0x6ADECB82 */ 7.32411180042911447163e-02, /* 0x3FB2BFEE, 0x0E8D0842 */ 3.34423137516170720929e+00, /* 0x400AC0FC, 0x61149CF5 */ @@ -453,11 +367,7 @@ static double qR3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */ 1.70808091340565596283e+02, /* 0x406559DB, 0xE25EFD1F */ 1.66733948696651168575e+02, /* 0x4064D77C, 0x81FA21E0 */ }; -#ifdef __STDC__ static const double qS3[6] = { -#else -static double qS3[6] = { -#endif 4.87588729724587182091e+01, /* 0x40486122, 0xBFE343A6 */ 7.09689221056606015736e+02, /* 0x40862D83, 0x86544EB3 */ 3.70414822620111362994e+03, /* 0x40ACF04B, 0xE44DFC63 */ @@ -466,11 +376,7 @@ static double qS3[6] = { -1.49247451836156386662e+02, /* 0xC062A7EB, 0x201CF40F */ }; -#ifdef __STDC__ static const double qR2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */ -#else -static double qR2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */ -#endif 1.50444444886983272379e-07, /* 0x3E84313B, 0x54F76BDB */ 7.32234265963079278272e-02, /* 0x3FB2BEC5, 0x3E883E34 */ 1.99819174093815998816e+00, /* 0x3FFFF897, 0xE727779C */ @@ -478,11 +384,7 @@ static double qR2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */ 3.16662317504781540833e+01, /* 0x403FAA8E, 0x29FBDC4A */ 1.62527075710929267416e+01, /* 0x403040B1, 0x71814BB4 */ }; -#ifdef __STDC__ static const double qS2[6] = { -#else -static double qS2[6] = { -#endif 3.03655848355219184498e+01, /* 0x403E5D96, 0xF7C07AED */ 2.69348118608049844624e+02, /* 0x4070D591, 0xE4D14B40 */ 8.44783757595320139444e+02, /* 0x408A6645, 0x22B3BF22 */ @@ -491,18 +393,10 @@ static double qS2[6] = { -5.31095493882666946917e+00, /* 0xC0153E6A, 0xF8B32931 */ }; -#ifdef __STDC__ - static double qzero(double x) -#else - static double qzero(x) - double x; -#endif +static double +qzero(double x) { -#ifdef __STDC__ const double *p,*q; -#else - double *p,*q; -#endif double s,r,z,z2,z4,z6,r1,r2,r3,s1,s2,s3; int32_t ix; GET_HIGH_WORD(ix,x); diff --git a/sysdeps/ieee754/dbl-64/e_j1.c b/sysdeps/ieee754/dbl-64/e_j1.c index 8a3b2ff..fdc6b5b 100644 --- a/sysdeps/ieee754/dbl-64/e_j1.c +++ b/sysdeps/ieee754/dbl-64/e_j1.c @@ -13,10 +13,6 @@ for performance improvement on pipelined processors. */ -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: e_j1.c,v 1.8 1995/05/10 20:45:27 jtc Exp $"; -#endif - /* __ieee754_j1(x), __ieee754_y1(x) * Bessel function of the first and second kinds of order zero. * Method -- j1(x): @@ -26,17 +22,17 @@ static char rcsid[] = "$NetBSD: e_j1.c,v 1.8 1995/05/10 20:45:27 jtc Exp $"; * j1(x) = x/2 + x*z*R0/S0, where z = x*x; * (precision: |j1/x - 1/2 - R0/S0 |<2**-61.51 ) * for x in (2,inf) - * j1(x) = sqrt(2/(pi*x))*(p1(x)*cos(x1)-q1(x)*sin(x1)) - * y1(x) = sqrt(2/(pi*x))*(p1(x)*sin(x1)+q1(x)*cos(x1)) - * where x1 = x-3*pi/4. It is better to compute sin(x1),cos(x1) + * j1(x) = sqrt(2/(pi*x))*(p1(x)*cos(x1)-q1(x)*sin(x1)) + * y1(x) = sqrt(2/(pi*x))*(p1(x)*sin(x1)+q1(x)*cos(x1)) + * where x1 = x-3*pi/4. It is better to compute sin(x1),cos(x1) * as follow: * cos(x1) = cos(x)cos(3pi/4)+sin(x)sin(3pi/4) * = 1/sqrt(2) * (sin(x) - cos(x)) * sin(x1) = sin(x)cos(3pi/4)-cos(x)sin(3pi/4) * = -1/sqrt(2) * (sin(x) + cos(x)) - * (To avoid cancellation, use + * (To avoid cancellation, use * sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x)) - * to compute the worse one.) + * to compute the worse one.) * * 3 Special cases * j1(nan)= nan @@ -57,25 +53,17 @@ static char rcsid[] = "$NetBSD: e_j1.c,v 1.8 1995/05/10 20:45:27 jtc Exp $"; * Note: For tiny x, 1/x dominate y1 and hence * y1(tiny) = -2/pi/tiny, (choose tiny<2**-54) * 3. For x>=2. - * y1(x) = sqrt(2/(pi*x))*(p1(x)*sin(x1)+q1(x)*cos(x1)) - * where x1 = x-3*pi/4. It is better to compute sin(x1),cos(x1) + * y1(x) = sqrt(2/(pi*x))*(p1(x)*sin(x1)+q1(x)*cos(x1)) + * where x1 = x-3*pi/4. It is better to compute sin(x1),cos(x1) * by method mentioned above. */ #include "math.h" #include "math_private.h" -#ifdef __STDC__ static double pone(double), qone(double); -#else -static double pone(), qone(); -#endif -#ifdef __STDC__ static const double -#else -static double -#endif huge = 1e300, one = 1.0, invsqrtpi= 5.64189583547756279280e-01, /* 0x3FE20DD7, 0x50429B6D */ @@ -91,25 +79,17 @@ S[] = {0.0, 1.91537599538363460805e-02, /* 0x3F939D0B, 0x12637E53 */ 5.04636257076217042715e-09, /* 0x3E35AC88, 0xC97DFF2C */ 1.23542274426137913908e-11}; /* 0x3DAB2ACF, 0xCFB97ED8 */ -#ifdef __STDC__ static const double zero = 0.0; -#else -static double zero = 0.0; -#endif -#ifdef __STDC__ - double __ieee754_j1(double x) -#else - double __ieee754_j1(x) - double x; -#endif +double +__ieee754_j1(double x) { double z, s,c,ss,cc,r,u,v,y,r1,r2,s1,s2,s3,z2,z4; int32_t hx,ix; GET_HIGH_WORD(hx,x); ix = hx&0x7fffffff; - if(ix>=0x7ff00000) return one/x; + if(__builtin_expect(ix>=0x7ff00000, 0)) return one/x; y = fabs(x); if(ix >= 0x40000000) { /* |x| >= 2.0 */ __sincos (y, &s, &c); @@ -118,7 +98,7 @@ static double zero = 0.0; if(ix<0x7fe00000) { /* make sure y+y not overflow */ z = __cos(y+y); if ((s*c)>zero) cc = z/ss; - else ss = z/cc; + else ss = z/cc; } /* * j1(x) = 1/sqrt(pi) * (P(1,x)*cc - Q(1,x)*ss) / sqrt(x) @@ -130,9 +110,9 @@ static double zero = 0.0; z = invsqrtpi*(u*cc-v*ss)/__ieee754_sqrt(y); } if(hx<0) return -z; - else return z; + else return z; } - if(ix<0x3e400000) { /* |x|<2**-27 */ + if(__builtin_expect(ix<0x3e400000, 0)) { /* |x|<2**-27 */ if(huge+x>one) return 0.5*x;/* inexact if x!=0 necessary */ } z = x*x; @@ -144,7 +124,7 @@ static double zero = 0.0; r1 = z*R[0]; z2=z*z; r2 = R[1]+z*R[2]; z4=z2*z2; r = r1 + z2*r2 + z4*R[3]; - r *= x; + r *= x; s1 = one+z*S[1]; s2 = S[2]+z*S[3]; s3 = S[4]+z*S[5]; @@ -152,23 +132,16 @@ static double zero = 0.0; #endif return(x*0.5+r/s); } +strong_alias (__ieee754_j1, __j1_finite) -#ifdef __STDC__ static const double U0[5] = { -#else -static double U0[5] = { -#endif -1.96057090646238940668e-01, /* 0xBFC91866, 0x143CBC8A */ 5.04438716639811282616e-02, /* 0x3FA9D3C7, 0x76292CD1 */ -1.91256895875763547298e-03, /* 0xBF5F55E5, 0x4844F50F */ 2.35252600561610495928e-05, /* 0x3EF8AB03, 0x8FA6B88E */ -9.19099158039878874504e-08, /* 0xBE78AC00, 0x569105B8 */ }; -#ifdef __STDC__ static const double V0[5] = { -#else -static double V0[5] = { -#endif 1.99167318236649903973e-02, /* 0x3F94650D, 0x3F4DA9F0 */ 2.02552581025135171496e-04, /* 0x3F2A8C89, 0x6C257764 */ 1.35608801097516229404e-06, /* 0x3EB6C05A, 0x894E8CA6 */ @@ -176,56 +149,53 @@ static double V0[5] = { 1.66559246207992079114e-11, /* 0x3DB25039, 0xDACA772A */ }; -#ifdef __STDC__ - double __ieee754_y1(double x) -#else - double __ieee754_y1(x) - double x; -#endif +double +__ieee754_y1(double x) { double z, s,c,ss,cc,u,v,u1,u2,v1,v2,v3,z2,z4; int32_t hx,ix,lx; EXTRACT_WORDS(hx,lx,x); - ix = 0x7fffffff&hx; + ix = 0x7fffffff&hx; /* if Y1(NaN) is NaN, Y1(-inf) is NaN, Y1(inf) is 0 */ - if(ix>=0x7ff00000) return one/(x+x*x); - if((ix|lx)==0) return -HUGE_VAL+x; /* -inf and overflow exception. */; - if(hx<0) return zero/(zero*x); - if(ix >= 0x40000000) { /* |x| >= 2.0 */ + if(__builtin_expect(ix>=0x7ff00000, 0)) return one/(x+x*x); + if(__builtin_expect((ix|lx)==0, 0)) + return -HUGE_VAL+x; /* -inf and overflow exception. */; + if(__builtin_expect(hx<0, 0)) return zero/(zero*x); + if(ix >= 0x40000000) { /* |x| >= 2.0 */ __sincos (x, &s, &c); - ss = -s-c; - cc = s-c; - if(ix<0x7fe00000) { /* make sure x+x not overflow */ - z = __cos(x+x); - if ((s*c)>zero) cc = z/ss; - else ss = z/cc; - } - /* y1(x) = sqrt(2/(pi*x))*(p1(x)*sin(x0)+q1(x)*cos(x0)) - * where x0 = x-3pi/4 - * Better formula: - * cos(x0) = cos(x)cos(3pi/4)+sin(x)sin(3pi/4) - * = 1/sqrt(2) * (sin(x) - cos(x)) - * sin(x0) = sin(x)cos(3pi/4)-cos(x)sin(3pi/4) - * = -1/sqrt(2) * (cos(x) + sin(x)) - * To avoid cancellation, use - * sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x)) - * to compute the worse one. - */ - if(ix>0x48000000) z = (invsqrtpi*ss)/__ieee754_sqrt(x); - else { - u = pone(x); v = qone(x); - z = invsqrtpi*(u*ss+v*cc)/__ieee754_sqrt(x); - } - return z; - } - if(ix<=0x3c900000) { /* x < 2**-54 */ - return(-tpi/x); - } - z = x*x; + ss = -s-c; + cc = s-c; + if(ix<0x7fe00000) { /* make sure x+x not overflow */ + z = __cos(x+x); + if ((s*c)>zero) cc = z/ss; + else ss = z/cc; + } + /* y1(x) = sqrt(2/(pi*x))*(p1(x)*sin(x0)+q1(x)*cos(x0)) + * where x0 = x-3pi/4 + * Better formula: + * cos(x0) = cos(x)cos(3pi/4)+sin(x)sin(3pi/4) + * = 1/sqrt(2) * (sin(x) - cos(x)) + * sin(x0) = sin(x)cos(3pi/4)-cos(x)sin(3pi/4) + * = -1/sqrt(2) * (cos(x) + sin(x)) + * To avoid cancellation, use + * sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x)) + * to compute the worse one. + */ + if(ix>0x48000000) z = (invsqrtpi*ss)/__ieee754_sqrt(x); + else { + u = pone(x); v = qone(x); + z = invsqrtpi*(u*ss+v*cc)/__ieee754_sqrt(x); + } + return z; + } + if(__builtin_expect(ix<=0x3c900000, 0)) { /* x < 2**-54 */ + return(-tpi/x); + } + z = x*x; #ifdef DO_NOT_USE_THIS - u = U0[0]+z*(U0[1]+z*(U0[2]+z*(U0[3]+z*U0[4]))); - v = one+z*(V0[0]+z*(V0[1]+z*(V0[2]+z*(V0[3]+z*V0[4])))); + u = U0[0]+z*(U0[1]+z*(U0[2]+z*(U0[3]+z*U0[4]))); + v = one+z*(V0[0]+z*(V0[1]+z*(V0[2]+z*(V0[3]+z*V0[4])))); #else u1 = U0[0]+z*U0[1];z2=z*z; u2 = U0[2]+z*U0[3];z4=z2*z2; @@ -235,24 +205,21 @@ static double V0[5] = { v3 = V0[3]+z*V0[4]; v = v1 + z2*v2 + z4*v3; #endif - return(x*(u/v) + tpi*(__ieee754_j1(x)*__ieee754_log(x)-one/x)); + return(x*(u/v) + tpi*(__ieee754_j1(x)*__ieee754_log(x)-one/x)); } +strong_alias (__ieee754_y1, __y1_finite) /* For x >= 8, the asymptotic expansions of pone is * 1 + 15/128 s^2 - 4725/2^15 s^4 - ..., where s = 1/x. * We approximate pone by - * pone(x) = 1 + (R/S) + * pone(x) = 1 + (R/S) * where R = pr0 + pr1*s^2 + pr2*s^4 + ... + pr5*s^10 - * S = 1 + ps0*s^2 + ... + ps4*s^10 + * S = 1 + ps0*s^2 + ... + ps4*s^10 * and * | pone(x)-1-R/S | <= 2 ** ( -60.06) */ -#ifdef __STDC__ static const double pr8[6] = { /* for x in [inf, 8]=1/[0,0.125] */ -#else -static double pr8[6] = { /* for x in [inf, 8]=1/[0,0.125] */ -#endif 0.00000000000000000000e+00, /* 0x00000000, 0x00000000 */ 1.17187499999988647970e-01, /* 0x3FBDFFFF, 0xFFFFFCCE */ 1.32394806593073575129e+01, /* 0x402A7A9D, 0x357F7FCE */ @@ -260,11 +227,7 @@ static double pr8[6] = { /* for x in [inf, 8]=1/[0,0.125] */ 3.87474538913960532227e+03, /* 0x40AE457D, 0xA3A532CC */ 7.91447954031891731574e+03, /* 0x40BEEA7A, 0xC32782DD */ }; -#ifdef __STDC__ static const double ps8[5] = { -#else -static double ps8[5] = { -#endif 1.14207370375678408436e+02, /* 0x405C8D45, 0x8E656CAC */ 3.65093083420853463394e+03, /* 0x40AC85DC, 0x964D274F */ 3.69562060269033463555e+04, /* 0x40E20B86, 0x97C5BB7F */ @@ -272,11 +235,7 @@ static double ps8[5] = { 3.08042720627888811578e+04, /* 0x40DE1511, 0x697A0B2D */ }; -#ifdef __STDC__ static const double pr5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */ -#else -static double pr5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */ -#endif 1.31990519556243522749e-11, /* 0x3DAD0667, 0xDAE1CA7D */ 1.17187493190614097638e-01, /* 0x3FBDFFFF, 0xE2C10043 */ 6.80275127868432871736e+00, /* 0x401B3604, 0x6E6315E3 */ @@ -284,11 +243,7 @@ static double pr5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */ 5.17636139533199752805e+02, /* 0x40802D16, 0xD052D649 */ 5.28715201363337541807e+02, /* 0x408085B8, 0xBB7E0CB7 */ }; -#ifdef __STDC__ static const double ps5[5] = { -#else -static double ps5[5] = { -#endif 5.92805987221131331921e+01, /* 0x404DA3EA, 0xA8AF633D */ 9.91401418733614377743e+02, /* 0x408EFB36, 0x1B066701 */ 5.35326695291487976647e+03, /* 0x40B4E944, 0x5706B6FB */ @@ -296,11 +251,7 @@ static double ps5[5] = { 1.50404688810361062679e+03, /* 0x40978030, 0x036F5E51 */ }; -#ifdef __STDC__ static const double pr3[6] = { -#else -static double pr3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */ -#endif 3.02503916137373618024e-09, /* 0x3E29FC21, 0xA7AD9EDD */ 1.17186865567253592491e-01, /* 0x3FBDFFF5, 0x5B21D17B */ 3.93297750033315640650e+00, /* 0x400F76BC, 0xE85EAD8A */ @@ -308,11 +259,7 @@ static double pr3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */ 9.10550110750781271918e+01, /* 0x4056C385, 0x4D2C1837 */ 4.85590685197364919645e+01, /* 0x4048478F, 0x8EA83EE5 */ }; -#ifdef __STDC__ static const double ps3[5] = { -#else -static double ps3[5] = { -#endif 3.47913095001251519989e+01, /* 0x40416549, 0xA134069C */ 3.36762458747825746741e+02, /* 0x40750C33, 0x07F1A75F */ 1.04687139975775130551e+03, /* 0x40905B7C, 0x5037D523 */ @@ -320,11 +267,7 @@ static double ps3[5] = { 1.03787932439639277504e+02, /* 0x4059F26D, 0x7C2EED53 */ }; -#ifdef __STDC__ static const double pr2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */ -#else -static double pr2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */ -#endif 1.07710830106873743082e-07, /* 0x3E7CE9D4, 0xF65544F4 */ 1.17176219462683348094e-01, /* 0x3FBDFF42, 0xBE760D83 */ 2.36851496667608785174e+00, /* 0x4002F2B7, 0xF98FAEC0 */ @@ -332,11 +275,7 @@ static double pr2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */ 1.76939711271687727390e+01, /* 0x4031B1A8, 0x177F8EE2 */ 5.07352312588818499250e+00, /* 0x40144B49, 0xA574C1FE */ }; -#ifdef __STDC__ static const double ps2[5] = { -#else -static double ps2[5] = { -#endif 2.14364859363821409488e+01, /* 0x40356FBD, 0x8AD5ECDC */ 1.25290227168402751090e+02, /* 0x405F5293, 0x14F92CD5 */ 2.32276469057162813669e+02, /* 0x406D08D8, 0xD5A2DBD9 */ @@ -344,30 +283,22 @@ static double ps2[5] = { 8.36463893371618283368e+00, /* 0x4020BAB1, 0xF44E5192 */ }; -#ifdef __STDC__ - static double pone(double x) -#else - static double pone(x) - double x; -#endif +static double +pone(double x) { -#ifdef __STDC__ const double *p,*q; -#else - double *p,*q; -#endif double z,r,s,r1,r2,r3,s1,s2,s3,z2,z4; - int32_t ix; + int32_t ix; GET_HIGH_WORD(ix,x); ix &= 0x7fffffff; - if(ix>=0x40200000) {p = pr8; q= ps8;} - else if(ix>=0x40122E8B){p = pr5; q= ps5;} - else if(ix>=0x4006DB6D){p = pr3; q= ps3;} - else if(ix>=0x40000000){p = pr2; q= ps2;} - z = one/(x*x); + if(ix>=0x40200000) {p = pr8; q= ps8;} + else if(ix>=0x40122E8B){p = pr5; q= ps5;} + else if(ix>=0x4006DB6D){p = pr3; q= ps3;} + else if(ix>=0x40000000){p = pr2; q= ps2;} + z = one/(x*x); #ifdef DO_NOT_USE_THIS - r = p[0]+z*(p[1]+z*(p[2]+z*(p[3]+z*(p[4]+z*p[5])))); - s = one+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*q[4])))); + r = p[0]+z*(p[1]+z*(p[2]+z*(p[3]+z*(p[4]+z*p[5])))); + s = one+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*q[4])))); #else r1 = p[0]+z*p[1]; z2=z*z; r2 = p[2]+z*p[3]; z4=z2*z2; @@ -378,25 +309,21 @@ static double ps2[5] = { s3 = q[3]+z*q[4]; s = s1 + z2*s2 + z4*s3; #endif - return one+ r/s; + return one+ r/s; } /* For x >= 8, the asymptotic expansions of qone is * 3/8 s - 105/1024 s^3 - ..., where s = 1/x. * We approximate pone by - * qone(x) = s*(0.375 + (R/S)) + * qone(x) = s*(0.375 + (R/S)) * where R = qr1*s^2 + qr2*s^4 + ... + qr5*s^10 - * S = 1 + qs1*s^2 + ... + qs6*s^12 + * S = 1 + qs1*s^2 + ... + qs6*s^12 * and * | qone(x)/s -0.375-R/S | <= 2 ** ( -61.13) */ -#ifdef __STDC__ static const double qr8[6] = { /* for x in [inf, 8]=1/[0,0.125] */ -#else -static double qr8[6] = { /* for x in [inf, 8]=1/[0,0.125] */ -#endif 0.00000000000000000000e+00, /* 0x00000000, 0x00000000 */ -1.02539062499992714161e-01, /* 0xBFBA3FFF, 0xFFFFFDF3 */ -1.62717534544589987888e+01, /* 0xC0304591, 0xA26779F7 */ @@ -404,11 +331,7 @@ static double qr8[6] = { /* for x in [inf, 8]=1/[0,0.125] */ -1.18498066702429587167e+04, /* 0xC0C724E7, 0x40F87415 */ -4.84385124285750353010e+04, /* 0xC0E7A6D0, 0x65D09C6A */ }; -#ifdef __STDC__ static const double qs8[6] = { -#else -static double qs8[6] = { -#endif 1.61395369700722909556e+02, /* 0x40642CA6, 0xDE5BCDE5 */ 7.82538599923348465381e+03, /* 0x40BE9162, 0xD0D88419 */ 1.33875336287249578163e+05, /* 0x4100579A, 0xB0B75E98 */ @@ -417,11 +340,7 @@ static double qs8[6] = { -2.94490264303834643215e+05, /* 0xC111F969, 0x0EA5AA18 */ }; -#ifdef __STDC__ static const double qr5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */ -#else -static double qr5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */ -#endif -2.08979931141764104297e-11, /* 0xBDB6FA43, 0x1AA1A098 */ -1.02539050241375426231e-01, /* 0xBFBA3FFF, 0xCB597FEF */ -8.05644828123936029840e+00, /* 0xC0201CE6, 0xCA03AD4B */ @@ -429,11 +348,7 @@ static double qr5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */ -1.37319376065508163265e+03, /* 0xC09574C6, 0x6931734F */ -2.61244440453215656817e+03, /* 0xC0A468E3, 0x88FDA79D */ }; -#ifdef __STDC__ static const double qs5[6] = { -#else -static double qs5[6] = { -#endif 8.12765501384335777857e+01, /* 0x405451B2, 0xFF5A11B2 */ 1.99179873460485964642e+03, /* 0x409F1F31, 0xE77BF839 */ 1.74684851924908907677e+04, /* 0x40D10F1F, 0x0D64CE29 */ @@ -442,11 +357,7 @@ static double qs5[6] = { -4.71918354795128470869e+03, /* 0xC0B26F2E, 0xFCFFA004 */ }; -#ifdef __STDC__ static const double qr3[6] = { -#else -static double qr3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */ -#endif -5.07831226461766561369e-09, /* 0xBE35CFA9, 0xD38FC84F */ -1.02537829820837089745e-01, /* 0xBFBA3FEB, 0x51AEED54 */ -4.61011581139473403113e+00, /* 0xC01270C2, 0x3302D9FF */ @@ -454,11 +365,7 @@ static double qr3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */ -2.28244540737631695038e+02, /* 0xC06C87D3, 0x4718D55F */ -2.19210128478909325622e+02, /* 0xC06B66B9, 0x5F5C1BF6 */ }; -#ifdef __STDC__ static const double qs3[6] = { -#else -static double qs3[6] = { -#endif 4.76651550323729509273e+01, /* 0x4047D523, 0xCCD367E4 */ 6.73865112676699709482e+02, /* 0x40850EEB, 0xC031EE3E */ 3.38015286679526343505e+03, /* 0x40AA684E, 0x448E7C9A */ @@ -467,11 +374,7 @@ static double qs3[6] = { -1.35201191444307340817e+02, /* 0xC060E670, 0x290A311F */ }; -#ifdef __STDC__ static const double qr2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */ -#else -static double qr2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */ -#endif -1.78381727510958865572e-07, /* 0xBE87F126, 0x44C626D2 */ -1.02517042607985553460e-01, /* 0xBFBA3E8E, 0x9148B010 */ -2.75220568278187460720e+00, /* 0xC0060484, 0x69BB4EDA */ @@ -479,11 +382,7 @@ static double qr2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */ -4.23253133372830490089e+01, /* 0xC04529A3, 0xDE104AAA */ -2.13719211703704061733e+01, /* 0xC0355F36, 0x39CF6E52 */ }; -#ifdef __STDC__ static const double qs2[6] = { -#else -static double qs2[6] = { -#endif 2.95333629060523854548e+01, /* 0x403D888A, 0x78AE64FF */ 2.52981549982190529136e+02, /* 0x406F9F68, 0xDB821CBA */ 7.57502834868645436472e+02, /* 0x4087AC05, 0xCE49A0F7 */ @@ -492,18 +391,10 @@ static double qs2[6] = { -4.95949898822628210127e+00, /* 0xC013D686, 0xE71BE86B */ }; -#ifdef __STDC__ - static double qone(double x) -#else - static double qone(x) - double x; -#endif +static double +qone(double x) { -#ifdef __STDC__ const double *p,*q; -#else - double *p,*q; -#endif double s,r,z,r1,r2,r3,s1,s2,s3,z2,z4,z6; int32_t ix; GET_HIGH_WORD(ix,x); diff --git a/sysdeps/ieee754/dbl-64/e_jn.c b/sysdeps/ieee754/dbl-64/e_jn.c index d9d6f91..f8b8e2e 100644 --- a/sysdeps/ieee754/dbl-64/e_jn.c +++ b/sysdeps/ieee754/dbl-64/e_jn.c @@ -10,10 +10,6 @@ * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: e_jn.c,v 1.9 1995/05/10 20:45:34 jtc Exp $"; -#endif - /* * __ieee754_jn(n, x), __ieee754_yn(n, x) * floating point Bessel's function of the 1st and 2nd kind @@ -43,27 +39,15 @@ static char rcsid[] = "$NetBSD: e_jn.c,v 1.9 1995/05/10 20:45:34 jtc Exp $"; #include "math.h" #include "math_private.h" -#ifdef __STDC__ static const double -#else -static double -#endif invsqrtpi= 5.64189583547756279280e-01, /* 0x3FE20DD7, 0x50429B6D */ two = 2.00000000000000000000e+00, /* 0x40000000, 0x00000000 */ one = 1.00000000000000000000e+00; /* 0x3FF00000, 0x00000000 */ -#ifdef __STDC__ static const double zero = 0.00000000000000000000e+00; -#else -static double zero = 0.00000000000000000000e+00; -#endif -#ifdef __STDC__ - double __ieee754_jn(int n, double x) -#else - double __ieee754_jn(n,x) - int n; double x; -#endif +double +__ieee754_jn(int n, double x) { int32_t i,hx,ix,lx, sgn; double a, b, temp, di; @@ -75,7 +59,8 @@ static double zero = 0.00000000000000000000e+00; EXTRACT_WORDS(hx,lx,x); ix = 0x7fffffff&hx; /* if J(n,NaN) is NaN */ - if((ix|((u_int32_t)(lx|-lx))>>31)>0x7ff00000) return x+x; + if(__builtin_expect((ix|((u_int32_t)(lx|-lx))>>31)>0x7ff00000, 0)) + return x+x; if(n<0){ n = -n; x = -x; @@ -85,8 +70,9 @@ static double zero = 0.00000000000000000000e+00; if(n==1) return(__ieee754_j1(x)); sgn = (n&1)&(hx>>31); /* even n -- 0, odd n -- sign(x) */ x = fabs(x); - if((ix|lx)==0||ix>=0x7ff00000) /* if x is 0 or inf */ - b = zero; + if(__builtin_expect((ix|lx)==0||ix>=0x7ff00000,0)) + /* if x is 0 or inf */ + b = zero; else if((double)n<=x) { /* Safe to use J(n+1,x)=2n/x *J(n,x)-J(n-1,x) */ if(ix>=0x52D00000) { /* x > 2**302 */ @@ -99,7 +85,7 @@ static double zero = 0.00000000000000000000e+00; * n sin(xn)*sqt2 cos(xn)*sqt2 * ---------------------------------- * 0 s-c c+s - * 1 -s-c -c+s + * 1 -s-c -c+s * 2 -s+c -c-s * 3 s+c c-s */ @@ -114,13 +100,13 @@ static double zero = 0.00000000000000000000e+00; } b = invsqrtpi*temp/__ieee754_sqrt(x); } else { - a = __ieee754_j0(x); - b = __ieee754_j1(x); - for(i=1;i<n;i++){ + a = __ieee754_j0(x); + b = __ieee754_j1(x); + for(i=1;i<n;i++){ temp = b; b = b*((double)(i+i)/x) - a; /* avoid underflow */ a = temp; - } + } } } else { if(ix<0x3e100000) { /* x < 2**-29 */ @@ -139,11 +125,11 @@ static double zero = 0.00000000000000000000e+00; } } else { /* use backward recurrence */ - /* x x^2 x^2 + /* x x^2 x^2 * J(n,x)/J(n-1,x) = ---- ------ ------ ..... * 2n - 2(n+1) - 2(n+2) * - * 1 1 1 + * 1 1 1 * (for large x) = ---- ------ ------ ..... * 2n 2(n+1) 2(n+2) * -- - ------ - ------ - @@ -156,7 +142,7 @@ static double zero = 0.00000000000000000000e+00; * 1 * w - ----------------- * 1 - * w+h - --------- + * w+h - --------- * w+2h - ... * * To determine how many terms needed, let @@ -193,19 +179,19 @@ static double zero = 0.00000000000000000000e+00; v = two/x; tmp = tmp*__ieee754_log(fabs(v*tmp)); if(tmp<7.09782712893383973096e+02) { - for(i=n-1,di=(double)(i+i);i>0;i--){ - temp = b; + for(i=n-1,di=(double)(i+i);i>0;i--){ + temp = b; b *= di; b = b/x - a; - a = temp; + a = temp; di -= two; - } + } } else { - for(i=n-1,di=(double)(i+i);i>0;i--){ - temp = b; + for(i=n-1,di=(double)(i+i);i>0;i--){ + temp = b; b *= di; b = b/x - a; - a = temp; + a = temp; di -= two; /* scale b to avoid spurious overflow */ if(b>1e100) { @@ -213,7 +199,7 @@ static double zero = 0.00000000000000000000e+00; t /= b; b = one; } - } + } } /* j0() and j1() suffer enormous loss of precision at and * near zero; however, we know that their zero points never @@ -229,13 +215,10 @@ static double zero = 0.00000000000000000000e+00; } if(sgn==1) return -b; else return b; } +strong_alias (__ieee754_jn, __jn_finite) -#ifdef __STDC__ - double __ieee754_yn(int n, double x) -#else - double __ieee754_yn(n,x) - int n; double x; -#endif +double +__ieee754_yn(int n, double x) { int32_t i,hx,ix,lx; int32_t sign; @@ -244,9 +227,11 @@ static double zero = 0.00000000000000000000e+00; EXTRACT_WORDS(hx,lx,x); ix = 0x7fffffff&hx; /* if Y(n,NaN) is NaN */ - if((ix|((u_int32_t)(lx|-lx))>>31)>0x7ff00000) return x+x; - if((ix|lx)==0) return -HUGE_VAL+x; /* -inf and overflow exception. */; - if(hx<0) return zero/(zero*x); + if(__builtin_expect((ix|((u_int32_t)(lx|-lx))>>31)>0x7ff00000,0)) + return x+x; + if(__builtin_expect((ix|lx)==0, 0)) + return -HUGE_VAL+x; /* -inf and overflow exception. */; + if(__builtin_expect(hx<0, 0)) return zero/(zero*x); sign = 1; if(n<0){ n = -n; @@ -254,7 +239,7 @@ static double zero = 0.00000000000000000000e+00; } if(n==0) return(__ieee754_y0(x)); if(n==1) return(sign*__ieee754_y1(x)); - if(ix==0x7ff00000) return zero; + if(__builtin_expect(ix==0x7ff00000, 0)) return zero; if(ix>=0x52D00000) { /* x > 2**302 */ /* (x >> n**2) * Jn(x) = cos(x-(2n+1)*pi/4)*sqrt(2/x*pi) @@ -265,7 +250,7 @@ static double zero = 0.00000000000000000000e+00; * n sin(xn)*sqt2 cos(xn)*sqt2 * ---------------------------------- * 0 s-c c+s - * 1 -s-c -c+s + * 1 -s-c -c+s * 2 -s+c -c-s * 3 s+c c-s */ @@ -294,3 +279,4 @@ static double zero = 0.00000000000000000000e+00; } if(sign>0) return b; else return -b; } +strong_alias (__ieee754_yn, __yn_finite) diff --git a/sysdeps/ieee754/dbl-64/e_lgamma_r.c b/sysdeps/ieee754/dbl-64/e_lgamma_r.c index a298a5a..e26ce8a 100644 --- a/sysdeps/ieee754/dbl-64/e_lgamma_r.c +++ b/sysdeps/ieee754/dbl-64/e_lgamma_r.c @@ -10,19 +10,15 @@ * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: e_lgamma_r.c,v 1.7 1995/05/10 20:45:42 jtc Exp $"; -#endif - /* __ieee754_lgamma_r(x, signgamp) * Reentrant version of the logarithm of the Gamma function * with user provide pointer for the sign of Gamma(x). * * Method: * 1. Argument Reduction for 0 < x <= 8 - * Since gamma(1+s)=s*gamma(s), for x in [0,8], we may - * reduce x to a number in [1.5,2.5] by - * lgamma(1+s) = log(s) + lgamma(s) + * Since gamma(1+s)=s*gamma(s), for x in [0,8], we may + * reduce x to a number in [1.5,2.5] by + * lgamma(1+s) = log(s) + lgamma(s) * for example, * lgamma(7.3) = log(6.3) + lgamma(6.3) * = log(6.3*5.3) + lgamma(5.3) @@ -56,15 +52,15 @@ static char rcsid[] = "$NetBSD: e_lgamma_r.c,v 1.7 1995/05/10 20:45:42 jtc Exp $ * Let z = 1/x, then we approximation * f(z) = lgamma(x) - (x-0.5)(log(x)-1) * by - * 3 5 11 + * 3 5 11 * w = w0 + w1*z + w2*z + w3*z + ... + w6*z * where * |w - f(z)| < 2**-58.74 * * 4. For negative x, since (G is gamma function) * -x*G(-x)*G(x) = pi/sin(pi*x), - * we have - * G(x) = pi/(sin(pi*x)*(-x)*G(-x)) + * we have + * G(x) = pi/(sin(pi*x)*(-x)*G(-x)) * since G(-x) is positive, sign(G(x)) = sign(sin(pi*x)) for x<0 * Hence, for x<0, signgam = sign(sin(pi*x)) and * lgamma(x) = log(|Gamma(x)|) @@ -77,18 +73,14 @@ static char rcsid[] = "$NetBSD: e_lgamma_r.c,v 1.7 1995/05/10 20:45:42 jtc Exp $ * lgamma(1)=lgamma(2)=0 * lgamma(x) ~ -log(x) for tiny x * lgamma(0) = lgamma(inf) = inf - * lgamma(-integer) = +-inf + * lgamma(-integer) = +-inf * */ #include "math.h" #include "math_private.h" -#ifdef __STDC__ static const double -#else -static double -#endif two52= 4.50359962737049600000e+15, /* 0x43300000, 0x00000000 */ half= 5.00000000000000000000e-01, /* 0x3FE00000, 0x00000000 */ one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */ @@ -156,18 +148,10 @@ w4 = -5.95187557450339963135e-04, /* 0xBF4380CB, 0x8C0FE741 */ w5 = 8.36339918996282139126e-04, /* 0x3F4B67BA, 0x4CDAD5D1 */ w6 = -1.63092934096575273989e-03; /* 0xBF5AB89D, 0x0B9E43E4 */ -#ifdef __STDC__ static const double zero= 0.00000000000000000000e+00; -#else -static double zero= 0.00000000000000000000e+00; -#endif -#ifdef __STDC__ - static double sin_pi(double x) -#else - static double sin_pi(x) - double x; -#endif +static double +sin_pi(double x) { double y,z; int n,ix; @@ -188,16 +172,16 @@ static double zero= 0.00000000000000000000e+00; y = 2.0*(y - __floor(y)); /* y = |x| mod 2.0 */ n = (int) (y*4.0); } else { - if(ix>=0x43400000) { - y = zero; n = 0; /* y must be even */ - } else { - if(ix<0x43300000) z = y+two52; /* exact */ + if(ix>=0x43400000) { + y = zero; n = 0; /* y must be even */ + } else { + if(ix<0x43300000) z = y+two52; /* exact */ GET_LOW_WORD(n,z); n &= 1; - y = n; - n<<= 2; - } - } + y = n; + n<<= 2; + } + } switch (n) { case 0: y = __sin(pi*y); break; case 1: @@ -212,12 +196,8 @@ static double zero= 0.00000000000000000000e+00; } -#ifdef __STDC__ - double __ieee754_lgamma_r(double x, int *signgamp) -#else - double __ieee754_lgamma_r(x,signgamp) - double x; int *signgamp; -#endif +double +__ieee754_lgamma_r(double x, int *signgamp) { double t,y,z,nadj,p,p1,p2,p3,q,r,w; int i,hx,lx,ix; @@ -227,21 +207,23 @@ static double zero= 0.00000000000000000000e+00; /* purge off +-inf, NaN, +-0, and negative arguments */ *signgamp = 1; ix = hx&0x7fffffff; - if(ix>=0x7ff00000) return x*x; - if((ix|lx)==0) + if(__builtin_expect(ix>=0x7ff00000, 0)) return x*x; + if(__builtin_expect((ix|lx)==0, 0)) { if (hx < 0) *signgamp = -1; return one/fabs(x); } - if(ix<0x3b900000) { /* |x|<2**-70, return -log(|x|) */ + if(__builtin_expect(ix<0x3b900000, 0)) { + /* |x|<2**-70, return -log(|x|) */ if(hx<0) { - *signgamp = -1; - return -__ieee754_log(-x); + *signgamp = -1; + return -__ieee754_log(-x); } else return -__ieee754_log(x); } if(hx<0) { - if(ix>=0x43300000) /* |x|>=2**52, must be -integer */ + if(__builtin_expect(ix>=0x43300000, 0)) + /* |x|>=2**52, must be -integer */ return x/zero; t = sin_pi(x); if(t==zero) return one/fabsf(t); /* -integer */ @@ -254,15 +236,15 @@ static double zero= 0.00000000000000000000e+00; if((((ix-0x3ff00000)|lx)==0)||(((ix-0x40000000)|lx)==0)) r = 0; /* for x < 2.0 */ else if(ix<0x40000000) { - if(ix<=0x3feccccc) { /* lgamma(x) = lgamma(x+1)-log(x) */ + if(ix<=0x3feccccc) { /* lgamma(x) = lgamma(x+1)-log(x) */ r = -__ieee754_log(x); if(ix>=0x3FE76944) {y = one-x; i= 0;} else if(ix>=0x3FCDA661) {y= x-(tc-one); i=1;} - else {y = x; i=2;} + else {y = x; i=2;} } else { - r = zero; - if(ix>=0x3FFBB4C3) {y=2.0-x;i=0;} /* [1.7316,2] */ - else if(ix>=0x3FF3B4C4) {y=x-tc;i=1;} /* [1.23,1.73] */ + r = zero; + if(ix>=0x3FFBB4C3) {y=2.0-x;i=0;} /* [1.7316,2] */ + else if(ix>=0x3FF3B4C4) {y=x-tc;i=1;} /* [1.23,1.73] */ else {y=x-one;i=2;} } switch(i) { @@ -286,7 +268,7 @@ static double zero= 0.00000000000000000000e+00; r += (-0.5*y + p1/p2); } } - else if(ix<0x40200000) { /* x < 8.0 */ + else if(ix<0x40200000) { /* x < 8.0 */ i = (int)x; t = zero; y = x-(double)i; @@ -315,3 +297,4 @@ static double zero= 0.00000000000000000000e+00; if(hx<0) r = nadj - r; return r; } +strong_alias (__ieee754_lgamma_r, __lgamma_r_finite) diff --git a/sysdeps/ieee754/dbl-64/e_log.c b/sysdeps/ieee754/dbl-64/e_log.c index 1a9967b..5d320db 100644 --- a/sysdeps/ieee754/dbl-64/e_log.c +++ b/sysdeps/ieee754/dbl-64/e_log.c @@ -55,9 +55,9 @@ double __ieee754_log(double x) { int k; #endif double dbl_n,u,p0,q,r0,w,nln2a,luai,lubi,lvaj,lvbj, - sij,ssij,ttij,A,B,B0,y,y1,y2,polI,polII,sa,sb, - t1,t2,t3,t4,t5,t6,t7,t8,t,ra,rb,ww, - a0,aa0,s1,s2,ss2,s3,ss3,a1,aa1,a,aa,b,bb,c; + sij,ssij,ttij,A,B,B0,y,y1,y2,polI,polII,sa,sb, + t1,t2,t3,t4,t5,t6,t7,t8,t,ra,rb,ww, + a0,aa0,s1,s2,ss2,s3,ss3,a1,aa1,a,aa,b,bb,c; number num; mp_no mpx,mpy,mpy1,mpy2,mperr; @@ -69,12 +69,15 @@ double __ieee754_log(double x) { num.d = x; ux = num.i[HIGH_HALF]; dx = num.i[LOW_HALF]; n=0; if (ux < 0x00100000) { - if (((ux & 0x7fffffff) | dx) == 0) return MHALF/ZERO; /* return -INF */ - if (ux < 0) return (x-x)/ZERO; /* return NaN */ + if (__builtin_expect(((ux & 0x7fffffff) | dx) == 0, 0)) + return MHALF/ZERO; /* return -INF */ + if (__builtin_expect(ux < 0, 0)) + return (x-x)/ZERO; /* return NaN */ n -= 54; x *= two54.d; /* scale x */ num.d = x; } - if (ux >= 0x7ff00000) return x+x; /* INF or NaN */ + if (__builtin_expect(ux >= 0x7ff00000, 0)) + return x+x; /* INF or NaN */ /* Regular values of x */ @@ -90,7 +93,7 @@ double __ieee754_log(double x) { /* Evaluate polynomial II */ polII = (b0.d+w*(b1.d+w*(b2.d+w*(b3.d+w*(b4.d+ - w*(b5.d+w*(b6.d+w*(b7.d+w*b8.d))))))))*w*w*w; + w*(b5.d+w*(b6.d+w*(b7.d+w*b8.d))))))))*w*w*w; c = (aa+bb)+polII; /* End stage I, case abs(x-1) < 0.03 */ @@ -99,7 +102,7 @@ double __ieee754_log(double x) { /*--- Stage II, the case abs(x-1) < 0.03 */ a = d11.d+w*(d12.d+w*(d13.d+w*(d14.d+w*(d15.d+w*(d16.d+ - w*(d17.d+w*(d18.d+w*(d19.d+w*d20.d)))))))); + w*(d17.d+w*(d18.d+w*(d19.d+w*d20.d)))))))); EMULV(w,a,s2,ss2,t1,t2,t3,t4,t5) ADD2(d10.d,dd10.d,s2,ss2,s3,ss3,t1,t2) MUL2(w,ZERO,s3,ss3,s2,ss2,t1,t2,t3,t4,t5,t6,t7,t8) @@ -201,3 +204,4 @@ double __ieee754_log(double x) { } return y1; } +strong_alias (__ieee754_log, __log_finite) diff --git a/sysdeps/ieee754/dbl-64/e_log10.c b/sysdeps/ieee754/dbl-64/e_log10.c index e8a3278..6a630bc 100644 --- a/sysdeps/ieee754/dbl-64/e_log10.c +++ b/sysdeps/ieee754/dbl-64/e_log10.c @@ -10,10 +10,6 @@ * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: e_log10.c,v 1.9 1995/05/10 20:45:51 jtc Exp $"; -#endif - /* __ieee754_log10(x) * Return the base 10 logarithm of x * @@ -50,28 +46,16 @@ static char rcsid[] = "$NetBSD: e_log10.c,v 1.9 1995/05/10 20:45:51 jtc Exp $"; #include "math.h" #include "math_private.h" -#ifdef __STDC__ static const double -#else -static double -#endif two54 = 1.80143985094819840000e+16, /* 0x43500000, 0x00000000 */ ivln10 = 4.34294481903251816668e-01, /* 0x3FDBCB7B, 0x1526E50E */ log10_2hi = 3.01029995663611771306e-01, /* 0x3FD34413, 0x509F6000 */ log10_2lo = 3.69423907715893078616e-13; /* 0x3D59FEF3, 0x11F12B36 */ -#ifdef __STDC__ static const double zero = 0.0; -#else -static double zero = 0.0; -#endif -#ifdef __STDC__ - double __ieee754_log10(double x) -#else - double __ieee754_log10(x) - double x; -#endif +double +__ieee754_log10(double x) { double y,z; int32_t i,k,hx; @@ -79,20 +63,22 @@ static double zero = 0.0; EXTRACT_WORDS(hx,lx,x); - k=0; - if (hx < 0x00100000) { /* x < 2**-1022 */ - if (((hx&0x7fffffff)|lx)==0) - return -two54/(x-x); /* log(+-0)=-inf */ - if (hx<0) return (x-x)/(x-x); /* log(-#) = NaN */ - k -= 54; x *= two54; /* subnormal number, scale up x */ + k=0; + if (hx < 0x00100000) { /* x < 2**-1022 */ + if (__builtin_expect(((hx&0x7fffffff)|lx)==0, 0)) + return -two54/(x-x); /* log(+-0)=-inf */ + if (__builtin_expect(hx<0, 0)) + return (x-x)/(x-x); /* log(-#) = NaN */ + k -= 54; x *= two54; /* subnormal number, scale up x */ GET_HIGH_WORD(hx,x); - } - if (hx >= 0x7ff00000) return x+x; + } + if (__builtin_expect(hx >= 0x7ff00000, 0)) return x+x; k += (hx>>20)-1023; i = ((u_int32_t)k&0x80000000)>>31; - hx = (hx&0x000fffff)|((0x3ff-i)<<20); - y = (double)(k+i); + hx = (hx&0x000fffff)|((0x3ff-i)<<20); + y = (double)(k+i); SET_HIGH_WORD(x,hx); z = y*log10_2lo + ivln10*__ieee754_log(x); return z+y*log10_2hi; } +strong_alias (__ieee754_log10, __log10_finite) diff --git a/sysdeps/ieee754/dbl-64/e_log2.c b/sysdeps/ieee754/dbl-64/e_log2.c index f05d0ce..be41cb4 100644 --- a/sysdeps/ieee754/dbl-64/e_log2.c +++ b/sysdeps/ieee754/dbl-64/e_log2.c @@ -21,14 +21,14 @@ * 2. Approximation of log(1+f). * Let s = f/(2+f) ; based on log(1+f) = log(1+s) - log(1-s) * = 2s + 2/3 s**3 + 2/5 s**5 + ....., - * = 2s + s*R + * = 2s + s*R * We use a special Reme algorithm on [0,0.1716] to generate - * a polynomial of degree 14 to approximate R The maximum error + * a polynomial of degree 14 to approximate R The maximum error * of this polynomial approximation is bounded by 2**-58.45. In * other words, - * 2 4 6 8 10 12 14 + * 2 4 6 8 10 12 14 * R(z) ~ Lg1*s +Lg2*s +Lg3*s +Lg4*s +Lg5*s +Lg6*s +Lg7*s - * (the values of Lg1 to Lg7 are listed in the program) + * (the values of Lg1 to Lg7 are listed in the program) * and * | 2 14 | -58.45 * | Lg1*s +...+Lg7*s - R(z) | <= 2 @@ -57,11 +57,7 @@ #include "math.h" #include "math_private.h" -#ifdef __STDC__ static const double -#else -static double -#endif ln2 = 0.69314718055994530942, two54 = 1.80143985094819840000e+16, /* 43500000 00000000 */ Lg1 = 6.666666666666735130e-01, /* 3FE55555 55555593 */ @@ -72,18 +68,10 @@ Lg5 = 1.818357216161805012e-01, /* 3FC74664 96CB03DE */ Lg6 = 1.531383769920937332e-01, /* 3FC39A09 D078C69F */ Lg7 = 1.479819860511658591e-01; /* 3FC2F112 DF3E5244 */ -#ifdef __STDC__ static const double zero = 0.0; -#else -static double zero = 0.0; -#endif -#ifdef __STDC__ - double __ieee754_log2(double x) -#else - double __ieee754_log2(x) - double x; -#endif +double +__ieee754_log2(double x) { double hfsq,f,s,z,R,w,t1,t2,dk; int32_t k,hx,i,j; @@ -93,13 +81,14 @@ static double zero = 0.0; k=0; if (hx < 0x00100000) { /* x < 2**-1022 */ - if (((hx&0x7fffffff)|lx)==0) + if (__builtin_expect(((hx&0x7fffffff)|lx)==0, 0)) return -two54/(x-x); /* log(+-0)=-inf */ - if (hx<0) return (x-x)/(x-x); /* log(-#) = NaN */ + if (__builtin_expect(hx<0, 0)) + return (x-x)/(x-x); /* log(-#) = NaN */ k -= 54; x *= two54; /* subnormal number, scale up x */ GET_HIGH_WORD(hx,x); } - if (hx >= 0x7ff00000) return x+x; + if (__builtin_expect(hx >= 0x7ff00000, 0)) return x+x; k += (hx>>20)-1023; hx &= 0x000fffff; i = (hx+0x95f64)&0x100000; @@ -112,7 +101,7 @@ static double zero = 0.0; R = f*f*(0.5-0.33333333333333333*f); return dk-(R-f)/ln2; } - s = f/(2.0+f); + s = f/(2.0+f); z = s*s; i = hx-0x6147a; w = z*z; @@ -128,3 +117,4 @@ static double zero = 0.0; return dk-((s*(f-R))-f)/ln2; } } +strong_alias (__ieee754_log2, __log2_finite) diff --git a/sysdeps/ieee754/dbl-64/e_pow.c b/sysdeps/ieee754/dbl-64/e_pow.c index 1e159f2..83a5eff 100644 --- a/sysdeps/ieee754/dbl-64/e_pow.c +++ b/sysdeps/ieee754/dbl-64/e_pow.c @@ -1,7 +1,7 @@ /* * IBM Accurate Mathematical Library * written by International Business Machines Corp. - * Copyright (C) 2001, 2002, 2004 Free Software Foundation + * Copyright (C) 2001, 2002, 2004, 2011 Free Software Foundation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -22,12 +22,12 @@ /* */ /* FUNCTIONS: upow */ /* power1 */ -/* my_log2 */ +/* my_log2 */ /* log1 */ /* checkint */ /* FILES NEEDED: dla.h endian.h mpa.h mydefs.h */ /* halfulp.c mpexp.c mplog.c slowexp.c slowpow.c mpa.c */ -/* uexp.c upow.c */ +/* uexp.c upow.c */ /* root.tbl uexp.tbl upow.tbl */ /* An ultimate power routine. Given two IEEE double machine numbers y,x */ /* it computes the correctly rounded (to nearest) value of x^y. */ @@ -77,7 +77,7 @@ double __ieee754_pow(double x, double y) { /* else */ if(((u.i[HIGH_HALF]>0 && u.i[HIGH_HALF]<0x7ff00000)|| /* x>0 and not x->0 */ (u.i[HIGH_HALF]==0 && u.i[LOW_HALF]!=0)) && - /* 2^-1023< x<= 2^-1023 * 0x1.0000ffffffff */ + /* 2^-1023< x<= 2^-1023 * 0x1.0000ffffffff */ (v.i[HIGH_HALF]&0x7fffffff) < 0x4ff00000) { /* if y<-1 or y>1 */ z = log1(x,&aa,&error); /* x^y =e^(y log (X)) */ t = y*134217729.0; @@ -153,6 +153,7 @@ double __ieee754_pow(double x, double y) { if (y<0) return (x<1.0)?INF.x:0; return 0; /* unreachable, to make the compiler happy */ } +strong_alias (__ieee754_pow, __pow_finite) /**************************************************************************/ /* Computing x^y using more accurate but more slow log routine */ diff --git a/sysdeps/ieee754/dbl-64/e_remainder.c b/sysdeps/ieee754/dbl-64/e_remainder.c index cc06e18..d1782a1 100644 --- a/sysdeps/ieee754/dbl-64/e_remainder.c +++ b/sysdeps/ieee754/dbl-64/e_remainder.c @@ -1,8 +1,8 @@ /* * IBM Accurate Mathematical Library * written by International Business Machines Corp. - * Copyright (C) 2001 Free Software Foundation - * + * Copyright (C) 2001, 2011 Free Software Foundation + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or @@ -96,9 +96,9 @@ double __ieee754_remainder(double x, double y) u.x=(u.x-d*w.x)-d*ww.x; if (ABS(u.x)<0.5*t.x) return (u.x!=0)?u.x:((x>0)?ZERO.x:nZERO.x); else - if (ABS(u.x)>0.5*t.x) return (d>z)?u.x+t.x:u.x-t.x; - else - {z=u.x/t.x; d=(z+big.x)-big.x; return ((u.x-d*w.x)-d*ww.x);} + if (ABS(u.x)>0.5*t.x) return (d>z)?u.x+t.x:u.x-t.x; + else + {z=u.x/t.x; d=(z+big.x)-big.x; return ((u.x-d*w.x)-d*ww.x);} } } /* (kx<0x7fe00000&&ky<0x7ff00000&&ky>=0x03500000) */ @@ -128,3 +128,4 @@ double __ieee754_remainder(double x, double y) } } } +strong_alias (__ieee754_remainder, __remainder_finite) diff --git a/sysdeps/ieee754/dbl-64/e_sinh.c b/sysdeps/ieee754/dbl-64/e_sinh.c index 1701b9b..50463c3 100644 --- a/sysdeps/ieee754/dbl-64/e_sinh.c +++ b/sysdeps/ieee754/dbl-64/e_sinh.c @@ -5,7 +5,7 @@ * * Developed at SunPro, 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. * ==================================================== */ @@ -15,15 +15,15 @@ static char rcsid[] = "$NetBSD: e_sinh.c,v 1.7 1995/05/10 20:46:13 jtc Exp $"; #endif /* __ieee754_sinh(x) - * Method : + * Method : * mathematically sinh(x) if defined to be (exp(x)-exp(-x))/2 - * 1. Replace x by |x| (sinh(-x) = -sinh(x)). - * 2. - * E + E/(E+1) + * 1. Replace x by |x| (sinh(-x) = -sinh(x)). + * 2. + * E + E/(E+1) * 0 <= x <= 22 : sinh(x) := --------------, E=expm1(x) - * 2 + * 2 * - * 22 <= x <= lnovft : sinh(x) := exp(x)/2 + * 22 <= x <= lnovft : sinh(x) := exp(x)/2 * lnovft <= x <= ln2ovft: sinh(x) := exp(x/2)/2 * exp(x/2) * ln2ovft < x : sinh(x) := x*shuge (overflow) * @@ -35,19 +35,11 @@ static char rcsid[] = "$NetBSD: e_sinh.c,v 1.7 1995/05/10 20:46:13 jtc Exp $"; #include "math.h" #include "math_private.h" -#ifdef __STDC__ static const double one = 1.0, shuge = 1.0e307; -#else -static double one = 1.0, shuge = 1.0e307; -#endif -#ifdef __STDC__ - double __ieee754_sinh(double x) -#else - double __ieee754_sinh(x) - double x; -#endif -{ +double +__ieee754_sinh(double x) +{ double t,w,h; int32_t ix,jx; u_int32_t lx; @@ -57,14 +49,15 @@ static double one = 1.0, shuge = 1.0e307; ix = jx&0x7fffffff; /* x is INF or NaN */ - if(ix>=0x7ff00000) return x+x; + if(__builtin_expect(ix>=0x7ff00000, 0)) return x+x; h = 0.5; if (jx<0) h = -h; /* |x| in [0,22], return sign(x)*0.5*(E+E/(E+1))) */ if (ix < 0x40360000) { /* |x|<22 */ - if (ix<0x3e300000) /* |x|<2**-28 */ - if(shuge+x>one) return x;/* sinh(tiny) = tiny with inexact */ + if (__builtin_expect(ix<0x3e300000, 0)) /* |x|<2**-28 */ + if(shuge+x>one) + return x;/* sinh(tiny) = tiny with inexact */ t = __expm1(fabs(x)); if(ix<0x3ff00000) return h*(2.0*t-t*t/(t+one)); return h*(t+t/(t+one)); @@ -84,3 +77,4 @@ static double one = 1.0, shuge = 1.0e307; /* |x| > overflowthresold, sinh(x) overflow */ return x*shuge; } +strong_alias (__ieee754_sinh, __sinh_finite) diff --git a/sysdeps/ieee754/dbl-64/e_sqrt.c b/sysdeps/ieee754/dbl-64/e_sqrt.c index f7e8055..05d1e71 100644 --- a/sysdeps/ieee754/dbl-64/e_sqrt.c +++ b/sysdeps/ieee754/dbl-64/e_sqrt.c @@ -1,7 +1,7 @@ /* * IBM Accurate Mathematical Library * written by International Business Machines Corp. - * Copyright (C) 2001 Free Software Foundation + * Copyright (C) 2001, 2011 Free Software Foundation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -86,3 +86,4 @@ double __ieee754_sqrt(double x) { return tm256.x*__ieee754_sqrt(x*t512.x); } } +strong_alias (__ieee754_sqrt, __sqrt_finite) diff --git a/sysdeps/ieee754/dbl-64/halfulp.c b/sysdeps/ieee754/dbl-64/halfulp.c index 478a4ba..42b21fb 100644 --- a/sysdeps/ieee754/dbl-64/halfulp.c +++ b/sysdeps/ieee754/dbl-64/halfulp.c @@ -1,7 +1,7 @@ /* * IBM Accurate Mathematical Library * written by International Business Machines Corp. - * Copyright (C) 2001, 2005 Free Software Foundation + * Copyright (C) 2001, 2005, 2011 Free Software Foundation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -40,13 +40,11 @@ #include "dla.h" #include "math_private.h" -double __ieee754_sqrt(double x); - static const int4 tab54[32] = { 262143, 11585, 1782, 511, 210, 107, 63, 42, 30, 22, 17, 14, 12, 10, 9, 7, - 7, 6, 5, 5, 5, 4, 4, 4, - 3, 3, 3, 3, 3, 3, 3, 3 }; + 7, 6, 5, 5, 5, 4, 4, 4, + 3, 3, 3, 3, 3, 3, 3, 3 }; double __halfulp(double x, double y) @@ -64,12 +62,12 @@ double __halfulp(double x, double y) z = (double) k; return (z*y == -1075.0)?0: -10.0; } - /* if y > 0 */ + /* if y > 0 */ v.x = y; if (v.i[LOW_HALF] != 0) return -10.0; v.x=x; - /* case where x = 2**n for some integer n */ + /* case where x = 2**n for some integer n */ if (((v.i[HIGH_HALF]&0x000fffff)|v.i[LOW_HALF]) == 0) { k=(v.i[HIGH_HALF]>>20)-1023; return (((double) k)*y == -1075.0)?0:-10.0; @@ -90,7 +88,7 @@ double __halfulp(double x, double y) k = -k; if (k>5) return -10.0; - /* now treat x */ + /* now treat x */ while (k>0) { z = __ieee754_sqrt(x); EMULV(z,z,u,uu,j1,j2,j3,j4,j5); @@ -111,11 +109,11 @@ double __halfulp(double x, double y) m = (k&0x000fffff)|0x00100000; m = m>>(20-l); /* m is the odd integer of x */ - /* now check whether the length of m**n is at most 54 bits */ + /* now check whether the length of m**n is at most 54 bits */ if (m > tab54[n-3]) return -10.0; - /* yes, it is - now compute x**n by simple multiplications */ + /* yes, it is - now compute x**n by simple multiplications */ u = x; for (k=1;k<n;k++) u = u*x; diff --git a/sysdeps/ieee754/dbl-64/s_asinh.c b/sysdeps/ieee754/dbl-64/s_asinh.c index 985cfe3..93789fb 100644 --- a/sysdeps/ieee754/dbl-64/s_asinh.c +++ b/sysdeps/ieee754/dbl-64/s_asinh.c @@ -10,10 +10,6 @@ * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: s_asinh.c,v 1.9 1995/05/12 04:57:37 jtc Exp $"; -#endif - /* asinh(x) * Method : * Based on @@ -28,40 +24,34 @@ static char rcsid[] = "$NetBSD: s_asinh.c,v 1.9 1995/05/12 04:57:37 jtc Exp $"; #include "math.h" #include "math_private.h" -#ifdef __STDC__ static const double -#else -static double -#endif one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */ ln2 = 6.93147180559945286227e-01, /* 0x3FE62E42, 0xFEFA39EF */ huge= 1.00000000000000000000e+300; -#ifdef __STDC__ - double __asinh(double x) -#else - double __asinh(x) - double x; -#endif +double +__asinh(double x) { - double t,w; + double w; int32_t hx,ix; GET_HIGH_WORD(hx,x); ix = hx&0x7fffffff; - if(ix>=0x7ff00000) return x+x; /* x is inf or NaN */ - if(ix< 0x3e300000) { /* |x|<2**-28 */ + if(__builtin_expect(ix< 0x3e300000, 0)) { /* |x|<2**-28 */ if(huge+x>one) return x; /* return x inexact except 0 */ } - if(ix>0x41b00000) { /* |x| > 2**28 */ + if(__builtin_expect(ix>0x41b00000, 0)) { /* |x| > 2**28 */ + if(ix>=0x7ff00000) return x+x; /* x is inf or NaN */ w = __ieee754_log(fabs(x))+ln2; - } else if (ix>0x40000000) { /* 2**28 > |x| > 2.0 */ - t = fabs(x); - w = __ieee754_log(2.0*t+one/(__ieee754_sqrt(x*x+one)+t)); - } else { /* 2.0 > |x| > 2**-28 */ - t = x*x; - w =__log1p(fabs(x)+t/(one+__ieee754_sqrt(one+t))); + } else { + double xa = fabs(x); + if (ix>0x40000000) { /* 2**28 > |x| > 2.0 */ + w = __ieee754_log(2.0*xa+one/(__ieee754_sqrt(xa*xa+one)+xa)); + } else { /* 2.0 > |x| > 2**-28 */ + double t = xa*xa; + w =__log1p(xa+t/(one+__ieee754_sqrt(one+t))); + } } - if(hx>0) return w; else return -w; + return __copysign(w, x); } weak_alias (__asinh, asinh) #ifdef NO_LONG_DOUBLE diff --git a/sysdeps/ieee754/flt-32/e_acosf.c b/sysdeps/ieee754/flt-32/e_acosf.c index 0d85c42..a258e2f 100644 --- a/sysdeps/ieee754/flt-32/e_acosf.c +++ b/sysdeps/ieee754/flt-32/e_acosf.c @@ -8,23 +8,15 @@ * * Developed at SunPro, 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. * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: e_acosf.c,v 1.5 1995/05/12 04:57:16 jtc Exp $"; -#endif - #include "math.h" #include "math_private.h" -#ifdef __STDC__ -static const float -#else -static float -#endif +static const float one = 1.0000000000e+00, /* 0x3F800000 */ pi = 3.1415925026e+00, /* 0x40490fda */ pio2_hi = 1.5707962513e+00, /* 0x3fc90fda */ @@ -40,12 +32,8 @@ qS2 = 2.0209457874e+00, /* 0x4001572d */ qS3 = -6.8828397989e-01, /* 0xbf303361 */ qS4 = 7.7038154006e-02; /* 0x3d9dc62e */ -#ifdef __STDC__ - float __ieee754_acosf(float x) -#else - float __ieee754_acosf(x) - float x; -#endif +float +__ieee754_acosf(float x) { float z,p,q,r,w,s,c,df; int32_t hx,ix; @@ -87,3 +75,4 @@ qS4 = 7.7038154006e-02; /* 0x3d9dc62e */ return (float)2.0*(df+w); } } +strong_alias (__ieee754_acosf, __acosf_finite) diff --git a/sysdeps/ieee754/flt-32/e_acoshf.c b/sysdeps/ieee754/flt-32/e_acoshf.c index c607f72..db8f6ec 100644 --- a/sysdeps/ieee754/flt-32/e_acoshf.c +++ b/sysdeps/ieee754/flt-32/e_acoshf.c @@ -8,7 +8,7 @@ * * Developed at SunPro, 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. * ==================================================== */ @@ -21,9 +21,9 @@ static char rcsid[] = "$NetBSD: e_acoshf.c,v 1.5 1995/05/12 04:57:20 jtc Exp $"; #include "math_private.h" #ifdef __STDC__ -static const float +static const float #else -static float +static float #endif one = 1.0, ln2 = 6.9314718246e-01; /* 0x3f317218 */ @@ -34,7 +34,7 @@ ln2 = 6.9314718246e-01; /* 0x3f317218 */ float __ieee754_acoshf(x) float x; #endif -{ +{ float t; int32_t hx; GET_FLOAT_WORD(hx,x); @@ -42,8 +42,8 @@ ln2 = 6.9314718246e-01; /* 0x3f317218 */ return (x-x)/(x-x); } else if(hx >=0x4d800000) { /* x > 2**28 */ if(hx >=0x7f800000) { /* x is inf of NaN */ - return x+x; - } else + return x+x; + } else return __ieee754_logf(x)+ln2; /* acosh(huge)=log(2x) */ } else if (hx==0x3f800000) { return 0.0; /* acosh(1) = 0 */ @@ -55,3 +55,4 @@ ln2 = 6.9314718246e-01; /* 0x3f317218 */ return __log1pf(t+__sqrtf((float)2.0*t+t*t)); } } +strong_alias (__ieee754_acoshf, __acoshf_finite) diff --git a/sysdeps/ieee754/flt-32/e_asinf.c b/sysdeps/ieee754/flt-32/e_asinf.c index b0c835c..7296ba3 100644 --- a/sysdeps/ieee754/flt-32/e_asinf.c +++ b/sysdeps/ieee754/flt-32/e_asinf.c @@ -14,11 +14,11 @@ */ /* - Modifications for single precision expansion are + Modifications for single precision expansion are Copyright (C) 2001 Stephen L. Moshier <moshier@na-net.ornl.gov> - and are incorporated herein by permission of the author. The author + and are incorporated herein by permission of the author. The author reserves the right to distribute this material elsewhere under different - copying permissions. These modifications are distributed here under + copying permissions. These modifications are distributed here under the following terms: This library is free software; you can redistribute it and/or @@ -93,7 +93,7 @@ p4 = 4.216630880e-2f; t = w*0.5f; p = t * (p0 + t * (p1 + t * (p2 + t * (p3 + t * p4)))); s = __ieee754_sqrtf(t); - if(ix>=0x3F79999A) { /* if |x| > 0.975 */ + if(ix>=0x3F79999A) { /* if |x| > 0.975 */ t = pio2_hi-(2.0f*(s+s*p)-pio2_lo); } else { int32_t iw; @@ -108,3 +108,4 @@ p4 = 4.216630880e-2f; } if(hx>0) return t; else return -t; } +strong_alias (__ieee754_asinf, __asinf_finite) diff --git a/sysdeps/ieee754/flt-32/e_atan2f.c b/sysdeps/ieee754/flt-32/e_atan2f.c index c0cafb1..abbde88 100644 --- a/sysdeps/ieee754/flt-32/e_atan2f.c +++ b/sysdeps/ieee754/flt-32/e_atan2f.c @@ -13,18 +13,10 @@ * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: e_atan2f.c,v 1.4 1995/05/10 20:44:53 jtc Exp $"; -#endif - #include "math.h" #include "math_private.h" -#ifdef __STDC__ static const float -#else -static float -#endif tiny = 1.0e-30, zero = 0.0, pi_o_4 = 7.8539818525e-01, /* 0x3f490fdb */ @@ -32,12 +24,8 @@ pi_o_2 = 1.5707963705e+00, /* 0x3fc90fdb */ pi = 3.1415927410e+00, /* 0x40490fdb */ pi_lo = -8.7422776573e-08; /* 0xb3bbbd2e */ -#ifdef __STDC__ - float __ieee754_atan2f(float y, float x) -#else - float __ieee754_atan2f(y,x) - float y,x; -#endif +float +__ieee754_atan2f (float y, float x) { float z; int32_t k,m,hx,hy,ix,iy; @@ -56,7 +44,7 @@ pi_lo = -8.7422776573e-08; /* 0xb3bbbd2e */ if(iy==0) { switch(m) { case 0: - case 1: return y; /* atan(+-0,+anything)=+-0 */ + case 1: return y; /* atan(+-0,+anything)=+-0 */ case 2: return pi+tiny;/* atan(+0,-anything) = pi */ case 3: return -pi-tiny;/* atan(-0,-anything) =-pi */ } @@ -87,19 +75,20 @@ pi_lo = -8.7422776573e-08; /* 0xb3bbbd2e */ /* compute y/x */ k = (iy-ix)>>23; - if(k > 60) z=pi_o_2+(float)0.5*pi_lo; /* |y/x| > 2**60 */ - else if(hx<0&&k<-60) z=0.0; /* |y|/x < -2**60 */ + if(k > 60) z=pi_o_2+(float)0.5*pi_lo; /* |y/x| > 2**60 */ + else if(hx<0&&k<-60) z=0.0; /* |y|/x < -2**60 */ else z=__atanf(fabsf(y/x)); /* safe to do y/x */ switch (m) { case 0: return z ; /* atan(+,+) */ case 1: { - u_int32_t zh; + u_int32_t zh; GET_FLOAT_WORD(zh,z); SET_FLOAT_WORD(z,zh ^ 0x80000000); } return z ; /* atan(-,+) */ case 2: return pi-(z-pi_lo);/* atan(+,-) */ default: /* case 3 */ - return (z-pi_lo)-pi;/* atan(-,-) */ + return (z-pi_lo)-pi;/* atan(-,-) */ } } +strong_alias (__ieee754_atan2f, __atan2f_finite) diff --git a/sysdeps/ieee754/flt-32/e_atanhf.c b/sysdeps/ieee754/flt-32/e_atanhf.c index f26a15b..ddd18ab 100644 --- a/sysdeps/ieee754/flt-32/e_atanhf.c +++ b/sysdeps/ieee754/flt-32/e_atanhf.c @@ -1,58 +1,70 @@ -/* e_atanhf.c -- float version of e_atanh.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ +/* Copyright (C) 2011 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@gmail.com>, 2011. -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + + +/* __ieee754_atanh(x) + Method : + 1.Reduced x to positive by atanh(-x) = -atanh(x) + 2.For x>=0.5 + 1 2x x + atanh(x) = --- * log(1 + -------) = 0.5 * log1p(2 * --------) + 2 1 - x 1 - x + + For x<0.5 + atanh(x) = 0.5*log1p(2x+2x*x/(1-x)) -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: e_atanhf.c,v 1.4 1995/05/10 20:44:56 jtc Exp $"; -#endif + Special cases: + atanh(x) is NaN if |x| > 1 with signal; + atanh(NaN) is that NaN with no signal; + atanh(+-1) is +-INF with signal. + */ + +#include <inttypes.h> #include "math.h" #include "math_private.h" -#ifdef __STDC__ -static const float one = 1.0, huge = 1e30; -#else -static float one = 1.0, huge = 1e30; -#endif - -#ifdef __STDC__ -static const float zero = 0.0; -#else -static float zero = 0.0; -#endif - -#ifdef __STDC__ - float __ieee754_atanhf(float x) -#else - float __ieee754_atanhf(x) - float x; -#endif +static const float huge = 1e30; + +float +__ieee754_atanhf (float x) { - float t; - int32_t hx,ix; - GET_FLOAT_WORD(hx,x); - ix = hx&0x7fffffff; - if (ix>0x3f800000) /* |x|>1 */ - return (x-x)/(x-x); - if(ix==0x3f800000) - return x/zero; - if(ix<0x31800000&&(huge+x)>zero) return x; /* x<2**-28 */ - SET_FLOAT_WORD(x,ix); - if(ix<0x3f000000) { /* x < 0.5 */ - t = x+x; - t = (float)0.5*__log1pf(t+t*x/(one-x)); - } else - t = (float)0.5*__log1pf((x+x)/(one-x)); - if(hx>=0) return t; else return -t; + float xa = fabsf (x); + float t; + if (xa < 0.5f) + { + if (__builtin_expect (xa < 0x1.0p-28f, 0) && (huge + x) > 0.0f) + return x; + + t = xa + xa; + t = 0.5f * __log1pf (t + t * xa / (1.0f - xa)); + } + else if (__builtin_expect (xa < 1.0f, 1)) + t = 0.5f * __log1pf ((xa + xa) / (1.0f - xa)); + else + { + if (xa > 1.0f) + return (x - x) / (x - x); + + return x / 0.0f; + } + + return __copysignf (t, x); } +strong_alias (__ieee754_atanhf, __atanhf_finite) diff --git a/sysdeps/ieee754/flt-32/e_coshf.c b/sysdeps/ieee754/flt-32/e_coshf.c index 223fbee..1887639 100644 --- a/sysdeps/ieee754/flt-32/e_coshf.c +++ b/sysdeps/ieee754/flt-32/e_coshf.c @@ -1,5 +1,6 @@ /* e_coshf.c -- float version of e_cosh.c. * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + * Optimizations by Ulrich Drepper <drepper@gmail.com>, 2011 */ /* @@ -13,26 +14,14 @@ * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: e_coshf.c,v 1.6 1996/04/08 15:43:41 phil Exp $"; -#endif - #include "math.h" #include "math_private.h" -#ifdef __STDC__ static const float huge = 1.0e30; static const float one = 1.0, half=0.5; -#else -static float one = 1.0, half=0.5, huge = 1.0e30; -#endif -#ifdef __STDC__ - float __ieee754_coshf(float x) -#else - float __ieee754_coshf(x) - float x; -#endif +float +__ieee754_coshf (float x) { float t,w; int32_t ix; @@ -40,19 +29,17 @@ static float one = 1.0, half=0.5, huge = 1.0e30; GET_FLOAT_WORD(ix,x); ix &= 0x7fffffff; - /* x is INF or NaN */ - if(ix>=0x7f800000) return x*x; - - /* |x| in [0,0.5*ln2], return 1+expm1(|x|)^2/(2*exp(|x|)) */ - if(ix<0x3eb17218) { - t = __expm1f(fabsf(x)); - w = one+t; - if (ix<0x24000000) return w; /* cosh(tiny) = 1 */ - return one+(t*t)/(w+w); - } - - /* |x| in [0.5*ln2,22], return (exp(|x|)+1/exp(|x|)/2; */ + /* |x| in [0,22] */ if (ix < 0x41b00000) { + /* |x| in [0,0.5*ln2], return 1+expm1(|x|)^2/(2*exp(|x|)) */ + if(ix<0x3eb17218) { + t = __expm1f(fabsf(x)); + w = one+t; + if (ix<0x24000000) return w; /* cosh(tiny) = 1 */ + return one+(t*t)/(w+w); + } + + /* |x| in [0.5*ln2,22], return (exp(|x|)+1/exp(|x|)/2; */ t = __ieee754_expf(fabsf(x)); return half*t+half/t; } @@ -67,6 +54,10 @@ static float one = 1.0, half=0.5, huge = 1.0e30; return t*w; } + /* x is INF or NaN */ + if(ix>=0x7f800000) return x*x; + /* |x| > overflowthresold, cosh(x) overflow */ return huge*huge; } +strong_alias (__ieee754_coshf, __coshf_finite) diff --git a/sysdeps/ieee754/flt-32/e_exp2f.c b/sysdeps/ieee754/flt-32/e_exp2f.c index 194222a..0703cea 100644 --- a/sysdeps/ieee754/flt-32/e_exp2f.c +++ b/sysdeps/ieee754/flt-32/e_exp2f.c @@ -1,5 +1,6 @@ /* Single-precision floating point 2^x. - Copyright (C) 1997,1998,2000,2001,2005,2006 Free Software Foundation, Inc. + Copyright (C) 1997,1998,2000,2001,2005,2006,2011 + Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Geoffrey Keating <geoffk@ozemail.com.au> @@ -126,3 +127,4 @@ __ieee754_exp2f (float x) /* Return x, if x is a NaN or Inf; or overflow, otherwise. */ return TWO127*x; } +strong_alias (__ieee754_exp2f, __exp2f_finite) diff --git a/sysdeps/ieee754/flt-32/e_fmodf.c b/sysdeps/ieee754/flt-32/e_fmodf.c index 47b3123..e82a9ce 100644 --- a/sysdeps/ieee754/flt-32/e_fmodf.c +++ b/sysdeps/ieee754/flt-32/e_fmodf.c @@ -8,16 +8,12 @@ * * Developed at SunPro, 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. * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: e_fmodf.c,v 1.4 1995/05/10 20:45:10 jtc Exp $"; -#endif - -/* +/* * __ieee754_fmodf(x,y) * Return x mod y in exact arithmetic * Method: shift and subtract @@ -26,18 +22,10 @@ static char rcsid[] = "$NetBSD: e_fmodf.c,v 1.4 1995/05/10 20:45:10 jtc Exp $"; #include "math.h" #include "math_private.h" -#ifdef __STDC__ static const float one = 1.0, Zero[] = {0.0, -0.0,}; -#else -static float one = 1.0, Zero[] = {0.0, -0.0,}; -#endif -#ifdef __STDC__ - float __ieee754_fmodf(float x, float y) -#else - float __ieee754_fmodf(x,y) - float x,y ; -#endif +float +__ieee754_fmodf (float x, float y) { int32_t n,hx,hy,hz,ix,iy,sx,i; @@ -66,13 +54,13 @@ static float one = 1.0, Zero[] = {0.0, -0.0,}; } else iy = (hy>>23)-127; /* set up {hx,lx}, {hy,ly} and align y to x */ - if(ix >= -126) + if(ix >= -126) hx = 0x00800000|(0x007fffff&hx); else { /* subnormal x, shift x to normal */ n = -126-ix; hx = hx<<n; } - if(iy >= -126) + if(iy >= -126) hy = 0x00800000|(0x007fffff&hy); else { /* subnormal y, shift y to normal */ n = -126-iy; @@ -85,17 +73,17 @@ static float one = 1.0, Zero[] = {0.0, -0.0,}; hz=hx-hy; if(hz<0){hx = hx+hx;} else { - if(hz==0) /* return sign(x)*0 */ + if(hz==0) /* return sign(x)*0 */ return Zero[(u_int32_t)sx>>31]; - hx = hz+hz; + hx = hz+hz; } } hz=hx-hy; if(hz>=0) {hx=hz;} /* convert back to floating value and restore the sign */ - if(hx==0) /* return sign(x)*0 */ - return Zero[(u_int32_t)sx>>31]; + if(hx==0) /* return sign(x)*0 */ + return Zero[(u_int32_t)sx>>31]; while(hx<0x00800000) { /* normalize x */ hx = hx+hx; iy -= 1; @@ -111,3 +99,4 @@ static float one = 1.0, Zero[] = {0.0, -0.0,}; } return x; /* exact output */ } +strong_alias (__ieee754_fmodf, __fmodf_finite) diff --git a/sysdeps/ieee754/flt-32/e_gammaf_r.c b/sysdeps/ieee754/flt-32/e_gammaf_r.c index 926c84f..aeeddf1 100644 --- a/sysdeps/ieee754/flt-32/e_gammaf_r.c +++ b/sysdeps/ieee754/flt-32/e_gammaf_r.c @@ -1,5 +1,5 @@ /* Implementation of gamma function according to ISO C. - Copyright (C) 1997, 1999, 2001, 2004 Free Software Foundation, Inc. + Copyright (C) 1997, 1999, 2001, 2004, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -32,19 +32,20 @@ __ieee754_gammaf_r (float x, int *signgamp) GET_FLOAT_WORD (hx, x); - if ((hx & 0x7fffffff) == 0) + if (__builtin_expect ((hx & 0x7fffffff) == 0, 0)) { /* Return value for x == 0 is Inf with divide by zero exception. */ *signgamp = 0; return 1.0 / x; } - if (hx < 0 && (u_int32_t) hx < 0xff800000 && __rintf (x) == x) + if (__builtin_expect (hx < 0, 0) + && (u_int32_t) hx < 0xff800000 && __rintf (x) == x) { /* Return value for integer x < 0 is NaN with invalid exception. */ *signgamp = 0; return (x - x) / (x - x); } - if (hx == 0xff800000) + if (__builtin_expect (hx == 0xff800000, 0)) { /* x == -Inf. According to ISO this is NaN. */ *signgamp = 0; @@ -54,3 +55,4 @@ __ieee754_gammaf_r (float x, int *signgamp) /* XXX FIXME. */ return __ieee754_expf (__ieee754_lgammaf_r (x, signgamp)); } +strong_alias (__ieee754_gammaf_r, __gammaf_r_finite) diff --git a/sysdeps/ieee754/flt-32/e_hypotf.c b/sysdeps/ieee754/flt-32/e_hypotf.c index a8e1a52..7ec8ae6 100644 --- a/sysdeps/ieee754/flt-32/e_hypotf.c +++ b/sysdeps/ieee754/flt-32/e_hypotf.c @@ -13,19 +13,11 @@ * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: e_hypotf.c,v 1.5 1995/05/12 04:57:30 jtc Exp $"; -#endif - #include "math.h" #include "math_private.h" -#ifdef __STDC__ - float __ieee754_hypotf(float x, float y) -#else - float __ieee754_hypotf(x,y) - float x, y; -#endif +float +__ieee754_hypotf(float x, float y) { float a,b,t1,t2,y1,y2,w; int32_t j,k,ha,hb; @@ -39,7 +31,7 @@ static char rcsid[] = "$NetBSD: e_hypotf.c,v 1.5 1995/05/12 04:57:30 jtc Exp $"; SET_FLOAT_WORD(b,hb); /* b <- |b| */ if((ha-hb)>0xf000000) {return a+b;} /* x/y > 2**30 */ k=0; - if(ha > 0x58800000) { /* a>2**50 */ + if(__builtin_expect(ha > 0x58800000, 0)) { /* a>2**50 */ if(ha >= 0x7f800000) { /* Inf or NaN */ w = a+b; /* for sNaN */ if(ha == 0x7f800000) w = a; @@ -51,15 +43,15 @@ static char rcsid[] = "$NetBSD: e_hypotf.c,v 1.5 1995/05/12 04:57:30 jtc Exp $"; SET_FLOAT_WORD(a,ha); SET_FLOAT_WORD(b,hb); } - if(hb < 0x26800000) { /* b < 2**-50 */ + if(__builtin_expect(hb < 0x26800000, 0)) { /* b < 2**-50 */ if(hb <= 0x007fffff) { /* subnormal b or 0 */ - if(hb==0) return a; + if(hb==0) return a; SET_FLOAT_WORD(t1,0x7e800000); /* t1=2^126 */ b *= t1; a *= t1; k -= 126; } else { /* scale a and b by 2^60 */ - ha += 0x1e000000; /* a *= 2^60 */ + ha += 0x1e000000; /* a *= 2^60 */ hb += 0x1e000000; /* b *= 2^60 */ k -= 60; SET_FLOAT_WORD(a,ha); @@ -85,3 +77,4 @@ static char rcsid[] = "$NetBSD: e_hypotf.c,v 1.5 1995/05/12 04:57:30 jtc Exp $"; return t1*w; } else return w; } +strong_alias (__ieee754_hypotf, __hypotf_finite) diff --git a/sysdeps/ieee754/flt-32/e_j0f.c b/sysdeps/ieee754/flt-32/e_j0f.c index 8c499e6..d2da43f 100644 --- a/sysdeps/ieee754/flt-32/e_j0f.c +++ b/sysdeps/ieee754/flt-32/e_j0f.c @@ -13,29 +13,17 @@ * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: e_j0f.c,v 1.4 1995/05/10 20:45:25 jtc Exp $"; -#endif - #include "math.h" #include "math_private.h" -#ifdef __STDC__ static float pzerof(float), qzerof(float); -#else -static float pzerof(), qzerof(); -#endif -#ifdef __STDC__ static const float -#else -static float -#endif -huge = 1e30, +huge = 1e30, one = 1.0, invsqrtpi= 5.6418961287e-01, /* 0x3f106ebb */ tpi = 6.3661974669e-01, /* 0x3f22f983 */ - /* R0/S0 on [0, 2.00] */ + /* R0/S0 on [0, 2.00] */ R02 = 1.5625000000e-02, /* 0x3c800000 */ R03 = -1.8997929874e-04, /* 0xb947352e */ R04 = 1.8295404516e-06, /* 0x35f58e88 */ @@ -45,18 +33,10 @@ S02 = 1.1692678527e-04, /* 0x38f53697 */ S03 = 5.1354652442e-07, /* 0x3509daa6 */ S04 = 1.1661400734e-09; /* 0x30a045e8 */ -#ifdef __STDC__ static const float zero = 0.0; -#else -static float zero = 0.0; -#endif -#ifdef __STDC__ - float __ieee754_j0f(float x) -#else - float __ieee754_j0f(x) - float x; -#endif +float +__ieee754_j0f(float x) { float z, s,c,ss,cc,r,u,v; int32_t hx,ix; @@ -72,7 +52,7 @@ static float zero = 0.0; if(ix<0x7f000000) { /* make sure x+x not overflow */ z = -__cosf(x+x); if ((s*c)<zero) cc = z/ss; - else ss = z/cc; + else ss = z/cc; } /* * j0(x) = 1/sqrt(pi) * (P(0,x)*cc - Q(0,x)*ss) / sqrt(x) @@ -87,8 +67,8 @@ static float zero = 0.0; } if(ix<0x39000000) { /* |x| < 2**-13 */ if(huge+x>one) { /* raise inexact if x != 0 */ - if(ix<0x32000000) return one; /* |x|<2**-27 */ - else return one - (float)0.25*x*x; + if(ix<0x32000000) return one; /* |x|<2**-27 */ + else return one - (float)0.25*x*x; } } z = x*x; @@ -101,12 +81,9 @@ static float zero = 0.0; return((one+u)*(one-u)+z*(r/s)); } } +strong_alias (__ieee754_j0f, __j0f_finite) -#ifdef __STDC__ static const float -#else -static float -#endif u00 = -7.3804296553e-02, /* 0xbd9726b5 */ u01 = 1.7666645348e-01, /* 0x3e34e80d */ u02 = -1.3818567619e-02, /* 0xbc626746 */ @@ -119,52 +96,48 @@ v02 = 7.6006865129e-05, /* 0x389f65e0 */ v03 = 2.5915085189e-07, /* 0x348b216c */ v04 = 4.4111031494e-10; /* 0x2ff280c2 */ -#ifdef __STDC__ - float __ieee754_y0f(float x) -#else - float __ieee754_y0f(x) - float x; -#endif +float +__ieee754_y0f(float x) { float z, s,c,ss,cc,u,v; int32_t hx,ix; GET_FLOAT_WORD(hx,x); - ix = 0x7fffffff&hx; + ix = 0x7fffffff&hx; /* Y0(NaN) is NaN, y0(-inf) is Nan, y0(inf) is 0, y0(0) is -inf. */ if(ix>=0x7f800000) return one/(x+x*x); - if(ix==0) return -HUGE_VALF+x; /* -inf and overflow exception. */ - if(hx<0) return zero/(zero*x); - if(ix >= 0x40000000) { /* |x| >= 2.0 */ - /* y0(x) = sqrt(2/(pi*x))*(p0(x)*sin(x0)+q0(x)*cos(x0)) - * where x0 = x-pi/4 - * Better formula: - * cos(x0) = cos(x)cos(pi/4)+sin(x)sin(pi/4) - * = 1/sqrt(2) * (sin(x) + cos(x)) - * sin(x0) = sin(x)cos(3pi/4)-cos(x)sin(3pi/4) - * = 1/sqrt(2) * (sin(x) - cos(x)) - * To avoid cancellation, use - * sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x)) - * to compute the worse one. - */ + if(ix==0) return -HUGE_VALF+x; /* -inf and overflow exception. */ + if(hx<0) return zero/(zero*x); + if(ix >= 0x40000000) { /* |x| >= 2.0 */ + /* y0(x) = sqrt(2/(pi*x))*(p0(x)*sin(x0)+q0(x)*cos(x0)) + * where x0 = x-pi/4 + * Better formula: + * cos(x0) = cos(x)cos(pi/4)+sin(x)sin(pi/4) + * = 1/sqrt(2) * (sin(x) + cos(x)) + * sin(x0) = sin(x)cos(3pi/4)-cos(x)sin(3pi/4) + * = 1/sqrt(2) * (sin(x) - cos(x)) + * To avoid cancellation, use + * sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x)) + * to compute the worse one. + */ __sincosf (x, &s, &c); - ss = s-c; - cc = s+c; + ss = s-c; + cc = s+c; /* * j0(x) = 1/sqrt(pi) * (P(0,x)*cc - Q(0,x)*ss) / sqrt(x) * y0(x) = 1/sqrt(pi) * (P(0,x)*ss + Q(0,x)*cc) / sqrt(x) */ - if(ix<0x7f000000) { /* make sure x+x not overflow */ - z = -__cosf(x+x); - if ((s*c)<zero) cc = z/ss; - else ss = z/cc; - } - if(ix>0x48000000) z = (invsqrtpi*ss)/__ieee754_sqrtf(x); - else { - u = pzerof(x); v = qzerof(x); - z = invsqrtpi*(u*ss+v*cc)/__ieee754_sqrtf(x); - } - return z; + if(ix<0x7f000000) { /* make sure x+x not overflow */ + z = -__cosf(x+x); + if ((s*c)<zero) cc = z/ss; + else ss = z/cc; + } + if(ix>0x48000000) z = (invsqrtpi*ss)/__ieee754_sqrtf(x); + else { + u = pzerof(x); v = qzerof(x); + z = invsqrtpi*(u*ss+v*cc)/__ieee754_sqrtf(x); + } + return z; } if(ix<=0x32000000) { /* x < 2**-27 */ return(u00 + tpi*__ieee754_logf(x)); @@ -174,21 +147,18 @@ v04 = 4.4111031494e-10; /* 0x2ff280c2 */ v = one+z*(v01+z*(v02+z*(v03+z*v04))); return(u/v + tpi*(__ieee754_j0f(x)*__ieee754_logf(x))); } +strong_alias (__ieee754_y0f, __y0f_finite) /* The asymptotic expansions of pzero is * 1 - 9/128 s^2 + 11025/98304 s^4 - ..., where s = 1/x. * For x >= 2, We approximate pzero by - * pzero(x) = 1 + (R/S) + * pzero(x) = 1 + (R/S) * where R = pR0 + pR1*s^2 + pR2*s^4 + ... + pR5*s^10 - * S = 1 + pS0*s^2 + ... + pS4*s^10 + * S = 1 + pS0*s^2 + ... + pS4*s^10 * and * | pzero(x)-1-R/S | <= 2 ** ( -60.26) */ -#ifdef __STDC__ static const float pR8[6] = { /* for x in [inf, 8]=1/[0,0.125] */ -#else -static float pR8[6] = { /* for x in [inf, 8]=1/[0,0.125] */ -#endif 0.0000000000e+00, /* 0x00000000 */ -7.0312500000e-02, /* 0xbd900000 */ -8.0816707611e+00, /* 0xc1014e86 */ @@ -196,22 +166,14 @@ static float pR8[6] = { /* for x in [inf, 8]=1/[0,0.125] */ -2.4852163086e+03, /* 0xc51b5376 */ -5.2530439453e+03, /* 0xc5a4285a */ }; -#ifdef __STDC__ static const float pS8[5] = { -#else -static float pS8[5] = { -#endif 1.1653436279e+02, /* 0x42e91198 */ 3.8337448730e+03, /* 0x456f9beb */ 4.0597855469e+04, /* 0x471e95db */ 1.1675296875e+05, /* 0x47e4087c */ 4.7627726562e+04, /* 0x473a0bba */ }; -#ifdef __STDC__ static const float pR5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */ -#else -static float pR5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */ -#endif -1.1412546255e-11, /* 0xad48c58a */ -7.0312492549e-02, /* 0xbd8fffff */ -4.1596107483e+00, /* 0xc0851b88 */ @@ -219,11 +181,7 @@ static float pR5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */ -3.3123129272e+02, /* 0xc3a59d9b */ -3.4643338013e+02, /* 0xc3ad3779 */ }; -#ifdef __STDC__ static const float pS5[5] = { -#else -static float pS5[5] = { -#endif 6.0753936768e+01, /* 0x42730408 */ 1.0512523193e+03, /* 0x44836813 */ 5.9789707031e+03, /* 0x45bad7c4 */ @@ -231,11 +189,7 @@ static float pS5[5] = { 2.4060581055e+03, /* 0x451660ee */ }; -#ifdef __STDC__ static const float pR3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */ -#else -static float pR3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */ -#endif -2.5470459075e-09, /* 0xb12f081b */ -7.0311963558e-02, /* 0xbd8fffb8 */ -2.4090321064e+00, /* 0xc01a2d95 */ @@ -243,11 +197,7 @@ static float pR3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */ -5.8079170227e+01, /* 0xc2685112 */ -3.1447946548e+01, /* 0xc1fb9565 */ }; -#ifdef __STDC__ static const float pS3[5] = { -#else -static float pS3[5] = { -#endif 3.5856033325e+01, /* 0x420f6c94 */ 3.6151397705e+02, /* 0x43b4c1ca */ 1.1936077881e+03, /* 0x44953373 */ @@ -255,11 +205,7 @@ static float pS3[5] = { 1.7358093262e+02, /* 0x432d94b8 */ }; -#ifdef __STDC__ static const float pR2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */ -#else -static float pR2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */ -#endif -8.8753431271e-08, /* 0xb3be98b7 */ -7.0303097367e-02, /* 0xbd8ffb12 */ -1.4507384300e+00, /* 0xbfb9b1cc */ @@ -267,11 +213,7 @@ static float pR2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */ -1.1193166733e+01, /* 0xc1331736 */ -3.2336456776e+00, /* 0xc04ef40d */ }; -#ifdef __STDC__ static const float pS2[5] = { -#else -static float pS2[5] = { -#endif 2.2220300674e+01, /* 0x41b1c32d */ 1.3620678711e+02, /* 0x430834f0 */ 2.7047027588e+02, /* 0x43873c32 */ @@ -279,18 +221,10 @@ static float pS2[5] = { 1.4657617569e+01, /* 0x416a859a */ }; -#ifdef __STDC__ - static float pzerof(float x) -#else - static float pzerof(x) - float x; -#endif +static float +pzerof(float x) { -#ifdef __STDC__ const float *p,*q; -#else - float *p,*q; -#endif float z,r,s; int32_t ix; GET_FLOAT_WORD(ix,x); @@ -309,17 +243,13 @@ static float pS2[5] = { /* For x >= 8, the asymptotic expansions of qzero is * -1/8 s + 75/1024 s^3 - ..., where s = 1/x. * We approximate pzero by - * qzero(x) = s*(-1.25 + (R/S)) + * qzero(x) = s*(-1.25 + (R/S)) * where R = qR0 + qR1*s^2 + qR2*s^4 + ... + qR5*s^10 - * S = 1 + qS0*s^2 + ... + qS5*s^12 + * S = 1 + qS0*s^2 + ... + qS5*s^12 * and * | qzero(x)/s +1.25-R/S | <= 2 ** ( -61.22) */ -#ifdef __STDC__ static const float qR8[6] = { /* for x in [inf, 8]=1/[0,0.125] */ -#else -static float qR8[6] = { /* for x in [inf, 8]=1/[0,0.125] */ -#endif 0.0000000000e+00, /* 0x00000000 */ 7.3242187500e-02, /* 0x3d960000 */ 1.1768206596e+01, /* 0x413c4a93 */ @@ -327,11 +257,7 @@ static float qR8[6] = { /* for x in [inf, 8]=1/[0,0.125] */ 8.8591972656e+03, /* 0x460a6cca */ 3.7014625000e+04, /* 0x471096a0 */ }; -#ifdef __STDC__ static const float qS8[6] = { -#else -static float qS8[6] = { -#endif 1.6377603149e+02, /* 0x4323c6aa */ 8.0983447266e+03, /* 0x45fd12c2 */ 1.4253829688e+05, /* 0x480b3293 */ @@ -340,11 +266,7 @@ static float qS8[6] = { -3.4389928125e+05, /* 0xc8a7eb69 */ }; -#ifdef __STDC__ static const float qR5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */ -#else -static float qR5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */ -#endif 1.8408595828e-11, /* 0x2da1ec79 */ 7.3242180049e-02, /* 0x3d95ffff */ 5.8356351852e+00, /* 0x40babd86 */ @@ -352,11 +274,7 @@ static float qR5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */ 1.0272437744e+03, /* 0x448067cd */ 1.9899779053e+03, /* 0x44f8bf4b */ }; -#ifdef __STDC__ static const float qS5[6] = { -#else -static float qS5[6] = { -#endif 8.2776611328e+01, /* 0x42a58da0 */ 2.0778142090e+03, /* 0x4501dd07 */ 1.8847289062e+04, /* 0x46933e94 */ @@ -365,11 +283,7 @@ static float qS5[6] = { -5.3543427734e+03, /* 0xc5a752be */ }; -#ifdef __STDC__ static const float qR3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */ -#else -static float qR3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */ -#endif 4.3774099900e-09, /* 0x3196681b */ 7.3241114616e-02, /* 0x3d95ff70 */ 3.3442313671e+00, /* 0x405607e3 */ @@ -377,11 +291,7 @@ static float qR3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */ 1.7080809021e+02, /* 0x432acedf */ 1.6673394775e+02, /* 0x4326bbe4 */ }; -#ifdef __STDC__ static const float qS3[6] = { -#else -static float qS3[6] = { -#endif 4.8758872986e+01, /* 0x42430916 */ 7.0968920898e+02, /* 0x44316c1c */ 3.7041481934e+03, /* 0x4567825f */ @@ -390,11 +300,7 @@ static float qS3[6] = { -1.4924745178e+02, /* 0xc3153f59 */ }; -#ifdef __STDC__ static const float qR2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */ -#else -static float qR2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */ -#endif 1.5044444979e-07, /* 0x342189db */ 7.3223426938e-02, /* 0x3d95f62a */ 1.9981917143e+00, /* 0x3fffc4bf */ @@ -402,11 +308,7 @@ static float qR2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */ 3.1666231155e+01, /* 0x41fd5471 */ 1.6252708435e+01, /* 0x4182058c */ }; -#ifdef __STDC__ static const float qS2[6] = { -#else -static float qS2[6] = { -#endif 3.0365585327e+01, /* 0x41f2ecb8 */ 2.6934811401e+02, /* 0x4386ac8f */ 8.4478375244e+02, /* 0x44533229 */ @@ -415,18 +317,10 @@ static float qS2[6] = { -5.3109550476e+00, /* 0xc0a9f358 */ }; -#ifdef __STDC__ - static float qzerof(float x) -#else - static float qzerof(x) - float x; -#endif +static float +qzerof(float x) { -#ifdef __STDC__ const float *p,*q; -#else - float *p,*q; -#endif float s,r,z; int32_t ix; GET_FLOAT_WORD(ix,x); diff --git a/sysdeps/ieee754/flt-32/e_j1f.c b/sysdeps/ieee754/flt-32/e_j1f.c index 71bb251..bb335a7 100644 --- a/sysdeps/ieee754/flt-32/e_j1f.c +++ b/sysdeps/ieee754/flt-32/e_j1f.c @@ -13,24 +13,12 @@ * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: e_j1f.c,v 1.4 1995/05/10 20:45:31 jtc Exp $"; -#endif - #include "math.h" #include "math_private.h" -#ifdef __STDC__ static float ponef(float), qonef(float); -#else -static float ponef(), qonef(); -#endif -#ifdef __STDC__ static const float -#else -static float -#endif huge = 1e30, one = 1.0, invsqrtpi= 5.6418961287e-01, /* 0x3f106ebb */ @@ -46,25 +34,17 @@ s03 = 1.1771846857e-06, /* 0x359dffc2 */ s04 = 5.0463624390e-09, /* 0x31ad6446 */ s05 = 1.2354227016e-11; /* 0x2d59567e */ -#ifdef __STDC__ static const float zero = 0.0; -#else -static float zero = 0.0; -#endif -#ifdef __STDC__ - float __ieee754_j1f(float x) -#else - float __ieee754_j1f(x) - float x; -#endif +float +__ieee754_j1f(float x) { float z, s,c,ss,cc,r,u,v,y; int32_t hx,ix; GET_FLOAT_WORD(hx,x); ix = hx&0x7fffffff; - if(ix>=0x7f800000) return one/x; + if(__builtin_expect(ix>=0x7f800000, 0)) return one/x; y = fabsf(x); if(ix >= 0x40000000) { /* |x| >= 2.0 */ __sincosf (y, &s, &c); @@ -73,7 +53,7 @@ static float zero = 0.0; if(ix<0x7f000000) { /* make sure y+y not overflow */ z = __cosf(y+y); if ((s*c)>zero) cc = z/ss; - else ss = z/cc; + else ss = z/cc; } /* * j1(x) = 1/sqrt(pi) * (P(1,x)*cc - Q(1,x)*ss) / sqrt(x) @@ -85,9 +65,9 @@ static float zero = 0.0; z = invsqrtpi*(u*cc-v*ss)/__ieee754_sqrtf(y); } if(hx<0) return -z; - else return z; + else return z; } - if(ix<0x32000000) { /* |x|<2**-27 */ + if(__builtin_expect(ix<0x32000000, 0)) { /* |x|<2**-27 */ if(huge+x>one) return (float)0.5*x;/* inexact if x!=0 necessary */ } z = x*x; @@ -96,23 +76,16 @@ static float zero = 0.0; r *= x; return(x*(float)0.5+r/s); } +strong_alias (__ieee754_j1f, __j1f_finite) -#ifdef __STDC__ static const float U0[5] = { -#else -static float U0[5] = { -#endif -1.9605709612e-01, /* 0xbe48c331 */ 5.0443872809e-02, /* 0x3d4e9e3c */ -1.9125689287e-03, /* 0xbafaaf2a */ 2.3525259166e-05, /* 0x37c5581c */ -9.1909917899e-08, /* 0xb3c56003 */ }; -#ifdef __STDC__ static const float V0[5] = { -#else -static float V0[5] = { -#endif 1.9916731864e-02, /* 0x3ca3286a */ 2.0255257550e-04, /* 0x3954644b */ 1.3560879779e-06, /* 0x35b602d4 */ @@ -120,73 +93,67 @@ static float V0[5] = { 1.6655924903e-11, /* 0x2d9281cf */ }; -#ifdef __STDC__ - float __ieee754_y1f(float x) -#else - float __ieee754_y1f(x) - float x; -#endif +float +__ieee754_y1f(float x) { float z, s,c,ss,cc,u,v; int32_t hx,ix; GET_FLOAT_WORD(hx,x); - ix = 0x7fffffff&hx; + ix = 0x7fffffff&hx; /* if Y1(NaN) is NaN, Y1(-inf) is NaN, Y1(inf) is 0 */ - if(ix>=0x7f800000) return one/(x+x*x); - if(ix==0) return -HUGE_VALF+x; /* -inf and overflow exception. */ - if(hx<0) return zero/(zero*x); - if(ix >= 0x40000000) { /* |x| >= 2.0 */ + if(__builtin_expect(ix>=0x7f800000, 0)) return one/(x+x*x); + if(__builtin_expect(ix==0, 0)) + return -HUGE_VALF+x; /* -inf and overflow exception. */ + if(__builtin_expect(hx<0, 0)) return zero/(zero*x); + if(ix >= 0x40000000) { /* |x| >= 2.0 */ __sincosf (x, &s, &c); - ss = -s-c; - cc = s-c; - if(ix<0x7f000000) { /* make sure x+x not overflow */ - z = __cosf(x+x); - if ((s*c)>zero) cc = z/ss; - else ss = z/cc; - } - /* y1(x) = sqrt(2/(pi*x))*(p1(x)*sin(x0)+q1(x)*cos(x0)) - * where x0 = x-3pi/4 - * Better formula: - * cos(x0) = cos(x)cos(3pi/4)+sin(x)sin(3pi/4) - * = 1/sqrt(2) * (sin(x) - cos(x)) - * sin(x0) = sin(x)cos(3pi/4)-cos(x)sin(3pi/4) - * = -1/sqrt(2) * (cos(x) + sin(x)) - * To avoid cancellation, use - * sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x)) - * to compute the worse one. - */ - if(ix>0x48000000) z = (invsqrtpi*ss)/__ieee754_sqrtf(x); - else { - u = ponef(x); v = qonef(x); - z = invsqrtpi*(u*ss+v*cc)/__ieee754_sqrtf(x); - } - return z; - } - if(ix<=0x24800000) { /* x < 2**-54 */ - return(-tpi/x); - } - z = x*x; - u = U0[0]+z*(U0[1]+z*(U0[2]+z*(U0[3]+z*U0[4]))); - v = one+z*(V0[0]+z*(V0[1]+z*(V0[2]+z*(V0[3]+z*V0[4])))); - return(x*(u/v) + tpi*(__ieee754_j1f(x)*__ieee754_logf(x)-one/x)); + ss = -s-c; + cc = s-c; + if(ix<0x7f000000) { /* make sure x+x not overflow */ + z = __cosf(x+x); + if ((s*c)>zero) cc = z/ss; + else ss = z/cc; + } + /* y1(x) = sqrt(2/(pi*x))*(p1(x)*sin(x0)+q1(x)*cos(x0)) + * where x0 = x-3pi/4 + * Better formula: + * cos(x0) = cos(x)cos(3pi/4)+sin(x)sin(3pi/4) + * = 1/sqrt(2) * (sin(x) - cos(x)) + * sin(x0) = sin(x)cos(3pi/4)-cos(x)sin(3pi/4) + * = -1/sqrt(2) * (cos(x) + sin(x)) + * To avoid cancellation, use + * sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x)) + * to compute the worse one. + */ + if(ix>0x48000000) z = (invsqrtpi*ss)/__ieee754_sqrtf(x); + else { + u = ponef(x); v = qonef(x); + z = invsqrtpi*(u*ss+v*cc)/__ieee754_sqrtf(x); + } + return z; + } + if(__builtin_expect(ix<=0x24800000, 0)) { /* x < 2**-54 */ + return(-tpi/x); + } + z = x*x; + u = U0[0]+z*(U0[1]+z*(U0[2]+z*(U0[3]+z*U0[4]))); + v = one+z*(V0[0]+z*(V0[1]+z*(V0[2]+z*(V0[3]+z*V0[4])))); + return(x*(u/v) + tpi*(__ieee754_j1f(x)*__ieee754_logf(x)-one/x)); } +strong_alias (__ieee754_y1f, __y1f_finite) /* For x >= 8, the asymptotic expansions of pone is * 1 + 15/128 s^2 - 4725/2^15 s^4 - ..., where s = 1/x. * We approximate pone by - * pone(x) = 1 + (R/S) + * pone(x) = 1 + (R/S) * where R = pr0 + pr1*s^2 + pr2*s^4 + ... + pr5*s^10 - * S = 1 + ps0*s^2 + ... + ps4*s^10 + * S = 1 + ps0*s^2 + ... + ps4*s^10 * and * | pone(x)-1-R/S | <= 2 ** ( -60.06) */ -#ifdef __STDC__ static const float pr8[6] = { /* for x in [inf, 8]=1/[0,0.125] */ -#else -static float pr8[6] = { /* for x in [inf, 8]=1/[0,0.125] */ -#endif 0.0000000000e+00, /* 0x00000000 */ 1.1718750000e-01, /* 0x3df00000 */ 1.3239480972e+01, /* 0x4153d4ea */ @@ -194,11 +161,7 @@ static float pr8[6] = { /* for x in [inf, 8]=1/[0,0.125] */ 3.8747453613e+03, /* 0x45722bed */ 7.9144794922e+03, /* 0x45f753d6 */ }; -#ifdef __STDC__ static const float ps8[5] = { -#else -static float ps8[5] = { -#endif 1.1420736694e+02, /* 0x42e46a2c */ 3.6509309082e+03, /* 0x45642ee5 */ 3.6956207031e+04, /* 0x47105c35 */ @@ -206,11 +169,7 @@ static float ps8[5] = { 3.0804271484e+04, /* 0x46f0a88b */ }; -#ifdef __STDC__ static const float pr5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */ -#else -static float pr5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */ -#endif 1.3199052094e-11, /* 0x2d68333f */ 1.1718749255e-01, /* 0x3defffff */ 6.8027510643e+00, /* 0x40d9b023 */ @@ -218,11 +177,7 @@ static float pr5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */ 5.1763616943e+02, /* 0x440168b7 */ 5.2871520996e+02, /* 0x44042dc6 */ }; -#ifdef __STDC__ static const float ps5[5] = { -#else -static float ps5[5] = { -#endif 5.9280597687e+01, /* 0x426d1f55 */ 9.9140142822e+02, /* 0x4477d9b1 */ 5.3532670898e+03, /* 0x45a74a23 */ @@ -230,11 +185,7 @@ static float ps5[5] = { 1.5040468750e+03, /* 0x44bc0180 */ }; -#ifdef __STDC__ static const float pr3[6] = { -#else -static float pr3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */ -#endif 3.0250391081e-09, /* 0x314fe10d */ 1.1718686670e-01, /* 0x3defffab */ 3.9329774380e+00, /* 0x407bb5e7 */ @@ -242,11 +193,7 @@ static float pr3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */ 9.1055007935e+01, /* 0x42b61c2a */ 4.8559066772e+01, /* 0x42423c7c */ }; -#ifdef __STDC__ static const float ps3[5] = { -#else -static float ps3[5] = { -#endif 3.4791309357e+01, /* 0x420b2a4d */ 3.3676245117e+02, /* 0x43a86198 */ 1.0468714600e+03, /* 0x4482dbe3 */ @@ -254,11 +201,7 @@ static float ps3[5] = { 1.0378793335e+02, /* 0x42cf936c */ }; -#ifdef __STDC__ static const float pr2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */ -#else -static float pr2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */ -#endif 1.0771083225e-07, /* 0x33e74ea8 */ 1.1717621982e-01, /* 0x3deffa16 */ 2.3685150146e+00, /* 0x401795c0 */ @@ -266,11 +209,7 @@ static float pr2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */ 1.7693971634e+01, /* 0x418d8d41 */ 5.0735230446e+00, /* 0x40a25a4d */ }; -#ifdef __STDC__ static const float ps2[5] = { -#else -static float ps2[5] = { -#endif 2.1436485291e+01, /* 0x41ab7dec */ 1.2529022980e+02, /* 0x42fa9499 */ 2.3227647400e+02, /* 0x436846c7 */ @@ -278,48 +217,36 @@ static float ps2[5] = { 8.3646392822e+00, /* 0x4105d590 */ }; -#ifdef __STDC__ - static float ponef(float x) -#else - static float ponef(x) - float x; -#endif +static float +ponef(float x) { -#ifdef __STDC__ const float *p,*q; -#else - float *p,*q; -#endif float z,r,s; - int32_t ix; + int32_t ix; GET_FLOAT_WORD(ix,x); ix &= 0x7fffffff; - if(ix>=0x41000000) {p = pr8; q= ps8;} - else if(ix>=0x40f71c58){p = pr5; q= ps5;} - else if(ix>=0x4036db68){p = pr3; q= ps3;} - else if(ix>=0x40000000){p = pr2; q= ps2;} - z = one/(x*x); - r = p[0]+z*(p[1]+z*(p[2]+z*(p[3]+z*(p[4]+z*p[5])))); - s = one+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*q[4])))); - return one+ r/s; + if(ix>=0x41000000) {p = pr8; q= ps8;} + else if(ix>=0x40f71c58){p = pr5; q= ps5;} + else if(ix>=0x4036db68){p = pr3; q= ps3;} + else if(ix>=0x40000000){p = pr2; q= ps2;} + z = one/(x*x); + r = p[0]+z*(p[1]+z*(p[2]+z*(p[3]+z*(p[4]+z*p[5])))); + s = one+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*q[4])))); + return one+ r/s; } /* For x >= 8, the asymptotic expansions of qone is * 3/8 s - 105/1024 s^3 - ..., where s = 1/x. * We approximate pone by - * qone(x) = s*(0.375 + (R/S)) + * qone(x) = s*(0.375 + (R/S)) * where R = qr1*s^2 + qr2*s^4 + ... + qr5*s^10 - * S = 1 + qs1*s^2 + ... + qs6*s^12 + * S = 1 + qs1*s^2 + ... + qs6*s^12 * and * | qone(x)/s -0.375-R/S | <= 2 ** ( -61.13) */ -#ifdef __STDC__ static const float qr8[6] = { /* for x in [inf, 8]=1/[0,0.125] */ -#else -static float qr8[6] = { /* for x in [inf, 8]=1/[0,0.125] */ -#endif 0.0000000000e+00, /* 0x00000000 */ -1.0253906250e-01, /* 0xbdd20000 */ -1.6271753311e+01, /* 0xc1822c8d */ @@ -327,11 +254,7 @@ static float qr8[6] = { /* for x in [inf, 8]=1/[0,0.125] */ -1.1849806641e+04, /* 0xc639273a */ -4.8438511719e+04, /* 0xc73d3683 */ }; -#ifdef __STDC__ static const float qs8[6] = { -#else -static float qs8[6] = { -#endif 1.6139537048e+02, /* 0x43216537 */ 7.8253862305e+03, /* 0x45f48b17 */ 1.3387534375e+05, /* 0x4802bcd6 */ @@ -340,11 +263,7 @@ static float qs8[6] = { -2.9449025000e+05, /* 0xc88fcb48 */ }; -#ifdef __STDC__ static const float qr5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */ -#else -static float qr5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */ -#endif -2.0897993405e-11, /* 0xadb7d219 */ -1.0253904760e-01, /* 0xbdd1fffe */ -8.0564479828e+00, /* 0xc100e736 */ @@ -352,11 +271,7 @@ static float qr5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */ -1.3731937256e+03, /* 0xc4aba633 */ -2.6124443359e+03, /* 0xc523471c */ }; -#ifdef __STDC__ static const float qs5[6] = { -#else -static float qs5[6] = { -#endif 8.1276550293e+01, /* 0x42a28d98 */ 1.9917987061e+03, /* 0x44f8f98f */ 1.7468484375e+04, /* 0x468878f8 */ @@ -365,11 +280,7 @@ static float qs5[6] = { -4.7191835938e+03, /* 0xc5937978 */ }; -#ifdef __STDC__ static const float qr3[6] = { -#else -static float qr3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */ -#endif -5.0783124372e-09, /* 0xb1ae7d4f */ -1.0253783315e-01, /* 0xbdd1ff5b */ -4.6101160049e+00, /* 0xc0938612 */ @@ -377,11 +288,7 @@ static float qr3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */ -2.2824453735e+02, /* 0xc3643e9a */ -2.1921012878e+02, /* 0xc35b35cb */ }; -#ifdef __STDC__ static const float qs3[6] = { -#else -static float qs3[6] = { -#endif 4.7665153503e+01, /* 0x423ea91e */ 6.7386511230e+02, /* 0x4428775e */ 3.3801528320e+03, /* 0x45534272 */ @@ -390,11 +297,7 @@ static float qs3[6] = { -1.3520118713e+02, /* 0xc3073381 */ }; -#ifdef __STDC__ static const float qr2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */ -#else -static float qr2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */ -#endif -1.7838172539e-07, /* 0xb43f8932 */ -1.0251704603e-01, /* 0xbdd1f475 */ -2.7522056103e+00, /* 0xc0302423 */ @@ -402,11 +305,7 @@ static float qr2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */ -4.2325313568e+01, /* 0xc2294d1f */ -2.1371921539e+01, /* 0xc1aaf9b2 */ }; -#ifdef __STDC__ static const float qs2[6] = { -#else -static float qs2[6] = { -#endif 2.9533363342e+01, /* 0x41ec4454 */ 2.5298155212e+02, /* 0x437cfb47 */ 7.5750280762e+02, /* 0x443d602e */ @@ -415,18 +314,10 @@ static float qs2[6] = { -4.9594988823e+00, /* 0xc09eb437 */ }; -#ifdef __STDC__ - static float qonef(float x) -#else - static float qonef(x) - float x; -#endif +static float +qonef(float x) { -#ifdef __STDC__ const float *p,*q; -#else - float *p,*q; -#endif float s,r,z; int32_t ix; GET_FLOAT_WORD(ix,x); diff --git a/sysdeps/ieee754/flt-32/e_jnf.c b/sysdeps/ieee754/flt-32/e_jnf.c index dd3d551..1e55485 100644 --- a/sysdeps/ieee754/flt-32/e_jnf.c +++ b/sysdeps/ieee754/flt-32/e_jnf.c @@ -13,33 +13,17 @@ * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: e_jnf.c,v 1.5 1995/05/10 20:45:37 jtc Exp $"; -#endif - #include "math.h" #include "math_private.h" -#ifdef __STDC__ static const float -#else -static float -#endif two = 2.0000000000e+00, /* 0x40000000 */ one = 1.0000000000e+00; /* 0x3F800000 */ -#ifdef __STDC__ static const float zero = 0.0000000000e+00; -#else -static float zero = 0.0000000000e+00; -#endif -#ifdef __STDC__ - float __ieee754_jnf(int n, float x) -#else - float __ieee754_jnf(n,x) - int n; float x; -#endif +float +__ieee754_jnf(int n, float x) { int32_t i,hx,ix, sgn; float a, b, temp, di; @@ -51,7 +35,7 @@ static float zero = 0.0000000000e+00; GET_FLOAT_WORD(hx,x); ix = 0x7fffffff&hx; /* if J(n,NaN) is NaN */ - if(ix>0x7f800000) return x+x; + if(__builtin_expect(ix>0x7f800000, 0)) return x+x; if(n<0){ n = -n; x = -x; @@ -61,7 +45,7 @@ static float zero = 0.0000000000e+00; if(n==1) return(__ieee754_j1f(x)); sgn = (n&1)&(hx>>31); /* even n -- 0, odd n -- sign(x) */ x = fabsf(x); - if(ix==0||ix>=0x7f800000) /* if x is 0 or inf */ + if(__builtin_expect(ix==0||ix>=0x7f800000, 0)) /* if x is 0 or inf */ b = zero; else if((float)n<=x) { /* Safe to use J(n+1,x)=2n/x *J(n,x)-J(n-1,x) */ @@ -106,7 +90,7 @@ static float zero = 0.0000000000e+00; * 1 * w - ----------------- * 1 - * w+h - --------- + * w+h - --------- * w+2h - ... * * To determine how many terms needed, let @@ -144,18 +128,18 @@ static float zero = 0.0000000000e+00; tmp = tmp*__ieee754_logf(fabsf(v*tmp)); if(tmp<(float)8.8721679688e+01) { for(i=n-1,di=(float)(i+i);i>0;i--){ - temp = b; + temp = b; b *= di; b = b/x - a; - a = temp; + a = temp; di -= two; } } else { for(i=n-1,di=(float)(i+i);i>0;i--){ - temp = b; + temp = b; b *= di; b = b/x - a; - a = temp; + a = temp; di -= two; /* scale b to avoid spurious overflow */ if(b>(float)1e10) { @@ -179,13 +163,10 @@ static float zero = 0.0000000000e+00; } if(sgn==1) return -b; else return b; } +strong_alias (__ieee754_jnf, __jnf_finite) -#ifdef __STDC__ - float __ieee754_ynf(int n, float x) -#else - float __ieee754_ynf(n,x) - int n; float x; -#endif +float +__ieee754_ynf(int n, float x) { int32_t i,hx,ix; u_int32_t ib; @@ -195,9 +176,10 @@ static float zero = 0.0000000000e+00; GET_FLOAT_WORD(hx,x); ix = 0x7fffffff&hx; /* if Y(n,NaN) is NaN */ - if(ix>0x7f800000) return x+x; - if(ix==0) return -HUGE_VALF+x; /* -inf and overflow exception. */ - if(hx<0) return zero/(zero*x); + if(__builtin_expect(ix>0x7f800000, 0)) return x+x; + if(__builtin_expect(ix==0, 0)) + return -HUGE_VALF+x; /* -inf and overflow exception. */ + if(__builtin_expect(hx<0, 0)) return zero/(zero*x); sign = 1; if(n<0){ n = -n; @@ -205,7 +187,7 @@ static float zero = 0.0000000000e+00; } if(n==0) return(__ieee754_y0f(x)); if(n==1) return(sign*__ieee754_y1f(x)); - if(ix==0x7f800000) return zero; + if(__builtin_expect(ix==0x7f800000, 0)) return zero; a = __ieee754_y0f(x); b = __ieee754_y1f(x); @@ -219,3 +201,4 @@ static float zero = 0.0000000000e+00; } if(sign>0) return b; else return -b; } +strong_alias (__ieee754_ynf, __ynf_finite) diff --git a/sysdeps/ieee754/flt-32/e_lgammaf_r.c b/sysdeps/ieee754/flt-32/e_lgammaf_r.c index 0ed2610..cbee9db 100644 --- a/sysdeps/ieee754/flt-32/e_lgammaf_r.c +++ b/sysdeps/ieee754/flt-32/e_lgammaf_r.c @@ -13,18 +13,10 @@ * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: e_lgammaf_r.c,v 1.3 1995/05/10 20:45:47 jtc Exp $"; -#endif - #include "math.h" #include "math_private.h" -#ifdef __STDC__ static const float -#else -static float -#endif two23= 8.3886080000e+06, /* 0x4b000000 */ half= 5.0000000000e-01, /* 0x3f000000 */ one = 1.0000000000e+00, /* 0x3f800000 */ @@ -92,18 +84,10 @@ w4 = -5.9518753551e-04, /* 0xba1c065c */ w5 = 8.3633989561e-04, /* 0x3a5b3dd2 */ w6 = -1.6309292987e-03; /* 0xbad5c4e8 */ -#ifdef __STDC__ static const float zero= 0.0000000000e+00; -#else -static float zero= 0.0000000000e+00; -#endif -#ifdef __STDC__ - static float sin_pif(float x) -#else - static float sin_pif(x) - float x; -#endif +static float +sin_pif(float x) { float y,z; int n,ix; @@ -124,16 +108,16 @@ static float zero= 0.0000000000e+00; y = (float)2.0*(y - __floorf(y)); /* y = |x| mod 2.0 */ n = (int) (y*(float)4.0); } else { - if(ix>=0x4b800000) { - y = zero; n = 0; /* y must be even */ - } else { - if(ix<0x4b000000) z = y+two23; /* exact */ + if(ix>=0x4b800000) { + y = zero; n = 0; /* y must be even */ + } else { + if(ix<0x4b000000) z = y+two23; /* exact */ GET_FLOAT_WORD(n,z); n &= 1; - y = n; - n<<= 2; - } - } + y = n; + n<<= 2; + } + } switch (n) { case 0: y = __kernel_sinf(pi*y,zero,0); break; case 1: @@ -148,12 +132,8 @@ static float zero= 0.0000000000e+00; } -#ifdef __STDC__ - float __ieee754_lgammaf_r(float x, int *signgamp) -#else - float __ieee754_lgammaf_r(x,signgamp) - float x; int *signgamp; -#endif +float +__ieee754_lgammaf_r(float x, int *signgamp) { float t,y,z,nadj,p,p1,p2,p3,q,r,w; int i,hx,ix; @@ -163,21 +143,22 @@ static float zero= 0.0000000000e+00; /* purge off +-inf, NaN, +-0, and negative arguments */ *signgamp = 1; ix = hx&0x7fffffff; - if(ix>=0x7f800000) return x*x; - if(ix==0) + if(__builtin_expect(ix>=0x7f800000, 0)) return x*x; + if(__builtin_expect(ix==0, 0)) { if (hx < 0) *signgamp = -1; return one/fabsf(x); } - if(ix<0x1c800000) { /* |x|<2**-70, return -log(|x|) */ + if(__builtin_expect(ix<0x1c800000, 0)) { + /* |x|<2**-70, return -log(|x|) */ if(hx<0) { - *signgamp = -1; - return -__ieee754_logf(-x); + *signgamp = -1; + return -__ieee754_logf(-x); } else return -__ieee754_logf(x); } if(hx<0) { - if(ix>=0x4b000000) /* |x|>=2**23, must be -integer */ + if(ix>=0x4b000000) /* |x|>=2**23, must be -integer */ return x/zero; t = sin_pif(x); if(t==zero) return one/fabsf(t); /* -integer */ @@ -190,15 +171,15 @@ static float zero= 0.0000000000e+00; if (ix==0x3f800000||ix==0x40000000) r = 0; /* for x < 2.0 */ else if(ix<0x40000000) { - if(ix<=0x3f666666) { /* lgamma(x) = lgamma(x+1)-log(x) */ + if(ix<=0x3f666666) { /* lgamma(x) = lgamma(x+1)-log(x) */ r = -__ieee754_logf(x); if(ix>=0x3f3b4a20) {y = one-x; i= 0;} else if(ix>=0x3e6d3308) {y= x-(tc-one); i=1;} - else {y = x; i=2;} + else {y = x; i=2;} } else { - r = zero; - if(ix>=0x3fdda618) {y=(float)2.0-x;i=0;} /* [1.7316,2] */ - else if(ix>=0x3F9da620) {y=x-tc;i=1;} /* [1.23,1.73] */ + r = zero; + if(ix>=0x3fdda618) {y=(float)2.0-x;i=0;} /* [1.7316,2] */ + else if(ix>=0x3F9da620) {y=x-tc;i=1;} /* [1.23,1.73] */ else {y=x-one;i=2;} } switch(i) { @@ -222,7 +203,7 @@ static float zero= 0.0000000000e+00; r += (-(float)0.5*y + p1/p2); } } - else if(ix<0x41000000) { /* x < 8.0 */ + else if(ix<0x41000000) { /* x < 8.0 */ i = (int)x; t = zero; y = x-(float)i; @@ -251,3 +232,4 @@ static float zero= 0.0000000000e+00; if(hx<0) r = nadj - r; return r; } +strong_alias (__ieee754_lgammaf_r, __lgammaf_r_finite) diff --git a/sysdeps/ieee754/flt-32/e_log10f.c b/sysdeps/ieee754/flt-32/e_log10f.c index cea3d91..72dcea6 100644 --- a/sysdeps/ieee754/flt-32/e_log10f.c +++ b/sysdeps/ieee754/flt-32/e_log10f.c @@ -13,55 +13,41 @@ * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: e_log10f.c,v 1.5 1995/05/10 20:45:53 jtc Exp $"; -#endif - #include "math.h" #include "math_private.h" -#ifdef __STDC__ static const float -#else -static float -#endif two25 = 3.3554432000e+07, /* 0x4c000000 */ ivln10 = 4.3429449201e-01, /* 0x3ede5bd9 */ log10_2hi = 3.0102920532e-01, /* 0x3e9a2080 */ log10_2lo = 7.9034151668e-07; /* 0x355427db */ -#ifdef __STDC__ static const float zero = 0.0; -#else -static float zero = 0.0; -#endif -#ifdef __STDC__ - float __ieee754_log10f(float x) -#else - float __ieee754_log10f(x) - float x; -#endif +float +__ieee754_log10f(float x) { float y,z; int32_t i,k,hx; GET_FLOAT_WORD(hx,x); - k=0; - if (hx < 0x00800000) { /* x < 2**-126 */ - if ((hx&0x7fffffff)==0) - return -two25/(x-x); /* log(+-0)=-inf */ - if (hx<0) return (x-x)/(x-x); /* log(-#) = NaN */ - k -= 25; x *= two25; /* subnormal number, scale up x */ + k=0; + if (hx < 0x00800000) { /* x < 2**-126 */ + if (__builtin_expect((hx&0x7fffffff)==0, 0)) + return -two25/(x-x); /* log(+-0)=-inf */ + if (__builtin_expect(hx<0, 0)) + return (x-x)/(x-x); /* log(-#) = NaN */ + k -= 25; x *= two25; /* subnormal number, scale up x */ GET_FLOAT_WORD(hx,x); - } - if (hx >= 0x7f800000) return x+x; + } + if (__builtin_expect(hx >= 0x7f800000, 0)) return x+x; k += (hx>>23)-127; i = ((u_int32_t)k&0x80000000)>>31; - hx = (hx&0x007fffff)|((0x7f-i)<<23); - y = (float)(k+i); + hx = (hx&0x007fffff)|((0x7f-i)<<23); + y = (float)(k+i); SET_FLOAT_WORD(x,hx); z = y*log10_2lo + ivln10*__ieee754_logf(x); return z+y*log10_2hi; } +strong_alias (__ieee754_log10f, __log10f_finite) diff --git a/sysdeps/ieee754/flt-32/e_log2f.c b/sysdeps/ieee754/flt-32/e_log2f.c index af3c6ea..7453214 100644 --- a/sysdeps/ieee754/flt-32/e_log2f.c +++ b/sysdeps/ieee754/flt-32/e_log2f.c @@ -18,11 +18,7 @@ #include "math.h" #include "math_private.h" -#ifdef __STDC__ static const float -#else -static float -#endif ln2 = 0.69314718055994530942, two25 = 3.355443200e+07, /* 0x4c000000 */ Lg1 = 6.6666668653e-01, /* 3F2AAAAB */ @@ -33,18 +29,10 @@ Lg5 = 1.8183572590e-01, /* 3E3A3325 */ Lg6 = 1.5313838422e-01, /* 3E1CD04F */ Lg7 = 1.4798198640e-01; /* 3E178897 */ -#ifdef __STDC__ static const float zero = 0.0; -#else -static float zero = 0.0; -#endif -#ifdef __STDC__ - float __ieee754_log2f(float x) -#else - float __ieee754_log2f(x) - float x; -#endif +float +__ieee754_log2f(float x) { float hfsq,f,s,z,R,w,t1,t2,dk; int32_t k,ix,i,j; @@ -53,13 +41,14 @@ static float zero = 0.0; k=0; if (ix < 0x00800000) { /* x < 2**-126 */ - if ((ix&0x7fffffff)==0) + if (__builtin_expect((ix&0x7fffffff)==0, 0)) return -two25/(x-x); /* log(+-0)=-inf */ - if (ix<0) return (x-x)/(x-x); /* log(-#) = NaN */ + if (__builtin_expect(ix<0, 0)) + return (x-x)/(x-x); /* log(-#) = NaN */ k -= 25; x *= two25; /* subnormal number, scale up x */ GET_FLOAT_WORD(ix,x); } - if (ix >= 0x7f800000) return x+x; + if (__builtin_expect(ix >= 0x7f800000, 0)) return x+x; k += (ix>>23)-127; ix &= 0x007fffff; i = (ix+(0x95f64<<3))&0x800000; @@ -72,7 +61,7 @@ static float zero = 0.0; R = f*f*((float)0.5-(float)0.33333333333333333*f); return dk-(R-f)/ln2; } - s = f/((float)2.0+f); + s = f/((float)2.0+f); z = s*s; i = ix-(0x6147a<<3); w = z*z; @@ -88,3 +77,4 @@ static float zero = 0.0; return dk-((s*(f-R))-f)/ln2; } } +strong_alias (__ieee754_log2f, __log2f_finite) diff --git a/sysdeps/ieee754/flt-32/e_logf.c b/sysdeps/ieee754/flt-32/e_logf.c index de8f869..b870b31 100644 --- a/sysdeps/ieee754/flt-32/e_logf.c +++ b/sysdeps/ieee754/flt-32/e_logf.c @@ -13,18 +13,10 @@ * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: e_logf.c,v 1.4 1995/05/10 20:45:54 jtc Exp $"; -#endif - #include "math.h" #include "math_private.h" -#ifdef __STDC__ static const float -#else -static float -#endif ln2_hi = 6.9313812256e-01, /* 0x3f317180 */ ln2_lo = 9.0580006145e-06, /* 0x3717f7d1 */ two25 = 3.355443200e+07, /* 0x4c000000 */ @@ -36,18 +28,10 @@ Lg5 = 1.8183572590e-01, /* 3E3A3325 */ Lg6 = 1.5313838422e-01, /* 3E1CD04F */ Lg7 = 1.4798198640e-01; /* 3E178897 */ -#ifdef __STDC__ static const float zero = 0.0; -#else -static float zero = 0.0; -#endif -#ifdef __STDC__ - float __ieee754_logf(float x) -#else - float __ieee754_logf(x) - float x; -#endif +float +__ieee754_logf(float x) { float hfsq,f,s,z,R,w,t1,t2,dk; int32_t k,ix,i,j; @@ -56,13 +40,14 @@ static float zero = 0.0; k=0; if (ix < 0x00800000) { /* x < 2**-126 */ - if ((ix&0x7fffffff)==0) + if (__builtin_expect((ix&0x7fffffff)==0, 0)) return -two25/(x-x); /* log(+-0)=-inf */ - if (ix<0) return (x-x)/(x-x); /* log(-#) = NaN */ + if (__builtin_expect(ix<0, 0)) + return (x-x)/(x-x); /* log(-#) = NaN */ k -= 25; x *= two25; /* subnormal number, scale up x */ GET_FLOAT_WORD(ix,x); } - if (ix >= 0x7f800000) return x+x; + if (__builtin_expect(ix >= 0x7f800000, 0)) return x+x; k += (ix>>23)-127; ix &= 0x007fffff; i = (ix+(0x95f64<<3))&0x800000; @@ -76,9 +61,9 @@ static float zero = 0.0; } R = f*f*((float)0.5-(float)0.33333333333333333*f); if(k==0) return f-R; else {dk=(float)k; - return dk*ln2_hi-((R-dk*ln2_lo)-f);} + return dk*ln2_hi-((R-dk*ln2_lo)-f);} } - s = f/((float)2.0+f); + s = f/((float)2.0+f); dk = (float)k; z = s*s; i = ix-(0x6147a<<3); @@ -97,3 +82,4 @@ static float zero = 0.0; return dk*ln2_hi-((s*(f-R)-dk*ln2_lo)-f); } } +strong_alias (__ieee754_logf, __logf_finite) diff --git a/sysdeps/ieee754/flt-32/e_powf.c b/sysdeps/ieee754/flt-32/e_powf.c index 9f52080..4600552 100644 --- a/sysdeps/ieee754/flt-32/e_powf.c +++ b/sysdeps/ieee754/flt-32/e_powf.c @@ -13,20 +13,12 @@ * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: e_powf.c,v 1.7 1996/04/08 15:43:44 phil Exp $"; -#endif - #include "math.h" #include "math_private.h" static const float huge = 1.0e+30, tiny = 1.0e-30; -#ifdef __STDC__ static const float -#else -static float -#endif bp[] = {1.0, 1.5,}, dp_h[] = { 0.0, 5.84960938e-01,}, /* 0x3f15c000 */ dp_l[] = { 0.0, 1.56322085e-06,}, /* 0x35d1cfdc */ @@ -57,12 +49,8 @@ ivln2 = 1.4426950216e+00, /* 0x3fb8aa3b =1/ln2 */ ivln2_h = 1.4426879883e+00, /* 0x3fb8aa00 =16b 1/ln2*/ ivln2_l = 7.0526075433e-06; /* 0x36eca570 =1/ln2 tail*/ -#ifdef __STDC__ - float __ieee754_powf(float x, float y) -#else - float __ieee754_powf(x,y) - float x, y; -#endif +float +__ieee754_powf(float x, float y) { float z,ax,z_h,z_l,p_h,p_l; float y1,t1,t2,r,s,t,u,v,w; @@ -81,8 +69,8 @@ ivln2_l = 7.0526075433e-06; /* 0x36eca570 =1/ln2 tail*/ if(x == -1.0 && isinf(y)) return one; /* +-NaN return x+y */ - if(ix > 0x7f800000 || - iy > 0x7f800000) + if(__builtin_expect(ix > 0x7f800000 || + iy > 0x7f800000, 0)) return x+y; /* determine if y is an odd int when x < 0 @@ -101,26 +89,26 @@ ivln2_l = 7.0526075433e-06; /* 0x36eca570 =1/ln2 tail*/ } /* special value of y */ - if (iy==0x7f800000) { /* y is +-inf */ + if (__builtin_expect(iy==0x7f800000, 0)) { /* y is +-inf */ if (ix==0x3f800000) - return y - y; /* inf**+-1 is NaN */ + return y - y; /* inf**+-1 is NaN */ else if (ix > 0x3f800000)/* (|x|>1)**+-inf = inf,0 */ - return (hy>=0)? y: zero; + return (hy>=0)? y: zero; else /* (|x|<1)**-,+inf = inf,0 */ - return (hy<0)?-y: zero; + return (hy<0)?-y: zero; } if(iy==0x3f800000) { /* y is +-1 */ if(hy<0) return one/x; else return x; } if(hy==0x40000000) return x*x; /* y is 2 */ if(hy==0x3f000000) { /* y is 0.5 */ - if(hx>=0) /* x >= +0 */ + if(__builtin_expect(hx>=0, 1)) /* x >= +0 */ return __ieee754_sqrtf(x); } ax = fabsf(x); /* special value of x */ - if(ix==0x7f800000||ix==0||ix==0x3f800000){ + if(__builtin_expect(ix==0x7f800000||ix==0||ix==0x3f800000, 0)){ z = ax; /*x is +-0,+-inf,+-1*/ if(hy<0) z = one/z; /* z = (1/|x|) */ if(hx<0) { @@ -133,10 +121,11 @@ ivln2_l = 7.0526075433e-06; /* 0x36eca570 =1/ln2 tail*/ } /* (x<0)**(non-int) is NaN */ - if(((((u_int32_t)hx>>31)-1)|yisint)==0) return (x-x)/(x-x); + if(__builtin_expect(((((u_int32_t)hx>>31)-1)|yisint)==0, 0)) + return (x-x)/(x-x); /* |y| is huge */ - if(iy>0x4d000000) { /* if |y| > 2**27 */ + if(__builtin_expect(iy>0x4d000000, 0)) { /* if |y| > 2**27 */ /* over/underflow if x is not close to one */ if(ix<0x3f7ffff8) return (hy<0)? huge*huge:tiny*tiny; if(ix>0x3f800007) return (hy>0)? huge*huge:tiny*tiny; @@ -214,14 +203,14 @@ ivln2_l = 7.0526075433e-06; /* 0x36eca570 =1/ln2 tail*/ p_h = y1*t1; z = p_l+p_h; GET_FLOAT_WORD(j,z); - if (j>0x43000000) /* if z > 128 */ + if (__builtin_expect(j>0x43000000, 0)) /* if z > 128 */ return s*huge*huge; /* overflow */ - else if (j==0x43000000) { /* if z == 128 */ + else if (__builtin_expect(j==0x43000000, 0)) { /* if z == 128 */ if(p_l+ovt>z-p_h) return s*huge*huge; /* overflow */ } - else if ((j&0x7fffffff)>0x43160000) /* z <= -150 */ + else if (__builtin_expect((j&0x7fffffff)>0x43160000, 0))/* z <= -150 */ return s*tiny*tiny; /* underflow */ - else if ((u_int32_t) j==0xc3160000){ /* z == -150 */ + else if (__builtin_expect((u_int32_t) j==0xc3160000, 0)){/* z == -150*/ if(p_l<=z-p_h) return s*tiny*tiny; /* underflow */ } /* @@ -255,3 +244,4 @@ ivln2_l = 7.0526075433e-06; /* 0x36eca570 =1/ln2 tail*/ else SET_FLOAT_WORD(z,j); return s*z; } +strong_alias (__ieee754_powf, __powf_finite) diff --git a/sysdeps/ieee754/flt-32/e_remainderf.c b/sysdeps/ieee754/flt-32/e_remainderf.c index 90d0d36..aaf15df 100644 --- a/sysdeps/ieee754/flt-32/e_remainderf.c +++ b/sysdeps/ieee754/flt-32/e_remainderf.c @@ -8,31 +8,19 @@ * * Developed at SunPro, 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. * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: e_remainderf.c,v 1.4 1995/05/10 20:46:08 jtc Exp $"; -#endif - #include "math.h" #include "math_private.h" -#ifdef __STDC__ static const float zero = 0.0; -#else -static float zero = 0.0; -#endif -#ifdef __STDC__ - float __ieee754_remainderf(float x, float p) -#else - float __ieee754_remainderf(x,p) - float x,p; -#endif +float +__ieee754_remainderf(float x, float p) { int32_t hx,hp; u_int32_t sx; @@ -45,7 +33,7 @@ static float zero = 0.0; hx &= 0x7fffffff; /* purge off exception values */ - if(hp==0) return (x*p)/(x*p); /* p = 0 */ + if(hp==0) return (x*p)/(x*p); /* p = 0 */ if((hx>=0x7f800000)|| /* x not finite */ ((hp>0x7f800000))) /* p is NaN */ return (x*p)/(x*p); @@ -71,3 +59,4 @@ static float zero = 0.0; SET_FLOAT_WORD(x,hx^sx); return x; } +strong_alias (__ieee754_remainderf, __remainderf_finite) diff --git a/sysdeps/ieee754/flt-32/e_sinhf.c b/sysdeps/ieee754/flt-32/e_sinhf.c index 045f6f1..5813963 100644 --- a/sysdeps/ieee754/flt-32/e_sinhf.c +++ b/sysdeps/ieee754/flt-32/e_sinhf.c @@ -8,31 +8,19 @@ * * Developed at SunPro, 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. * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: e_sinhf.c,v 1.4 1995/05/10 20:46:15 jtc Exp $"; -#endif - #include "math.h" #include "math_private.h" -#ifdef __STDC__ static const float one = 1.0, shuge = 1.0e37; -#else -static float one = 1.0, shuge = 1.0e37; -#endif -#ifdef __STDC__ - float __ieee754_sinhf(float x) -#else - float __ieee754_sinhf(x) - float x; -#endif -{ +float +__ieee754_sinhf(float x) +{ float t,w,h; int32_t ix,jx; @@ -40,13 +28,13 @@ static float one = 1.0, shuge = 1.0e37; ix = jx&0x7fffffff; /* x is INF or NaN */ - if(ix>=0x7f800000) return x+x; + if(__builtin_expect(ix>=0x7f800000, 0)) return x+x; h = 0.5; if (jx<0) h = -h; /* |x| in [0,22], return sign(x)*0.5*(E+E/(E+1))) */ if (ix < 0x41b00000) { /* |x|<22 */ - if (ix<0x31800000) /* |x|<2**-28 */ + if (__builtin_expect(ix<0x31800000, 0)) /* |x|<2**-28 */ if(shuge+x>one) return x;/* sinh(tiny) = tiny with inexact */ t = __expm1f(fabsf(x)); if(ix<0x3f800000) return h*((float)2.0*t-t*t/(t+one)); @@ -66,3 +54,4 @@ static float one = 1.0, shuge = 1.0e37; /* |x| > overflowthresold, sinh(x) overflow */ return x*shuge; } +strong_alias (__ieee754_sinhf, __sinhf_finite) diff --git a/sysdeps/ieee754/flt-32/e_sqrtf.c b/sysdeps/ieee754/flt-32/e_sqrtf.c index 7648ef4..6d6688c 100644 --- a/sysdeps/ieee754/flt-32/e_sqrtf.c +++ b/sysdeps/ieee754/flt-32/e_sqrtf.c @@ -8,43 +8,31 @@ * * Developed at SunPro, 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. * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: e_sqrtf.c,v 1.4 1995/05/10 20:46:19 jtc Exp $"; -#endif - #include "math.h" #include "math_private.h" -#ifdef __STDC__ static const float one = 1.0, tiny=1.0e-30; -#else -static float one = 1.0, tiny=1.0e-30; -#endif -#ifdef __STDC__ - float __ieee754_sqrtf(float x) -#else - float __ieee754_sqrtf(x) - float x; -#endif +float +__ieee754_sqrtf(float x) { float z; - int32_t sign = (int)0x80000000; + int32_t sign = (int)0x80000000; int32_t ix,s,q,m,t,i; u_int32_t r; GET_FLOAT_WORD(ix,x); /* take care of Inf and NaN */ - if((ix&0x7f800000)==0x7f800000) { + if((ix&0x7f800000)==0x7f800000) { return x*x+x; /* sqrt(NaN)=NaN, sqrt(+inf)=+inf sqrt(-inf)=sNaN */ - } + } /* take care of zero */ if(ix<=0) { if((ix&(~sign))==0) return x;/* sqrt(+-0) = +-0 */ @@ -69,12 +57,12 @@ static float one = 1.0, tiny=1.0e-30; r = 0x01000000; /* r = moving bit from right to left */ while(r!=0) { - t = s+r; - if(t<=ix) { - s = t+r; - ix -= t; - q += r; - } + t = s+r; + if(t<=ix) { + s = t+r; + ix -= t; + q += r; + } ix += ix; r>>=1; } @@ -83,7 +71,7 @@ static float one = 1.0, tiny=1.0e-30; if(ix!=0) { z = one-tiny; /* trigger inexact flag */ if (z>=one) { - z = one+tiny; + z = one+tiny; if (z>one) q += 2; else @@ -95,3 +83,4 @@ static float one = 1.0, tiny=1.0e-30; SET_FLOAT_WORD(z,ix); return z; } +strong_alias (__ieee754_sqrtf, __sqrtf_finite) diff --git a/sysdeps/ieee754/flt-32/s_asinhf.c b/sysdeps/ieee754/flt-32/s_asinhf.c index fac256d..aa46f90 100644 --- a/sysdeps/ieee754/flt-32/s_asinhf.c +++ b/sysdeps/ieee754/flt-32/s_asinhf.c @@ -13,46 +13,36 @@ * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: s_asinhf.c,v 1.5 1995/05/12 04:57:39 jtc Exp $"; -#endif - #include "math.h" #include "math_private.h" -#ifdef __STDC__ static const float -#else -static float -#endif one = 1.0000000000e+00, /* 0x3F800000 */ ln2 = 6.9314718246e-01, /* 0x3f317218 */ huge= 1.0000000000e+30; -#ifdef __STDC__ - float __asinhf(float x) -#else - float __asinhf(x) - float x; -#endif +float +__asinhf(float x) { - float t,w; + float w; int32_t hx,ix; GET_FLOAT_WORD(hx,x); ix = hx&0x7fffffff; - if(ix>=0x7f800000) return x+x; /* x is inf or NaN */ - if(ix< 0x38000000) { /* |x|<2**-14 */ + if(__builtin_expect(ix< 0x38000000, 0)) { /* |x|<2**-14 */ if(huge+x>one) return x; /* return x inexact except 0 */ } - if(ix>0x47000000) { /* |x| > 2**14 */ + if(__builtin_expect(ix>0x47000000, 0)) { /* |x| > 2**14 */ + if(ix>=0x7f800000) return x+x; /* x is inf or NaN */ w = __ieee754_logf(fabsf(x))+ln2; - } else if (ix>0x40000000) { /* 2**14 > |x| > 2.0 */ - t = fabsf(x); - w = __ieee754_logf((float)2.0*t+one/(__ieee754_sqrtf(x*x+one)+t)); - } else { /* 2.0 > |x| > 2**-14 */ - t = x*x; - w =__log1pf(fabsf(x)+t/(one+__ieee754_sqrtf(one+t))); + } else { + float xa = fabsf(x); + if (ix>0x40000000) { /* 2**14 > |x| > 2.0 */ + w = __ieee754_logf(2.0f*xa+one/(__ieee754_sqrtf(xa*xa+one)+xa)); + } else { /* 2.0 > |x| > 2**-14 */ + float t = xa*xa; + w =__log1pf(xa+t/(one+__ieee754_sqrtf(one+t))); + } } - if(hx>0) return w; else return -w; + return __copysignf(w, x); } weak_alias (__asinhf, asinhf) diff --git a/sysdeps/ieee754/k_standard.c b/sysdeps/ieee754/k_standard.c index ede5157..229c498 100644 --- a/sysdeps/ieee754/k_standard.c +++ b/sysdeps/ieee754/k_standard.c @@ -94,12 +94,8 @@ static double zero = 0.0; /* used as const */ */ -#ifdef __STDC__ - double __kernel_standard(double x, double y, int type) -#else - double __kernel_standard(x,y,type) - double x,y; int type; -#endif +double +__kernel_standard(double x, double y, int type) { struct exception exc; #ifndef HUGE_VAL /* this is the only routine that uses HUGE_VAL */ @@ -150,7 +146,7 @@ static double zero = 0.0; /* used as const */ __set_errno (EDOM); else if (!matherr(&exc)) { if(_LIB_VERSION == _SVID_) { - (void) WRITE2("asin: DOMAIN error\n", 19); + (void) WRITE2("asin: DOMAIN error\n", 19); } __set_errno (EDOM); } @@ -361,14 +357,14 @@ static double zero = 0.0; /* used as const */ exc.type = OVERFLOW; exc.name = type < 100 ? "lgamma" : (type < 200 ? "lgammaf" : "lgammal"); - if (_LIB_VERSION == _SVID_) - exc.retval = HUGE; - else - exc.retval = HUGE_VAL; - if (_LIB_VERSION == _POSIX_) + if (_LIB_VERSION == _SVID_) + exc.retval = HUGE; + else + exc.retval = HUGE_VAL; + if (_LIB_VERSION == _POSIX_) + __set_errno (ERANGE); + else if (!matherr(&exc)) { __set_errno (ERANGE); - else if (!matherr(&exc)) { - __set_errno (ERANGE); } break; case 15: @@ -378,10 +374,10 @@ static double zero = 0.0; /* used as const */ exc.type = SING; exc.name = type < 100 ? "lgamma" : (type < 200 ? "lgammaf" : "lgammal"); - if (_LIB_VERSION == _SVID_) - exc.retval = HUGE; - else - exc.retval = HUGE_VAL; + if (_LIB_VERSION == _SVID_) + exc.retval = HUGE; + else + exc.retval = HUGE_VAL; if (_LIB_VERSION == _POSIX_) __set_errno (ERANGE); else if (!matherr(&exc)) { @@ -611,95 +607,95 @@ static double zero = 0.0; /* used as const */ __set_errno (EDOM); } break; - case 27: + case 27: case 127: case 227: - /* fmod(x,0) */ - exc.type = DOMAIN; - exc.name = type < 100 ? "fmod" : (type < 200 + /* fmod(x,0) */ + exc.type = DOMAIN; + exc.name = type < 100 ? "fmod" : (type < 200 ? "fmodf" : "fmodl"); - if (_LIB_VERSION == _SVID_) - exc.retval = x; + if (_LIB_VERSION == _SVID_) + exc.retval = x; else exc.retval = zero/zero; - if (_LIB_VERSION == _POSIX_) - __set_errno (EDOM); - else if (!matherr(&exc)) { - if (_LIB_VERSION == _SVID_) { - (void) WRITE2("fmod: DOMAIN error\n", 20); - } - __set_errno (EDOM); - } - break; - case 28: + if (_LIB_VERSION == _POSIX_) + __set_errno (EDOM); + else if (!matherr(&exc)) { + if (_LIB_VERSION == _SVID_) { + (void) WRITE2("fmod: DOMAIN error\n", 20); + } + __set_errno (EDOM); + } + break; + case 28: case 128: case 228: - /* remainder(x,0) */ - exc.type = DOMAIN; - exc.name = type < 100 ? "remainder" : (type < 200 + /* remainder(x,0) */ + exc.type = DOMAIN; + exc.name = type < 100 ? "remainder" : (type < 200 ? "remainderf" : "remainderl"); - exc.retval = zero/zero; - if (_LIB_VERSION == _POSIX_) - __set_errno (EDOM); - else if (!matherr(&exc)) { - if (_LIB_VERSION == _SVID_) { - (void) WRITE2("remainder: DOMAIN error\n", 24); - } - __set_errno (EDOM); - } - break; - case 29: + exc.retval = zero/zero; + if (_LIB_VERSION == _POSIX_) + __set_errno (EDOM); + else if (!matherr(&exc)) { + if (_LIB_VERSION == _SVID_) { + (void) WRITE2("remainder: DOMAIN error\n", 24); + } + __set_errno (EDOM); + } + break; + case 29: case 129: case 229: - /* acosh(x<1) */ - exc.type = DOMAIN; - exc.name = type < 100 ? "acosh" : (type < 200 + /* acosh(x<1) */ + exc.type = DOMAIN; + exc.name = type < 100 ? "acosh" : (type < 200 ? "acoshf" : "acoshl"); - exc.retval = zero/zero; - if (_LIB_VERSION == _POSIX_) - __set_errno (EDOM); - else if (!matherr(&exc)) { - if (_LIB_VERSION == _SVID_) { - (void) WRITE2("acosh: DOMAIN error\n", 20); - } - __set_errno (EDOM); - } - break; - case 30: + exc.retval = zero/zero; + if (_LIB_VERSION == _POSIX_) + __set_errno (EDOM); + else if (!matherr(&exc)) { + if (_LIB_VERSION == _SVID_) { + (void) WRITE2("acosh: DOMAIN error\n", 20); + } + __set_errno (EDOM); + } + break; + case 30: case 130: case 230: - /* atanh(|x|>1) */ - exc.type = DOMAIN; - exc.name = type < 100 ? "atanh" : (type < 200 + /* atanh(|x|>1) */ + exc.type = DOMAIN; + exc.name = type < 100 ? "atanh" : (type < 200 ? "atanhf" : "atanhl"); - exc.retval = zero/zero; - if (_LIB_VERSION == _POSIX_) - __set_errno (EDOM); - else if (!matherr(&exc)) { - if (_LIB_VERSION == _SVID_) { - (void) WRITE2("atanh: DOMAIN error\n", 20); - } - __set_errno (EDOM); - } - break; - case 31: + exc.retval = zero/zero; + if (_LIB_VERSION == _POSIX_) + __set_errno (EDOM); + else if (!matherr(&exc)) { + if (_LIB_VERSION == _SVID_) { + (void) WRITE2("atanh: DOMAIN error\n", 20); + } + __set_errno (EDOM); + } + break; + case 31: case 131: case 231: - /* atanh(|x|=1) */ - exc.type = SING; - exc.name = type < 100 ? "atanh" : (type < 200 + /* atanh(|x|=1) */ + exc.type = SING; + exc.name = type < 100 ? "atanh" : (type < 200 ? "atanhf" : "atanhl"); exc.retval = x/zero; /* sign(x)*inf */ - if (_LIB_VERSION == _POSIX_) - __set_errno (ERANGE); - else if (!matherr(&exc)) { - if (_LIB_VERSION == _SVID_) { - (void) WRITE2("atanh: SING error\n", 18); - } - __set_errno (EDOM); - } - break; + if (_LIB_VERSION == _POSIX_) + __set_errno (ERANGE); + else if (!matherr(&exc)) { + if (_LIB_VERSION == _SVID_) { + (void) WRITE2("atanh: SING error\n", 18); + } + __set_errno (EDOM); + } + break; case 32: case 132: case 232: @@ -732,103 +728,103 @@ static double zero = 0.0; /* used as const */ case 134: case 234: /* j0(|x|>X_TLOSS) */ - exc.type = TLOSS; - exc.name = type < 100 ? "j0" : (type < 200 ? "j0f" : "j0l"); - exc.retval = zero; - if (_LIB_VERSION == _POSIX_) - __set_errno (ERANGE); - else if (!matherr(&exc)) { - if (_LIB_VERSION == _SVID_) { - (void) WRITE2(exc.name, 2); - (void) WRITE2(": TLOSS error\n", 14); - } - __set_errno (ERANGE); - } + exc.type = TLOSS; + exc.name = type < 100 ? "j0" : (type < 200 ? "j0f" : "j0l"); + exc.retval = zero; + if (_LIB_VERSION == _POSIX_) + __set_errno (ERANGE); + else if (!matherr(&exc)) { + if (_LIB_VERSION == _SVID_) { + (void) WRITE2(exc.name, 2); + (void) WRITE2(": TLOSS error\n", 14); + } + __set_errno (ERANGE); + } break; case 35: case 135: case 235: /* y0(x>X_TLOSS) */ - exc.type = TLOSS; - exc.name = type < 100 ? "y0" : (type < 200 ? "y0f" : "y0l"); - exc.retval = zero; - if (_LIB_VERSION == _POSIX_) - __set_errno (ERANGE); - else if (!matherr(&exc)) { - if (_LIB_VERSION == _SVID_) { - (void) WRITE2(exc.name, 2); - (void) WRITE2(": TLOSS error\n", 14); - } - __set_errno (ERANGE); - } + exc.type = TLOSS; + exc.name = type < 100 ? "y0" : (type < 200 ? "y0f" : "y0l"); + exc.retval = zero; + if (_LIB_VERSION == _POSIX_) + __set_errno (ERANGE); + else if (!matherr(&exc)) { + if (_LIB_VERSION == _SVID_) { + (void) WRITE2(exc.name, 2); + (void) WRITE2(": TLOSS error\n", 14); + } + __set_errno (ERANGE); + } break; case 36: case 136: case 236: /* j1(|x|>X_TLOSS) */ - exc.type = TLOSS; - exc.name = type < 100 ? "j1" : (type < 200 ? "j1f" : "j1l"); - exc.retval = zero; - if (_LIB_VERSION == _POSIX_) - __set_errno (ERANGE); - else if (!matherr(&exc)) { - if (_LIB_VERSION == _SVID_) { - (void) WRITE2(exc.name, 2); - (void) WRITE2(": TLOSS error\n", 14); - } - __set_errno (ERANGE); - } + exc.type = TLOSS; + exc.name = type < 100 ? "j1" : (type < 200 ? "j1f" : "j1l"); + exc.retval = zero; + if (_LIB_VERSION == _POSIX_) + __set_errno (ERANGE); + else if (!matherr(&exc)) { + if (_LIB_VERSION == _SVID_) { + (void) WRITE2(exc.name, 2); + (void) WRITE2(": TLOSS error\n", 14); + } + __set_errno (ERANGE); + } break; case 37: case 137: case 237: /* y1(x>X_TLOSS) */ - exc.type = TLOSS; - exc.name = type < 100 ? "y1" : (type < 200 ? "y1f" : "y1l"); - exc.retval = zero; - if (_LIB_VERSION == _POSIX_) - __set_errno (ERANGE); - else if (!matherr(&exc)) { - if (_LIB_VERSION == _SVID_) { - (void) WRITE2(exc.name, 2); - (void) WRITE2(": TLOSS error\n", 14); - } - __set_errno (ERANGE); - } + exc.type = TLOSS; + exc.name = type < 100 ? "y1" : (type < 200 ? "y1f" : "y1l"); + exc.retval = zero; + if (_LIB_VERSION == _POSIX_) + __set_errno (ERANGE); + else if (!matherr(&exc)) { + if (_LIB_VERSION == _SVID_) { + (void) WRITE2(exc.name, 2); + (void) WRITE2(": TLOSS error\n", 14); + } + __set_errno (ERANGE); + } break; case 38: case 138: case 238: /* jn(|x|>X_TLOSS) */ - exc.type = TLOSS; - exc.name = type < 100 ? "jn" : (type < 200 ? "jnf" : "jnl"); - exc.retval = zero; - if (_LIB_VERSION == _POSIX_) - __set_errno (ERANGE); - else if (!matherr(&exc)) { - if (_LIB_VERSION == _SVID_) { - (void) WRITE2(exc.name, 2); - (void) WRITE2(": TLOSS error\n", 14); - } - __set_errno (ERANGE); - } + exc.type = TLOSS; + exc.name = type < 100 ? "jn" : (type < 200 ? "jnf" : "jnl"); + exc.retval = zero; + if (_LIB_VERSION == _POSIX_) + __set_errno (ERANGE); + else if (!matherr(&exc)) { + if (_LIB_VERSION == _SVID_) { + (void) WRITE2(exc.name, 2); + (void) WRITE2(": TLOSS error\n", 14); + } + __set_errno (ERANGE); + } break; case 39: case 139: case 239: /* yn(x>X_TLOSS) */ - exc.type = TLOSS; - exc.name = type < 100 ? "yn" : (type < 200 ? "ynf" : "ynl"); - exc.retval = zero; - if (_LIB_VERSION == _POSIX_) - __set_errno (ERANGE); - else if (!matherr(&exc)) { - if (_LIB_VERSION == _SVID_) { - (void) WRITE2(exc.name, 2); - (void) WRITE2(": TLOSS error\n", 14); - } - __set_errno (ERANGE); - } + exc.type = TLOSS; + exc.name = type < 100 ? "yn" : (type < 200 ? "ynf" : "ynl"); + exc.retval = zero; + if (_LIB_VERSION == _POSIX_) + __set_errno (ERANGE); + else if (!matherr(&exc)) { + if (_LIB_VERSION == _SVID_) { + (void) WRITE2(exc.name, 2); + (void) WRITE2(": TLOSS error\n", 14); + } + __set_errno (ERANGE); + } break; case 40: case 140: @@ -838,11 +834,11 @@ static double zero = 0.0; /* used as const */ exc.name = type < 100 ? "tgamma" : (type < 200 ? "tgammaf" : "tgammal"); exc.retval = HUGE_VAL; - if (_LIB_VERSION == _POSIX_) + if (_LIB_VERSION == _POSIX_) __set_errno (ERANGE); - else if (!matherr(&exc)) { - __set_errno (ERANGE); - } + else if (!matherr(&exc)) { + __set_errno (ERANGE); + } break; case 41: case 141: @@ -995,3 +991,10 @@ static double zero = 0.0; /* used as const */ } return exc.retval; } + + +float +__kernel_standard_f(float x, float y, int type) +{ + return __kernel_standard(x, y, type); +} diff --git a/sysdeps/ieee754/ldbl-128/e_acoshl.c b/sysdeps/ieee754/ldbl-128/e_acoshl.c index 62170d4..2a74e9c 100644 --- a/sysdeps/ieee754/ldbl-128/e_acoshl.c +++ b/sysdeps/ieee754/ldbl-128/e_acoshl.c @@ -30,20 +30,12 @@ #include "math.h" #include "math_private.h" -#ifdef __STDC__ static const long double -#else -static long double -#endif one = 1.0, ln2 = 0.6931471805599453094172321214581766L; -#ifdef __STDC__ - long double __ieee754_acoshl(long double x) -#else - long double __ieee754_acoshl(x) - long double x; -#endif +long double +__ieee754_acoshl(long double x) { long double t; u_int64_t lx; @@ -53,7 +45,7 @@ ln2 = 0.6931471805599453094172321214581766L; return (x-x)/(x-x); } else if(hx >=0x4035000000000000LL) { /* x > 2**54 */ if(hx >=0x7fff000000000000LL) { /* x is inf of NaN */ - return x+x; + return x+x; } else return __ieee754_logl(x)+ln2; /* acoshl(huge)=logl(2x) */ } else if(((hx-0x3fff000000000000LL)|lx)==0) { @@ -66,3 +58,4 @@ ln2 = 0.6931471805599453094172321214581766L; return __log1pl(t+__sqrtl(2.0L*t+t*t)); } } +strong_alias (__ieee754_acoshl, __acoshl_finite) diff --git a/sysdeps/ieee754/ldbl-128/e_acosl.c b/sysdeps/ieee754/ldbl-128/e_acosl.c index 284e86a..a750369 100644 --- a/sysdeps/ieee754/ldbl-128/e_acosl.c +++ b/sysdeps/ieee754/ldbl-128/e_acosl.c @@ -12,9 +12,9 @@ /* Long double expansions are Copyright (C) 2001 Stephen L. Moshier <moshier@na-net.ornl.gov> - and are incorporated herein by permission of the author. The author + and are incorporated herein by permission of the author. The author reserves the right to distribute this material elsewhere under different - copying permissions. These modifications are distributed here under + copying permissions. These modifications are distributed here under the following terms: This library is free software; you can redistribute it and/or @@ -57,11 +57,7 @@ #include "math.h" #include "math_private.h" -#ifdef __STDC__ static const long double -#else -static long double -#endif one = 1.0L, pio2_hi = 1.5707963267948966192313216916397514420986L, pio2_lo = 4.3359050650618905123985220130216759843812E-35L, @@ -152,14 +148,8 @@ static long double qS8 = -4.175375777334867025769346564600396877176E1L; /* 1.000000000000000000000000000000000000000E0 */ -#ifdef __STDC__ long double __ieee754_acosl (long double x) -#else -long double -__ieee754_acosl (x) - long double x; -#endif { long double z, r, w, p, q, s, t, f2; int32_t ix, sign; @@ -283,11 +273,11 @@ __ieee754_acosl (x) s = __ieee754_sqrtl (z); /* Compute an extended precision square root from the Newton iteration s -> 0.5 * (s + z / s). - The change w from s to the improved value is + The change w from s to the improved value is w = 0.5 * (s + z / s) - s = (s^2 + z)/2s - s = (z - s^2)/2s. - Express s = f1 + f2 where f1 * f1 is exactly representable. + Express s = f1 + f2 where f1 * f1 is exactly representable. w = (z - s^2)/2s = (z - f1^2 - 2 f1 f2 - f2^2)/2s . - s + w has extended precision. */ + s + w has extended precision. */ u.value = s; u.parts32.w2 = 0; u.parts32.w3 = 0; @@ -326,3 +316,4 @@ __ieee754_acosl (x) return 2.0 * w; } } +strong_alias (__ieee754_acosl, __acosl_finite) diff --git a/sysdeps/ieee754/ldbl-128/e_asinl.c b/sysdeps/ieee754/ldbl-128/e_asinl.c index 89f5d79..e82b03f 100644 --- a/sysdeps/ieee754/ldbl-128/e_asinl.c +++ b/sysdeps/ieee754/ldbl-128/e_asinl.c @@ -12,9 +12,9 @@ /* Long double expansions are Copyright (C) 2001 Stephen L. Moshier <moshier@na-net.ornl.gov> - and are incorporated herein by permission of the author. The author - reserves the right to distribute this material elsewhere under different - copying permissions. These modifications are distributed here under the + and are incorporated herein by permission of the author. The author + reserves the right to distribute this material elsewhere under different + copying permissions. These modifications are distributed here under the following terms: This library is free software; you can redistribute it and/or @@ -263,3 +263,4 @@ __ieee754_asinl (x) else return -t; } +strong_alias (__ieee754_asinl, __asinl_finite) diff --git a/sysdeps/ieee754/ldbl-128/e_atan2l.c b/sysdeps/ieee754/ldbl-128/e_atan2l.c index 2bbb3b8..bba3c9b 100644 --- a/sysdeps/ieee754/ldbl-128/e_atan2l.c +++ b/sysdeps/ieee754/ldbl-128/e_atan2l.c @@ -17,7 +17,7 @@ * Method : * 1. Reduce y to positive by atan2l(y,x)=-atan2l(-y,x). * 2. Reduce x to positive by (if x and y are unexceptional): - * ARG (x+iy) = arctan(y/x) ... if x > 0, + * ARG (x+iy) = arctan(y/x) ... if x > 0, * ARG (x+iy) = pi - arctan[y/(-x)] ... if x < 0, * * Special cases: @@ -43,11 +43,7 @@ #include "math.h" #include "math_private.h" -#ifdef __STDC__ static const long double -#else -static long double -#endif tiny = 1.0e-4900L, zero = 0.0, pi_o_4 = 7.85398163397448309615660845819875699e-01L, /* 3ffe921fb54442d18469898cc51701b8 */ @@ -55,12 +51,8 @@ pi_o_2 = 1.57079632679489661923132169163975140e+00L, /* 3fff921fb54442d18469898 pi = 3.14159265358979323846264338327950280e+00L, /* 4000921fb54442d18469898cc51701b8 */ pi_lo = 8.67181013012378102479704402604335225e-35L; /* 3f8dcd129024e088a67cc74020bbea64 */ -#ifdef __STDC__ - long double __ieee754_atan2l(long double y, long double x) -#else - long double __ieee754_atan2l(y,x) - long double y,x; -#endif +long double +__ieee754_atan2l(long double y, long double x) { long double z; int64_t k,m,hx,hy,ix,iy; @@ -80,7 +72,7 @@ pi_lo = 8.67181013012378102479704402604335225e-35L; /* 3f8dcd129024e088a67cc74 if((iy|ly)==0) { switch(m) { case 0: - case 1: return y; /* atan(+-0,+anything)=+-0 */ + case 1: return y; /* atan(+-0,+anything)=+-0 */ case 2: return pi+tiny;/* atan(+0,-anything) = pi */ case 3: return -pi-tiny;/* atan(-0,-anything) =-pi */ } @@ -111,19 +103,20 @@ pi_lo = 8.67181013012378102479704402604335225e-35L; /* 3f8dcd129024e088a67cc74 /* compute y/x */ k = (iy-ix)>>48; - if(k > 120) z=pi_o_2+0.5L*pi_lo; /* |y/x| > 2**120 */ - else if(hx<0&&k<-120) z=0.0L; /* |y|/x < -2**120 */ + if(k > 120) z=pi_o_2+0.5L*pi_lo; /* |y/x| > 2**120 */ + else if(hx<0&&k<-120) z=0.0L; /* |y|/x < -2**120 */ else z=__atanl(fabsl(y/x)); /* safe to do y/x */ switch (m) { case 0: return z ; /* atan(+,+) */ case 1: { - u_int64_t zh; + u_int64_t zh; GET_LDOUBLE_MSW64(zh,z); SET_LDOUBLE_MSW64(z,zh ^ 0x8000000000000000ULL); } return z ; /* atan(-,+) */ case 2: return pi-(z-pi_lo);/* atan(+,-) */ default: /* case 3 */ - return (z-pi_lo)-pi;/* atan(-,-) */ + return (z-pi_lo)-pi;/* atan(-,-) */ } } +strong_alias (__ieee754_atan2l, __atan2l_finite) diff --git a/sysdeps/ieee754/ldbl-128/e_atanhl.c b/sysdeps/ieee754/ldbl-128/e_atanhl.c index dd681c8..334c4bd 100644 --- a/sysdeps/ieee754/ldbl-128/e_atanhl.c +++ b/sysdeps/ieee754/ldbl-128/e_atanhl.c @@ -14,10 +14,6 @@ * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - /* __ieee754_atanhl(x) * Method : * 1.Reduced x to positive by atanh(-x) = -atanh(x) @@ -26,7 +22,7 @@ static char rcsid[] = "$NetBSD: $"; * atanhl(x) = --- * log(1 + -------) = 0.5 * log1p(2 * --------) * 2 1 - x 1 - x * - * For x<0.5 + * For x<0.5 * atanhl(x) = 0.5*log1pl(2x+2x*x/(1-x)) * * Special cases: @@ -39,24 +35,12 @@ static char rcsid[] = "$NetBSD: $"; #include "math.h" #include "math_private.h" -#ifdef __STDC__ static const long double one = 1.0L, huge = 1e4900L; -#else -static long double one = 1.0L, huge = 1e4900L; -#endif -#ifdef __STDC__ static const long double zero = 0.0L; -#else -static double long zero = 0.0L; -#endif -#ifdef __STDC__ - long double __ieee754_atanhl(long double x) -#else - long double __ieee754_atanhl(x) - long double x; -#endif +long double +__ieee754_atanhl(long double x) { long double t; u_int32_t jx, ix; @@ -82,3 +66,4 @@ static double long zero = 0.0L; t = 0.5*__log1pl((u.value+u.value)/(one-u.value)); if(jx & 0x80000000) return -t; else return t; } +strong_alias (__ieee754_atanhl, __atanhl_finite) diff --git a/sysdeps/ieee754/ldbl-128/e_coshl.c b/sysdeps/ieee754/ldbl-128/e_coshl.c index 3913e34..dfe8d47 100644 --- a/sysdeps/ieee754/ldbl-128/e_coshl.c +++ b/sysdeps/ieee754/ldbl-128/e_coshl.c @@ -11,9 +11,9 @@ /* Changes for 128-bit long double are Copyright (C) 2001 Stephen L. Moshier <moshier@na-net.ornl.gov> - and are incorporated herein by permission of the author. The author + and are incorporated herein by permission of the author. The author reserves the right to distribute this material elsewhere under different - copying permissions. These modifications are distributed here under + copying permissions. These modifications are distributed here under the following terms: This library is free software; you can redistribute it and/or @@ -54,22 +54,11 @@ #include "math.h" #include "math_private.h" -#ifdef __STDC__ static const long double one = 1.0, half = 0.5, huge = 1.0e4900L, ovf_thresh = 1.1357216553474703894801348310092223067821E4L; -#else -static long double one = 1.0, half = 0.5, huge = 1.0e4900L, -ovf_thresh = 1.1357216553474703894801348310092223067821E4L; -#endif -#ifdef __STDC__ long double __ieee754_coshl (long double x) -#else -long double -__ieee754_coshl (x) - long double x; -#endif { long double t, w; int32_t ex; @@ -118,3 +107,4 @@ __ieee754_coshl (x) /* |x| > overflowthresold, cosh(x) overflow */ return huge * huge; } +strong_alias (__ieee754_coshl, __coshl_finite) diff --git a/sysdeps/ieee754/ldbl-128/e_fmodl.c b/sysdeps/ieee754/ldbl-128/e_fmodl.c index 1043f69..05665a9 100644 --- a/sysdeps/ieee754/ldbl-128/e_fmodl.c +++ b/sysdeps/ieee754/ldbl-128/e_fmodl.c @@ -3,16 +3,16 @@ */ /* * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * Copyright (C) 1993, 2011 by Sun Microsystems, Inc. All rights reserved. * * Developed at SunPro, 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. * ==================================================== */ -/* +/* * __ieee754_fmodl(x,y) * Return x mod y in exact arithmetic * Method: shift and subtract @@ -21,18 +21,10 @@ #include "math.h" #include "math_private.h" -#ifdef __STDC__ static const long double one = 1.0, Zero[] = {0.0, -0.0,}; -#else -static long double one = 1.0, Zero[] = {0.0, -0.0,}; -#endif -#ifdef __STDC__ - long double __ieee754_fmodl(long double x, long double y) -#else - long double __ieee754_fmodl(x,y) - long double x,y; -#endif +long double +__ieee754_fmodl (long double x, long double y) { int64_t n,hx,hy,hz,ix,iy,sx,i; u_int64_t lx,ly,lz; @@ -49,7 +41,7 @@ static long double one = 1.0, Zero[] = {0.0, -0.0,}; return (x*y)/(x*y); if(hx<=hy) { if((hx<hy)||(lx<ly)) return x; /* |x|<|y| return x */ - if(lx==ly) + if(lx==ly) return Zero[(u_int64_t)sx>>63]; /* |x|=|y| return x*0*/ } @@ -72,25 +64,25 @@ static long double one = 1.0, Zero[] = {0.0, -0.0,}; } else iy = (hy>>48)-0x3fff; /* set up {hx,lx}, {hy,ly} and align y to x */ - if(ix >= -16382) + if(ix >= -16382) hx = 0x0001000000000000LL|(0x0000ffffffffffffLL&hx); else { /* subnormal x, shift x to normal */ n = -16382-ix; if(n<=63) { - hx = (hx<<n)|(lx>>(64-n)); - lx <<= n; + hx = (hx<<n)|(lx>>(64-n)); + lx <<= n; } else { hx = lx<<(n-64); lx = 0; } } - if(iy >= -16382) + if(iy >= -16382) hy = 0x0001000000000000LL|(0x0000ffffffffffffLL&hy); else { /* subnormal y, shift y to normal */ n = -16382-iy; if(n<=63) { - hy = (hy<<n)|(ly>>(64-n)); - ly <<= n; + hy = (hy<<n)|(ly>>(64-n)); + ly <<= n; } else { hy = ly<<(n-64); ly = 0; @@ -103,17 +95,17 @@ static long double one = 1.0, Zero[] = {0.0, -0.0,}; hz=hx-hy;lz=lx-ly; if(lx<ly) hz -= 1; if(hz<0){hx = hx+hx+(lx>>63); lx = lx+lx;} else { - if((hz|lz)==0) /* return sign(x)*0 */ + if((hz|lz)==0) /* return sign(x)*0 */ return Zero[(u_int64_t)sx>>63]; - hx = hz+hz+(lz>>63); lx = lz+lz; + hx = hz+hz+(lz>>63); lx = lz+lz; } } hz=hx-hy;lz=lx-ly; if(lx<ly) hz -= 1; if(hz>=0) {hx=hz;lx=lz;} /* convert back to floating value and restore the sign */ - if((hx|lx)==0) /* return sign(x)*0 */ - return Zero[(u_int64_t)sx>>63]; + if((hx|lx)==0) /* return sign(x)*0 */ + return Zero[(u_int64_t)sx>>63]; while(hx<0x0001000000000000LL) { /* normalize x */ hx = hx+hx+(lx>>63); lx = lx+lx; iy -= 1; @@ -136,3 +128,4 @@ static long double one = 1.0, Zero[] = {0.0, -0.0,}; } return x; /* exact output */ } +strong_alias (__ieee754_fmodl, __fmodl_finite) diff --git a/sysdeps/ieee754/ldbl-128/e_gammal_r.c b/sysdeps/ieee754/ldbl-128/e_gammal_r.c index 36f5d45..2dbe6ac 100644 --- a/sysdeps/ieee754/ldbl-128/e_gammal_r.c +++ b/sysdeps/ieee754/ldbl-128/e_gammal_r.c @@ -1,8 +1,8 @@ /* Implementation of gamma function according to ISO C. - Copyright (C) 1997, 1999, 2002, 2004 Free Software Foundation, Inc. + Copyright (C) 1997, 1999, 2002, 2004, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997 and - Jakub Jelinek <jj@ultra.linux.cz, 1999. + Jakub Jelinek <jj@ultra.linux.cz, 1999. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -56,3 +56,4 @@ __ieee754_gammal_r (long double x, int *signgamp) /* XXX FIXME. */ return __ieee754_expl (__ieee754_lgammal_r (x, signgamp)); } +strong_alias (__ieee754_gammal_r, __gammal_r_finite) diff --git a/sysdeps/ieee754/ldbl-128/e_hypotl.c b/sysdeps/ieee754/ldbl-128/e_hypotl.c index 6834eac..dad78fe 100644 --- a/sysdeps/ieee754/ldbl-128/e_hypotl.c +++ b/sysdeps/ieee754/ldbl-128/e_hypotl.c @@ -13,10 +13,6 @@ * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: e_hypotl.c,v 1.9 1995/05/12 04:57:27 jtc Exp $"; -#endif - /* __ieee754_hypotl(x,y) * * Method : @@ -45,19 +41,15 @@ static char rcsid[] = "$NetBSD: e_hypotl.c,v 1.9 1995/05/12 04:57:27 jtc Exp $"; * hypotl(x,y) is NAN if x or y is NAN. * * Accuracy: - * hypotl(x,y) returns sqrtl(x^2+y^2) with error less - * than 1 ulps (units in the last place) + * hypotl(x,y) returns sqrtl(x^2+y^2) with error less + * than 1 ulps (units in the last place) */ #include "math.h" #include "math_private.h" -#ifdef __STDC__ - long double __ieee754_hypotl(long double x, long double y) -#else - long double __ieee754_hypotl(x,y) - long double x, y; -#endif +long double +__ieee754_hypotl(long double x, long double y) { long double a,b,t1,t2,y1,y2,w; int64_t j,k,ha,hb; @@ -89,7 +81,7 @@ static char rcsid[] = "$NetBSD: e_hypotl.c,v 1.9 1995/05/12 04:57:27 jtc Exp $"; } if(hb < 0x20bf000000000000LL) { /* b < 2**-8000 */ if(hb <= 0x0000ffffffffffffLL) { /* subnormal b or 0 */ - u_int64_t low; + u_int64_t low; GET_LDOUBLE_LSW64(low,b); if((hb|low)==0) return a; t1=0; @@ -98,7 +90,7 @@ static char rcsid[] = "$NetBSD: e_hypotl.c,v 1.9 1995/05/12 04:57:27 jtc Exp $"; a *= t1; k -= 16382; } else { /* scale a and b by 2^9600 */ - ha += 0x2580000000000000LL; /* a *= 2^9600 */ + ha += 0x2580000000000000LL; /* a *= 2^9600 */ hb += 0x2580000000000000LL; /* b *= 2^9600 */ k -= 9600; SET_LDOUBLE_MSW64(a,ha); @@ -130,3 +122,4 @@ static char rcsid[] = "$NetBSD: e_hypotl.c,v 1.9 1995/05/12 04:57:27 jtc Exp $"; return t1*w; } else return w; } +strong_alias (__ieee754_hypotl, __hypotl_finite) diff --git a/sysdeps/ieee754/ldbl-128/e_j0l.c b/sysdeps/ieee754/ldbl-128/e_j0l.c index bcd57e2..ef718b9 100644 --- a/sysdeps/ieee754/ldbl-128/e_j0l.c +++ b/sysdeps/ieee754/ldbl-128/e_j0l.c @@ -779,6 +779,7 @@ __ieee754_j0l (long double x) z = ONEOSQPI * (p * cc - q * ss) / __ieee754_sqrtl (xx); return z; } +strong_alias (__ieee754_j0l, __j0l_finite) /* Y0(x) = 2/pi * log(x) * J0(x) + R(x^2) @@ -918,3 +919,4 @@ long double z = ONEOSQPI * (p * ss + q * cc) / __ieee754_sqrtl (x); return z; } +strong_alias (__ieee754_y0l, __y0l_finite) diff --git a/sysdeps/ieee754/ldbl-128/e_j1l.c b/sysdeps/ieee754/ldbl-128/e_j1l.c index 7b73e2e..8d92b4f 100644 --- a/sysdeps/ieee754/ldbl-128/e_j1l.c +++ b/sysdeps/ieee754/ldbl-128/e_j1l.c @@ -786,6 +786,7 @@ __ieee754_j1l (long double x) z = -z; return z; } +strong_alias (__ieee754_j1l, __j1l_finite) /* Y1(x) = 2/pi * (log(x) * J1(x) - 1/x) + x R(x^2) @@ -925,3 +926,4 @@ __ieee754_y1l (long double x) z = ONEOSQPI * (p * ss + q * cc) / __ieee754_sqrtl (xx); return z; } +strong_alias (__ieee754_y1l, __y1l_finite) diff --git a/sysdeps/ieee754/ldbl-128/e_jnl.c b/sysdeps/ieee754/ldbl-128/e_jnl.c index a7f6772..8159163 100644 --- a/sysdeps/ieee754/ldbl-128/e_jnl.c +++ b/sysdeps/ieee754/ldbl-128/e_jnl.c @@ -11,9 +11,9 @@ /* Modifications for 128-bit long double are Copyright (C) 2001 Stephen L. Moshier <moshier@na-net.ornl.gov> - and are incorporated herein by permission of the author. The author + and are incorporated herein by permission of the author. The author reserves the right to distribute this material elsewhere under different - copying permissions. These modifications are distributed here under + copying permissions. These modifications are distributed here under the following terms: This library is free software; you can redistribute it and/or @@ -59,26 +59,15 @@ #include "math.h" #include "math_private.h" -#ifdef __STDC__ static const long double -#else -static long double -#endif invsqrtpi = 5.6418958354775628694807945156077258584405E-1L, two = 2.0e0L, one = 1.0e0L, zero = 0.0L; -#ifdef __STDC__ long double __ieee754_jnl (int n, long double x) -#else -long double -__ieee754_jnl (n, x) - int n; - long double x; -#endif { u_int32_t se; int32_t i, ix, sgn; @@ -302,16 +291,10 @@ __ieee754_jnl (n, x) else return b; } +strong_alias (__ieee754_jnl, __jnl_finite) -#ifdef __STDC__ long double __ieee754_ynl (int n, long double x) -#else -long double -__ieee754_ynl (n, x) - int n; - long double x; -#endif { u_int32_t se; int32_t i, ix; @@ -407,3 +390,4 @@ __ieee754_ynl (n, x) else return -b; } +strong_alias (__ieee754_ynl, __ynl_finite) diff --git a/sysdeps/ieee754/ldbl-128/e_lgammal_r.c b/sysdeps/ieee754/ldbl-128/e_lgammal_r.c index d080448..2482296 100644 --- a/sysdeps/ieee754/ldbl-128/e_lgammal_r.c +++ b/sysdeps/ieee754/ldbl-128/e_lgammal_r.c @@ -754,15 +754,8 @@ deval (long double x, const long double *p, int n) } -#ifdef __STDC__ long double __ieee754_lgammal_r (long double x, int *signgamp) -#else -long double -__ieee754_lgammal_r (x, signgamp) - long double x; - int *signgamp; -#endif { long double p, q, w, z, nx; int i, nn; @@ -775,7 +768,7 @@ __ieee754_lgammal_r (x, signgamp) if (x == 0.0L) { if (__signbitl (x)) - *signgamp = -1; + *signgamp = -1; } if (x < 0.0L) @@ -863,7 +856,7 @@ __ieee754_lgammal_r (x, signgamp) { z = x - 0.75L; p = z * neval (z, RN1r75, NRN1r75) - / deval (z, RD1r75, NRD1r75); + / deval (z, RD1r75, NRD1r75); p += lgam1r75b; p += lgam1r75a; } @@ -1040,3 +1033,4 @@ __ieee754_lgammal_r (x, signgamp) q += neval (p, RASY, NRASY) / x; return (q); } +strong_alias (__ieee754_lgammal_r, __lgammal_r_finite) diff --git a/sysdeps/ieee754/ldbl-128/e_log10l.c b/sysdeps/ieee754/ldbl-128/e_log10l.c index 1213177..6e69bbd 100644 --- a/sysdeps/ieee754/ldbl-128/e_log10l.c +++ b/sysdeps/ieee754/ldbl-128/e_log10l.c @@ -58,7 +58,7 @@ You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ @@ -179,8 +179,7 @@ deval (long double x, const long double *p, int n) long double -__ieee754_log10l (x) - long double x; +__ieee754_log10l (long double x) { long double z; long double y; @@ -256,3 +255,4 @@ done: z += e * L102A; return (z); } +strong_alias (__ieee754_log10l, __log10l_finite) diff --git a/sysdeps/ieee754/ldbl-128/e_log2l.c b/sysdeps/ieee754/ldbl-128/e_log2l.c index 8663d78..9a02394 100644 --- a/sysdeps/ieee754/ldbl-128/e_log2l.c +++ b/sysdeps/ieee754/ldbl-128/e_log2l.c @@ -57,7 +57,7 @@ You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "math.h" @@ -248,3 +248,4 @@ done: z += e; return (z); } +strong_alias (__ieee754_log2l, __log2l_finite) diff --git a/sysdeps/ieee754/ldbl-128/e_logl.c b/sysdeps/ieee754/ldbl-128/e_logl.c index b9e17f8..6d53287 100644 --- a/sysdeps/ieee754/ldbl-128/e_logl.c +++ b/sysdeps/ieee754/ldbl-128/e_logl.c @@ -42,7 +42,7 @@ * */ -/* Copyright 2001 by Stephen L. Moshier <moshier@na-net.ornl.gov> +/* Copyright 2001 by Stephen L. Moshier <moshier@na-net.ornl.gov> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -251,7 +251,7 @@ __ieee754_logl(long double x) /* log(u) = log( t u/t ) = log(t) + log(u/t) log(t) is tabulated in the lookup table. Express log(u/t) = log(1+z), where z = u/t - 1 = (u-t)/t. - cf. Cody & Waite. */ + cf. Cody & Waite. */ z = (u.value - t.value) / t.value; } /* Series expansion of log(1+z). */ @@ -277,3 +277,4 @@ __ieee754_logl(long double x) y += e * ln2a; return y; } +strong_alias (__ieee754_logl, __logl_finite) diff --git a/sysdeps/ieee754/ldbl-128/e_powl.c b/sysdeps/ieee754/ldbl-128/e_powl.c index ba7e27b..d8e1af0 100644 --- a/sysdeps/ieee754/ldbl-128/e_powl.c +++ b/sysdeps/ieee754/ldbl-128/e_powl.c @@ -11,9 +11,9 @@ /* Expansions and modifications for 128-bit long double are Copyright (C) 2001 Stephen L. Moshier <moshier@na-net.ornl.gov> - and are incorporated herein by permission of the author. The author + and are incorporated herein by permission of the author. The author reserves the right to distribute this material elsewhere under different - copying permissions. These modifications are distributed here under + copying permissions. These modifications are distributed here under the following terms: This library is free software; you can redistribute it and/or @@ -144,14 +144,8 @@ static const long double cp_h = 9.6179669392597555432899980587535537779331E-1L, cp_l = 5.0577616648125906047157785230014751039424E-17L; -#ifdef __STDC__ long double __ieee754_powl (long double x, long double y) -#else -long double -__ieee754_powl (x, y) - long double x, y; -#endif { long double z, ax, z_h, z_l, p_h, p_l; long double y1, t1, t2, r, s, t, u, v, w; @@ -445,3 +439,4 @@ __ieee754_powl (x, y) } return s * z; } +strong_alias (__ieee754_powl, __powl_finite) diff --git a/sysdeps/ieee754/ldbl-128/e_remainderl.c b/sysdeps/ieee754/ldbl-128/e_remainderl.c index 81af247..8423380 100644 --- a/sysdeps/ieee754/ldbl-128/e_remainderl.c +++ b/sysdeps/ieee754/ldbl-128/e_remainderl.c @@ -7,36 +7,28 @@ * * Developed at SunPro, 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. * ==================================================== */ /* __ieee754_remainderl(x,p) - * Return : - * returns x REM p = x - [x/p]*p as if in infinite - * precise arithmetic, where [x/p] is the (infinite bit) + * Return : + * returns x REM p = x - [x/p]*p as if in infinite + * precise arithmetic, where [x/p] is the (infinite bit) * integer nearest x/p (in half way case choose the even one). - * Method : + * Method : * Based on fmodl() return x-[x/p]chopped*p exactlp. */ #include "math.h" #include "math_private.h" -#ifdef __STDC__ static const long double zero = 0.0L; -#else -static long double zero = 0.0L; -#endif -#ifdef __STDC__ - long double __ieee754_remainderl(long double x, long double p) -#else - long double __ieee754_remainderl(x,p) - long double x,p; -#endif +long double +__ieee754_remainderl(long double x, long double p) { int64_t hx,hp; u_int64_t sx,lx,lp; @@ -49,7 +41,7 @@ static long double zero = 0.0L; hx &= 0x7fffffffffffffffLL; /* purge off exception values */ - if((hp|lp)==0) return (x*p)/(x*p); /* p = 0 */ + if((hp|lp)==0) return (x*p)/(x*p); /* p = 0 */ if((hx>=0x7fff000000000000LL)|| /* x not finite */ ((hp>=0x7fff000000000000LL)&& /* p is NaN */ (((hp-0x7fff000000000000LL)|lp)!=0))) @@ -76,3 +68,4 @@ static long double zero = 0.0L; SET_LDOUBLE_MSW64(x,hx^sx); return x; } +strong_alias (__ieee754_remainderl, __remainderl_finite) diff --git a/sysdeps/ieee754/ldbl-128/e_sinhl.c b/sysdeps/ieee754/ldbl-128/e_sinhl.c index 93f4179..ac36cac 100644 --- a/sysdeps/ieee754/ldbl-128/e_sinhl.c +++ b/sysdeps/ieee754/ldbl-128/e_sinhl.c @@ -16,9 +16,9 @@ /* Changes for 128-bit long double are Copyright (C) 2001 Stephen L. Moshier <moshier@na-net.ornl.gov> - and are incorporated herein by permission of the author. The author + and are incorporated herein by permission of the author. The author reserves the right to distribute this material elsewhere under different - copying permissions. These modifications are distributed here under + copying permissions. These modifications are distributed here under the following terms: This library is free software; you can redistribute it and/or @@ -56,22 +56,11 @@ #include "math.h" #include "math_private.h" -#ifdef __STDC__ static const long double one = 1.0, shuge = 1.0e4931L, ovf_thresh = 1.1357216553474703894801348310092223067821E4L; -#else -static long double one = 1.0, shuge = 1.0e4931L, -ovf_thresh = 1.1357216553474703894801348310092223067821E4L; -#endif -#ifdef __STDC__ long double __ieee754_sinhl (long double x) -#else -long double -__ieee754_sinhl (x) - long double x; -#endif { long double t, w, h; u_int32_t jx, ix; @@ -121,3 +110,4 @@ __ieee754_sinhl (x) /* |x| > overflowthreshold, sinhl(x) overflow */ return x * shuge; } +strong_alias (__ieee754_sinhl, __sinhl_finite) diff --git a/sysdeps/ieee754/ldbl-128ibm/e_acoshl.c b/sysdeps/ieee754/ldbl-128ibm/e_acoshl.c index 00576c7..20d94ea 100644 --- a/sysdeps/ieee754/ldbl-128ibm/e_acoshl.c +++ b/sysdeps/ieee754/ldbl-128ibm/e_acoshl.c @@ -10,10 +10,6 @@ * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: e_acosh.c,v 1.9 1995/05/12 04:57:18 jtc Exp $"; -#endif - /* __ieee754_acosh(x) * Method : * Based on @@ -31,20 +27,12 @@ static char rcsid[] = "$NetBSD: e_acosh.c,v 1.9 1995/05/12 04:57:18 jtc Exp $"; #include "math.h" #include "math_private.h" -#ifdef __STDC__ static const long double -#else -static long double -#endif one = 1.0L, ln2 = 6.93147180559945286227e-01L; /* 0x3FE62E42, 0xFEFA39EF */ -#ifdef __STDC__ - long double __ieee754_acoshl(long double x) -#else - long double __ieee754_acoshl(x) - long double x; -#endif +long double +__ieee754_acoshl(long double x) { long double t; int64_t hx; @@ -54,7 +42,7 @@ ln2 = 6.93147180559945286227e-01L; /* 0x3FE62E42, 0xFEFA39EF */ return (x-x)/(x-x); } else if(hx >=0x41b0000000000000LL) { /* x > 2**28 */ if(hx >=0x7ff0000000000000LL) { /* x is inf of NaN */ - return x+x; + return x+x; } else return __ieee754_logl(x)+ln2; /* acosh(huge)=log(2x) */ } else if (((hx-0x3ff0000000000000LL)|(lx&0x7fffffffffffffffLL))==0) { @@ -67,3 +55,4 @@ ln2 = 6.93147180559945286227e-01L; /* 0x3FE62E42, 0xFEFA39EF */ return __log1p(t+__sqrtl(2.0*t+t*t)); } } +strong_alias (__ieee754_acoshl, __acoshl_finite) diff --git a/sysdeps/ieee754/ldbl-128ibm/e_acosl.c b/sysdeps/ieee754/ldbl-128ibm/e_acosl.c index 8823fd6..1b37c92 100644 --- a/sysdeps/ieee754/ldbl-128ibm/e_acosl.c +++ b/sysdeps/ieee754/ldbl-128ibm/e_acosl.c @@ -283,11 +283,11 @@ __ieee754_acosl (x) s = __ieee754_sqrtl (z); /* Compute an extended precision square root from the Newton iteration s -> 0.5 * (s + z / s). - The change w from s to the improved value is + The change w from s to the improved value is w = 0.5 * (s + z / s) - s = (s^2 + z)/2s - s = (z - s^2)/2s. - Express s = f1 + f2 where f1 * f1 is exactly representable. + Express s = f1 + f2 where f1 * f1 is exactly representable. w = (z - s^2)/2s = (z - f1^2 - 2 f1 f2 - f2^2)/2s . - s + w has extended precision. */ + s + w has extended precision. */ u.value = s; u.parts32.w2 = 0; u.parts32.w3 = 0; @@ -326,3 +326,4 @@ __ieee754_acosl (x) return 2.0 * w; } } +strong_alias (__ieee754_acosl, __acosl_finite) diff --git a/sysdeps/ieee754/ldbl-128ibm/e_asinl.c b/sysdeps/ieee754/ldbl-128ibm/e_asinl.c index 3696694..6c61232 100644 --- a/sysdeps/ieee754/ldbl-128ibm/e_asinl.c +++ b/sysdeps/ieee754/ldbl-128ibm/e_asinl.c @@ -12,9 +12,9 @@ /* Long double expansions are Copyright (C) 2001 Stephen L. Moshier <moshier@na-net.ornl.gov> - and are incorporated herein by permission of the author. The author - reserves the right to distribute this material elsewhere under different - copying permissions. These modifications are distributed here under the + and are incorporated herein by permission of the author. The author + reserves the right to distribute this material elsewhere under different + copying permissions. These modifications are distributed here under the following terms: This library is free software; you can redistribute it and/or @@ -263,3 +263,4 @@ __ieee754_asinl (x) else return -t; } +strong_alias (__ieee754_asinl, __asinl_finite) diff --git a/sysdeps/ieee754/ldbl-128ibm/e_atan2l.c b/sysdeps/ieee754/ldbl-128ibm/e_atan2l.c index a4bb53d..a5b6621 100644 --- a/sysdeps/ieee754/ldbl-128ibm/e_atan2l.c +++ b/sysdeps/ieee754/ldbl-128ibm/e_atan2l.c @@ -17,7 +17,7 @@ * Method : * 1. Reduce y to positive by atan2l(y,x)=-atan2l(-y,x). * 2. Reduce x to positive by (if x and y are unexceptional): - * ARG (x+iy) = arctan(y/x) ... if x > 0, + * ARG (x+iy) = arctan(y/x) ... if x > 0, * ARG (x+iy) = pi - arctan[y/(-x)] ... if x < 0, * * Special cases: @@ -43,11 +43,7 @@ #include "math.h" #include "math_private.h" -#ifdef __STDC__ static const long double -#else -static long double -#endif tiny = 1.0e-300L, zero = 0.0, pi_o_4 = 7.85398163397448309615660845819875699e-01L, /* 3ffe921fb54442d18469898cc51701b8 */ @@ -55,12 +51,8 @@ pi_o_2 = 1.57079632679489661923132169163975140e+00L, /* 3fff921fb54442d18469898 pi = 3.14159265358979323846264338327950280e+00L, /* 4000921fb54442d18469898cc51701b8 */ pi_lo = 8.67181013012378102479704402604335225e-35L; /* 3f8dcd129024e088a67cc74020bbea64 */ -#ifdef __STDC__ - long double __ieee754_atan2l(long double y, long double x) -#else - long double __ieee754_atan2l(y,x) - long double y,x; -#endif +long double +__ieee754_atan2l(long double y, long double x) { long double z; int64_t k,m,hx,hy,ix,iy; @@ -80,7 +72,7 @@ pi_lo = 8.67181013012378102479704402604335225e-35L; /* 3f8dcd129024e088a67cc74 if((iy|(ly&0x7fffffffffffffffLL))==0) { switch(m) { case 0: - case 1: return y; /* atan(+-0,+anything)=+-0 */ + case 1: return y; /* atan(+-0,+anything)=+-0 */ case 2: return pi+tiny;/* atan(+0,-anything) = pi */ case 3: return -pi-tiny;/* atan(-0,-anything) =-pi */ } @@ -111,14 +103,15 @@ pi_lo = 8.67181013012378102479704402604335225e-35L; /* 3f8dcd129024e088a67cc74 /* compute y/x */ k = (iy-ix)>>52; - if(k > 120) z=pi_o_2+0.5L*pi_lo; /* |y/x| > 2**120 */ - else if(hx<0&&k<-120) z=0.0L; /* |y|/x < -2**120 */ + if(k > 120) z=pi_o_2+0.5L*pi_lo; /* |y/x| > 2**120 */ + else if(hx<0&&k<-120) z=0.0L; /* |y|/x < -2**120 */ else z=__atanl(fabsl(y/x)); /* safe to do y/x */ switch (m) { case 0: return z ; /* atan(+,+) */ case 1: return -z ; /* atan(-,+) */ case 2: return pi-(z-pi_lo);/* atan(+,-) */ default: /* case 3 */ - return (z-pi_lo)-pi;/* atan(-,-) */ + return (z-pi_lo)-pi;/* atan(-,-) */ } } +strong_alias (__ieee754_atan2l, __atan2l_finite) diff --git a/sysdeps/ieee754/ldbl-128ibm/e_atanhl.c b/sysdeps/ieee754/ldbl-128ibm/e_atanhl.c index a801bd6..c879e45 100644 --- a/sysdeps/ieee754/ldbl-128ibm/e_atanhl.c +++ b/sysdeps/ieee754/ldbl-128ibm/e_atanhl.c @@ -10,10 +10,6 @@ * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: e_atanh.c,v 1.8 1995/05/10 20:44:55 jtc Exp $"; -#endif - /* __ieee754_atanh(x) * Method : * 1.Reduced x to positive by atanh(-x) = -atanh(x) @@ -22,7 +18,7 @@ static char rcsid[] = "$NetBSD: e_atanh.c,v 1.8 1995/05/10 20:44:55 jtc Exp $"; * atanh(x) = --- * log(1 + -------) = 0.5 * log1p(2 * --------) * 2 1 - x 1 - x * - * For x<0.5 + * For x<0.5 * atanh(x) = 0.5*log1p(2x+2x*x/(1-x)) * * Special cases: @@ -35,24 +31,12 @@ static char rcsid[] = "$NetBSD: e_atanh.c,v 1.8 1995/05/10 20:44:55 jtc Exp $"; #include "math.h" #include "math_private.h" -#ifdef __STDC__ static const long double one = 1.0L, huge = 1e300L; -#else -static long double one = 1.0L, huge = 1e300L; -#endif -#ifdef __STDC__ static const long double zero = 0.0L; -#else -static long double zero = 0.0L; -#endif -#ifdef __STDC__ - long double __ieee754_atanhl(long double x) -#else - long double __ieee754_atanhl(x) - long double x; -#endif +long double +__ieee754_atanhl(long double x) { long double t; int64_t hx,ix; @@ -61,7 +45,7 @@ static long double zero = 0.0L; ix = hx&0x7fffffffffffffffLL; if (ix >= 0x3ff0000000000000LL) { /* |x|>=1 */ if (ix > 0x3ff0000000000000LL) - return (x-x)/(x-x); + return (x-x)/(x-x); t = fabsl (x); if (t > one) return (x-x)/(x-x); @@ -77,3 +61,4 @@ static long double zero = 0.0L; t = 0.5*__log1pl((x+x)/(one-x)); if(hx>=0) return t; else return -t; } +strong_alias (__ieee754_atanhl, __atanhl_finite) diff --git a/sysdeps/ieee754/ldbl-128ibm/e_coshl.c b/sysdeps/ieee754/ldbl-128ibm/e_coshl.c index 73cb478..ebc9436 100644 --- a/sysdeps/ieee754/ldbl-128ibm/e_coshl.c +++ b/sysdeps/ieee754/ldbl-128ibm/e_coshl.c @@ -10,22 +10,18 @@ * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: e_cosh.c,v 1.7 1995/05/10 20:44:58 jtc Exp $"; -#endif - /* __ieee754_cosh(x) * Method : * mathematically cosh(x) if defined to be (exp(x)+exp(-x))/2 * 1. Replace x by |x| (cosh(x) = cosh(-x)). * 2. - * [ exp(x) - 1 ]^2 + * [ exp(x) - 1 ]^2 * 0 <= x <= ln2/2 : cosh(x) := 1 + ------------------- - * 2*exp(x) + * 2*exp(x) * - * exp(x) + 1/exp(x) + * exp(x) + 1/exp(x) * ln2/2 <= x <= 22 : cosh(x) := ------------------- - * 2 + * 2 * 22 <= x <= lnovft : cosh(x) := exp(x)/2 * lnovft <= x <= ln2ovft: cosh(x) := exp(x/2)/2 * exp(x/2) * ln2ovft < x : cosh(x) := huge*huge (overflow) @@ -38,18 +34,10 @@ static char rcsid[] = "$NetBSD: e_cosh.c,v 1.7 1995/05/10 20:44:58 jtc Exp $"; #include "math.h" #include "math_private.h" -#ifdef __STDC__ static const long double one = 1.0L, half=0.5L, huge = 1.0e300L; -#else -static long double one = 1.0L, half=0.5L, huge = 1.0e300L; -#endif -#ifdef __STDC__ - long double __ieee754_coshl(long double x) -#else - long double __ieee754_coshl(x) - long double x; -#endif +long double +__ieee754_coshl (long double x) { long double t,w; int64_t ix; @@ -79,7 +67,7 @@ static long double one = 1.0L, half=0.5L, huge = 1.0e300L; if (ix < 0x40862e42fefa39efLL) return half*__ieee754_expl(fabsl(x)); /* |x| in [log(maxdouble), overflowthresold] */ - if (ix < 0x408633ce8fb9f87dLL) { + if (ix < 0x408633ce8fb9f87dLL) { w = __ieee754_expl(half*fabsl(x)); t = half*w; return t*w; @@ -88,3 +76,4 @@ static long double one = 1.0L, half=0.5L, huge = 1.0e300L; /* |x| > overflowthresold, cosh(x) overflow */ return huge*huge; } +strong_alias (__ieee754_coshl, __coshl_finite) diff --git a/sysdeps/ieee754/ldbl-128ibm/e_fmodl.c b/sysdeps/ieee754/ldbl-128ibm/e_fmodl.c index e99b0ba..4ad59a0 100644 --- a/sysdeps/ieee754/ldbl-128ibm/e_fmodl.c +++ b/sysdeps/ieee754/ldbl-128ibm/e_fmodl.c @@ -22,18 +22,10 @@ #include "math_private.h" #include <ieee754.h> -#ifdef __STDC__ static const long double one = 1.0, Zero[] = {0.0, -0.0,}; -#else -static long double one = 1.0, Zero[] = {0.0, -0.0,}; -#endif -#ifdef __STDC__ - long double __ieee754_fmodl(long double x, long double y) -#else - long double __ieee754_fmodl(x,y) - long double x,y; -#endif +long double +__ieee754_fmodl (long double x, long double y) { int64_t n,hx,hy,hz,ix,iy,sx,i; u_int64_t lx,ly,lz; @@ -76,8 +68,8 @@ static long double one = 1.0, Zero[] = {0.0, -0.0,}; /* Make the IBM extended format 105 bit mantissa look like the ieee854 112 bit mantissa so the following operatations will give the correct result. */ - ldbl_extract_mantissa(&hx, &lx, &temp, x); - ldbl_extract_mantissa(&hy, &ly, &temp, y); + ldbl_extract_mantissa(&hx, &lx, &temp, x); + ldbl_extract_mantissa(&hy, &ly, &temp, y); /* set up {hx,lx}, {hy,ly} and align y to x */ if(ix >= -1022) @@ -85,8 +77,8 @@ static long double one = 1.0, Zero[] = {0.0, -0.0,}; else { /* subnormal x, shift x to normal */ n = -1022-ix; if(n<=63) { - hx = (hx<<n)|(lx>>(64-n)); - lx <<= n; + hx = (hx<<n)|(lx>>(64-n)); + lx <<= n; } else { hx = lx<<(n-64); lx = 0; @@ -97,8 +89,8 @@ static long double one = 1.0, Zero[] = {0.0, -0.0,}; else { /* subnormal y, shift y to normal */ n = -1022-iy; if(n<=63) { - hy = (hy<<n)|(ly>>(64-n)); - ly <<= n; + hy = (hy<<n)|(ly>>(64-n)); + ly <<= n; } else { hy = ly<<(n-64); ly = 0; @@ -111,16 +103,16 @@ static long double one = 1.0, Zero[] = {0.0, -0.0,}; hz=hx-hy;lz=lx-ly; if(lx<ly) hz -= 1; if(hz<0){hx = hx+hx+(lx>>63); lx = lx+lx;} else { - if((hz|(lz&0x7fffffffffffffff))==0) /* return sign(x)*0 */ + if((hz|(lz&0x7fffffffffffffff))==0) /* return sign(x)*0 */ return Zero[(u_int64_t)sx>>63]; - hx = hz+hz+(lz>>63); lx = lz+lz; + hx = hz+hz+(lz>>63); lx = lz+lz; } } hz=hx-hy;lz=lx-ly; if(lx<ly) hz -= 1; if(hz>=0) {hx=hz;lx=lz;} /* convert back to floating value and restore the sign */ - if((hx|(lx&0x7fffffffffffffff))==0) /* return sign(x)*0 */ + if((hx|(lx&0x7fffffffffffffff))==0) /* return sign(x)*0 */ return Zero[(u_int64_t)sx>>63]; while(hx<0x0001000000000000LL) { /* normalize x */ hx = hx+hx+(lx>>63); lx = lx+lx; @@ -143,3 +135,4 @@ static long double one = 1.0, Zero[] = {0.0, -0.0,}; } return x; /* exact output */ } +strong_alias (__ieee754_fmodl, __fmodl_finite) diff --git a/sysdeps/ieee754/ldbl-128ibm/e_gammal_r.c b/sysdeps/ieee754/ldbl-128ibm/e_gammal_r.c index 03bcb21..f20ea9e 100644 --- a/sysdeps/ieee754/ldbl-128ibm/e_gammal_r.c +++ b/sysdeps/ieee754/ldbl-128ibm/e_gammal_r.c @@ -1,8 +1,8 @@ /* Implementation of gamma function according to ISO C. - Copyright (C) 1997,1999,2002,2004,2006 Free Software Foundation, Inc. + Copyright (C) 1997,1999,2002,2004,2006,2011 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997 and - Jakub Jelinek <jj@ultra.linux.cz, 1999. + Jakub Jelinek <jj@ultra.linux.cz, 1999. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -56,3 +56,4 @@ __ieee754_gammal_r (long double x, int *signgamp) /* XXX FIXME. */ return __ieee754_expl (__ieee754_lgammal_r (x, signgamp)); } +strong_alias (__ieee754_gammal_r, __gammal_r_finite) diff --git a/sysdeps/ieee754/ldbl-128ibm/e_hypotl.c b/sysdeps/ieee754/ldbl-128ibm/e_hypotl.c index 4330f28..4ef0767 100644 --- a/sysdeps/ieee754/ldbl-128ibm/e_hypotl.c +++ b/sysdeps/ieee754/ldbl-128ibm/e_hypotl.c @@ -10,10 +10,6 @@ * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: e_hypotl.c,v 1.9 1995/05/12 04:57:27 jtc Exp $"; -#endif - /* __ieee754_hypotl(x,y) * * Method : @@ -42,8 +38,8 @@ static char rcsid[] = "$NetBSD: e_hypotl.c,v 1.9 1995/05/12 04:57:27 jtc Exp $"; * hypotl(x,y) is NAN if x or y is NAN. * * Accuracy: - * hypotl(x,y) returns sqrtl(x^2+y^2) with error less - * than 1 ulps (units in the last place) + * hypotl(x,y) returns sqrtl(x^2+y^2) with error less + * than 1 ulps (units in the last place) */ #include "math.h" @@ -52,12 +48,8 @@ static char rcsid[] = "$NetBSD: e_hypotl.c,v 1.9 1995/05/12 04:57:27 jtc Exp $"; static const long double two600 = 0x1.0p+600L; static const long double two1022 = 0x1.0p+1022L; -#ifdef __STDC__ - long double __ieee754_hypotl(long double x, long double y) -#else - long double __ieee754_hypotl(x,y) - long double x, y; -#endif +long double +__ieee754_hypotl(long double x, long double y) { long double a,b,t1,t2,y1,y2,w,kld; int64_t j,k,ha,hb; @@ -93,7 +85,7 @@ static const long double two1022 = 0x1.0p+1022L; } if(hb < 0x20b0000000000000LL) { /* b < 2**-500 */ if(hb <= 0x000fffffffffffffLL) { /* subnormal b or 0 */ - u_int64_t low; + u_int64_t low; GET_LDOUBLE_LSW64(low,b); if((hb|(low&0x7fffffffffffffffLL))==0) return a; t1=two1022; /* t1=2^1022 */ @@ -102,7 +94,7 @@ static const long double two1022 = 0x1.0p+1022L; k -= 1022; kld = kld / two1022; } else { /* scale a and b by 2^600 */ - ha += 0x2580000000000000LL; /* a *= 2^600 */ + ha += 0x2580000000000000LL; /* a *= 2^600 */ hb += 0x2580000000000000LL; /* b *= 2^600 */ k -= 600; a *= two600; @@ -129,3 +121,4 @@ static const long double two1022 = 0x1.0p+1022L; else return w; } +strong_alias (__ieee754_hypotl, __hypotl_finite) diff --git a/sysdeps/ieee754/ldbl-128ibm/e_log10l.c b/sysdeps/ieee754/ldbl-128ibm/e_log10l.c index 27e2c71..de57be3 100644 --- a/sysdeps/ieee754/ldbl-128ibm/e_log10l.c +++ b/sysdeps/ieee754/ldbl-128ibm/e_log10l.c @@ -179,8 +179,7 @@ deval (long double x, const long double *p, int n) long double -__ieee754_log10l (x) - long double x; +__ieee754_log10l (long double x) { long double z; long double y; @@ -256,3 +255,4 @@ done: z += e * L102A; return (z); } +strong_alias (__ieee754_log10l, __log10l_finite) diff --git a/sysdeps/ieee754/ldbl-128ibm/e_log2l.c b/sysdeps/ieee754/ldbl-128ibm/e_log2l.c index fe8a8e1..9737e13 100644 --- a/sysdeps/ieee754/ldbl-128ibm/e_log2l.c +++ b/sysdeps/ieee754/ldbl-128ibm/e_log2l.c @@ -248,3 +248,4 @@ done: z += e; return (z); } +strong_alias (__ieee754_log2l, __log2l_finite) diff --git a/sysdeps/ieee754/ldbl-128ibm/e_logl.c b/sysdeps/ieee754/ldbl-128ibm/e_logl.c index aa5fc37..6832608 100644 --- a/sysdeps/ieee754/ldbl-128ibm/e_logl.c +++ b/sysdeps/ieee754/ldbl-128ibm/e_logl.c @@ -253,7 +253,7 @@ __ieee754_logl(long double x) /* log(u) = log( t u/t ) = log(t) + log(u/t) log(t) is tabulated in the lookup table. Express log(u/t) = log(1+z), where z = u/t - 1 = (u-t)/t. - cf. Cody & Waite. */ + cf. Cody & Waite. */ z = (u.value - t.value) / t.value; } /* Series expansion of log(1+z). */ @@ -279,3 +279,4 @@ __ieee754_logl(long double x) y += e * ln2a; return y; } +strong_alias (__ieee754_logl, __logl_finite) diff --git a/sysdeps/ieee754/ldbl-128ibm/e_powl.c b/sysdeps/ieee754/ldbl-128ibm/e_powl.c index feeaa8c..9b1f2be 100644 --- a/sysdeps/ieee754/ldbl-128ibm/e_powl.c +++ b/sysdeps/ieee754/ldbl-128ibm/e_powl.c @@ -144,14 +144,8 @@ static const long double cp_h = 9.6179669392597555432899980587535537779331E-1L, cp_l = 5.0577616648125906047157785230014751039424E-17L; -#ifdef __STDC__ long double __ieee754_powl (long double x, long double y) -#else -long double -__ieee754_powl (x, y) - long double x, y; -#endif { long double z, ax, z_h, z_l, p_h, p_l; long double y1, t1, t2, r, s, t, u, v, w; @@ -390,7 +384,7 @@ __ieee754_powl (x, y) { /* if z > 16384 */ if (((j - 0x40d00000) | o.parts32.w1 - | (o.parts32.w2 & 0x7fffffff) | o.parts32.w3) != 0) + | (o.parts32.w2 & 0x7fffffff) | o.parts32.w3) != 0) return s * huge * huge; /* overflow */ else { @@ -402,7 +396,7 @@ __ieee754_powl (x, y) { /* z < -16495 */ if (((j - 0xc0d01bc0) | o.parts32.w1 - | (o.parts32.w2 & 0x7fffffff) | o.parts32.w3) != 0) + | (o.parts32.w2 & 0x7fffffff) | o.parts32.w3) != 0) return s * tiny * tiny; /* underflow */ else { @@ -439,3 +433,4 @@ __ieee754_powl (x, y) z = __scalbnl (z, n); return s * z; } +strong_alias (__ieee754_powl, __powl_finite) diff --git a/sysdeps/ieee754/ldbl-128ibm/e_remainderl.c b/sysdeps/ieee754/ldbl-128ibm/e_remainderl.c index b7fa68f..d4a847d 100644 --- a/sysdeps/ieee754/ldbl-128ibm/e_remainderl.c +++ b/sysdeps/ieee754/ldbl-128ibm/e_remainderl.c @@ -14,8 +14,8 @@ /* __ieee754_remainderl(x,p) * Return : - * returns x REM p = x - [x/p]*p as if in infinite - * precise arithmetic, where [x/p] is the (infinite bit) + * returns x REM p = x - [x/p]*p as if in infinite + * precise arithmetic, where [x/p] is the (infinite bit) * integer nearest x/p (in half way case choose the even one). * Method : * Based on fmodl() return x-[x/p]chopped*p exactlp. @@ -24,19 +24,11 @@ #include "math.h" #include "math_private.h" -#ifdef __STDC__ static const long double zero = 0.0L; -#else -static long double zero = 0.0L; -#endif -#ifdef __STDC__ - long double __ieee754_remainderl(long double x, long double p) -#else - long double __ieee754_remainderl(x,p) - long double x,p; -#endif +long double +__ieee754_remainderl(long double x, long double p) { int64_t hx,hp; u_int64_t sx,lx,lp; @@ -49,7 +41,7 @@ static long double zero = 0.0L; hx &= 0x7fffffffffffffffLL; /* purge off exception values */ - if((hp|(lp&0x7fffffffffffffff))==0) return (x*p)/(x*p); /* p = 0 */ + if((hp|(lp&0x7fffffffffffffff))==0) return (x*p)/(x*p); /* p = 0 */ if((hx>=0x7ff0000000000000LL)|| /* x not finite */ ((hp>=0x7ff0000000000000LL)&& /* p is NaN */ (((hp-0x7ff0000000000000LL)|lp)!=0))) @@ -76,3 +68,4 @@ static long double zero = 0.0L; SET_LDOUBLE_MSW64(x,hx^sx); return x; } +strong_alias (__ieee754_remainderl, __remainderl_finite) diff --git a/sysdeps/ieee754/ldbl-128ibm/e_sinhl.c b/sysdeps/ieee754/ldbl-128ibm/e_sinhl.c index 38ae71d..b8e86b1 100644 --- a/sysdeps/ieee754/ldbl-128ibm/e_sinhl.c +++ b/sysdeps/ieee754/ldbl-128ibm/e_sinhl.c @@ -10,18 +10,14 @@ */ -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: e_sinh.c,v 1.7 1995/05/10 20:46:13 jtc Exp $"; -#endif - /* __ieee754_sinh(x) * Method : * mathematically sinh(x) if defined to be (exp(x)-exp(-x))/2 * 1. Replace x by |x| (sinh(-x) = -sinh(x)). * 2. - * E + E/(E+1) + * E + E/(E+1) * 0 <= x <= 22 : sinh(x) := --------------, E=expm1(x) - * 2 + * 2 * * 22 <= x <= lnovft : sinh(x) := exp(x)/2 * lnovft <= x <= ln2ovft: sinh(x) := exp(x/2)/2 * exp(x/2) @@ -35,18 +31,10 @@ static char rcsid[] = "$NetBSD: e_sinh.c,v 1.7 1995/05/10 20:46:13 jtc Exp $"; #include "math.h" #include "math_private.h" -#ifdef __STDC__ static const long double one = 1.0, shuge = 1.0e307; -#else -static long double one = 1.0, shuge = 1.0e307; -#endif -#ifdef __STDC__ - long double __ieee754_sinhl(long double x) -#else - long double __ieee754_sinhl(x) - long double x; -#endif +long double +__ieee754_sinhl(long double x) { long double t,w,h; int64_t ix,jx; @@ -62,7 +50,7 @@ static long double one = 1.0, shuge = 1.0e307; if (jx<0) h = -h; /* |x| in [0,22], return sign(x)*0.5*(E+E/(E+1))) */ if (ix < 0x4036000000000000LL) { /* |x|<22 */ - if (ix<0x3e20000000000000LL) /* |x|<2**-29 */ + if (ix<0x3e20000000000000LL) /* |x|<2**-29 */ if(shuge+x>one) return x;/* sinhl(tiny) = tiny with inexact */ t = __expm1l(fabsl(x)); if(ix<0x3ff0000000000000LL) return h*(2.0*t-t*t/(t+one)); @@ -82,3 +70,4 @@ static long double one = 1.0, shuge = 1.0e307; /* |x| > overflowthresold, sinh(x) overflow */ return x*shuge; } +strong_alias (__ieee754_sinhl, __sinhl_finite) diff --git a/sysdeps/ieee754/ldbl-128ibm/e_sqrtl.c b/sysdeps/ieee754/ldbl-128ibm/e_sqrtl.c index fe6bb55..68aa18f 100644 --- a/sysdeps/ieee754/ldbl-128ibm/e_sqrtl.c +++ b/sysdeps/ieee754/ldbl-128ibm/e_sqrtl.c @@ -1,7 +1,7 @@ /* * IBM Accurate Mathematical Library * written by International Business Machines Corp. - * Copyright (C) 2001, 2004, 2006 Free Software Foundation + * Copyright (C) 2001, 2004, 2006, 2011 Free Software Foundation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -50,7 +50,7 @@ twom54 = 5.55111512312578270212e-17; /* 0x3C90000000000000 */ /* it computes the correctly rounded (to nearest) value of square */ /* root of x. */ /*********************************************************************/ -long double __ieee754_sqrtl(long double x) +long double __ieee754_sqrtl(long double x) { static const long double big = 134217728.0, big1 = 134217729.0; long double t,s,i; @@ -107,3 +107,4 @@ long double __ieee754_sqrtl(long double x) return tm256.x*__ieee754_sqrtl(x*t512.x); } } +strong_alias (__ieee754_sqrtl, __sqrtl_finite) diff --git a/sysdeps/ieee754/ldbl-96/e_acoshl.c b/sysdeps/ieee754/ldbl-96/e_acoshl.c index 5d4fa1d..6f709b7 100644 --- a/sysdeps/ieee754/ldbl-96/e_acoshl.c +++ b/sysdeps/ieee754/ldbl-96/e_acoshl.c @@ -14,10 +14,6 @@ * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - /* __ieee754_acoshl(x) * Method : * Based on @@ -35,20 +31,12 @@ static char rcsid[] = "$NetBSD: $"; #include "math.h" #include "math_private.h" -#ifdef __STDC__ static const long double -#else -static long double -#endif one = 1.0, ln2 = 6.931471805599453094287e-01L; /* 0x3FFE, 0xB17217F7, 0xD1CF79AC */ -#ifdef __STDC__ - long double __ieee754_acoshl(long double x) -#else - long double __ieee754_acoshl(x) - long double x; -#endif +long double +__ieee754_acoshl(long double x) { long double t; u_int32_t se,i0,i1; @@ -57,7 +45,7 @@ ln2 = 6.931471805599453094287e-01L; /* 0x3FFE, 0xB17217F7, 0xD1CF79AC */ return (x-x)/(x-x); } else if(se >=0x401d) { /* x > 2**30 */ if(se >=0x7fff) { /* x is inf of NaN */ - return x+x; + return x+x; } else return __ieee754_logl(x)+ln2; /* acoshl(huge)=logl(2x) */ } else if(((se-0x3fff)|i0|i1)==0) { @@ -70,3 +58,4 @@ ln2 = 6.931471805599453094287e-01L; /* 0x3FFE, 0xB17217F7, 0xD1CF79AC */ return __log1pl(t+__sqrtl(2.0*t+t*t)); } } +strong_alias (__ieee754_acoshl, __acoshl_finite) diff --git a/sysdeps/ieee754/ldbl-96/e_asinl.c b/sysdeps/ieee754/ldbl-96/e_asinl.c index 1cad623..d813039 100644 --- a/sysdeps/ieee754/ldbl-96/e_asinl.c +++ b/sysdeps/ieee754/ldbl-96/e_asinl.c @@ -12,9 +12,9 @@ /* Long double expansions are Copyright (C) 2001 Stephen L. Moshier <moshier@na-net.ornl.gov> - and are incorporated herein by permission of the author. The author + and are incorporated herein by permission of the author. The author reserves the right to distribute this material elsewhere under different - copying permissions. These modifications are distributed here under + copying permissions. These modifications are distributed here under the following terms: This library is free software; you can redistribute it and/or @@ -45,7 +45,7 @@ * = pio2_hi - (2*(s+s*z*R(z)) - pio2_lo) * For x<=0.98, let pio4_hi = pio2_hi/2, then * f = hi part of s; - * c = sqrt(z) - f = (z-f*f)/(s+f) ...f+c=sqrt(z) + * c = sqrt(z) - f = (z-f*f)/(s+f) ...f+c=sqrt(z) * and * asin(x) = pi/2 - 2*(s+s*z*R(z)) * = pio4_hi+(pio4-2s)-(2s*z*R(z)-pio2_lo) @@ -159,3 +159,4 @@ __ieee754_asinl (x) else return -t; } +strong_alias (__ieee754_asinl, __asinl_finite) diff --git a/sysdeps/ieee754/ldbl-96/e_atan2l.c b/sysdeps/ieee754/ldbl-96/e_atan2l.c index 0759458..535d0d6 100644 --- a/sysdeps/ieee754/ldbl-96/e_atan2l.c +++ b/sysdeps/ieee754/ldbl-96/e_atan2l.c @@ -14,15 +14,11 @@ * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - /* __ieee754_atan2l(y,x) * Method : * 1. Reduce y to positive by atan2(y,x)=-atan2(-y,x). * 2. Reduce x to positive by (if x and y are unexceptional): - * ARG (x+iy) = arctan(y/x) ... if x > 0, + * ARG (x+iy) = arctan(y/x) ... if x > 0, * ARG (x+iy) = pi - arctan[y/(-x)] ... if x < 0, * * Special cases: @@ -48,11 +44,7 @@ static char rcsid[] = "$NetBSD: $"; #include "math.h" #include "math_private.h" -#ifdef __STDC__ static const long double -#else -static long double -#endif tiny = 1.0e-4900L, zero = 0.0, pi_o_4 = 7.85398163397448309628202E-01L, /* 0x3FFE, 0xC90FDAA2, 0x2168C235 */ @@ -60,12 +52,8 @@ pi_o_2 = 1.5707963267948966192564E+00L, /* 0x3FFF, 0xC90FDAA2, 0x2168C235 */ pi = 3.14159265358979323851281E+00L, /* 0x4000, 0xC90FDAA2, 0x2168C235 */ pi_lo = -5.01655761266833202345176e-20L;/* 0xBFBE, 0xECE675D1, 0xFC8F8CBB */ -#ifdef __STDC__ - long double __ieee754_atan2l(long double y, long double x) -#else - long double __ieee754_atan2l(y,x) - long double y,x; -#endif +long double +__ieee754_atan2l (long double y, long double x) { long double z; int32_t k,m,hx,hy,ix,iy; @@ -87,7 +75,7 @@ pi_lo = -5.01655761266833202345176e-20L;/* 0xBFBE, 0xECE675D1, 0xFC8F8CBB */ if((iy|ly)==0) { switch(m) { case 0: - case 1: return y; /* atan(+-0,+anything)=+-0 */ + case 1: return y; /* atan(+-0,+anything)=+-0 */ case 2: return pi+tiny;/* atan(+0,-anything) = pi */ case 3: return -pi-tiny;/* atan(-0,-anything) =-pi */ } @@ -118,19 +106,20 @@ pi_lo = -5.01655761266833202345176e-20L;/* 0xBFBE, 0xECE675D1, 0xFC8F8CBB */ /* compute y/x */ k = sy-sx; - if(k > 70) z=pi_o_2+0.5*pi_lo; /* |y/x| > 2**70 */ - else if(sx>=0x8000&&k<-70) z=0.0; /* |y|/x < -2**70 */ + if(k > 70) z=pi_o_2+0.5*pi_lo; /* |y/x| > 2**70 */ + else if(sx>=0x8000&&k<-70) z=0.0; /* |y|/x < -2**70 */ else z=__atanl(fabsl(y/x)); /* safe to do y/x */ switch (m) { case 0: return z ; /* atan(+,+) */ case 1: { - u_int32_t sz; + u_int32_t sz; GET_LDOUBLE_EXP(sz,z); SET_LDOUBLE_EXP(z,sz ^ 0x8000); } return z ; /* atan(-,+) */ case 2: return pi-(z-pi_lo);/* atan(+,-) */ default: /* case 3 */ - return (z-pi_lo)-pi;/* atan(-,-) */ + return (z-pi_lo)-pi;/* atan(-,-) */ } } +strong_alias (__ieee754_atan2l, __atan2l_finite) diff --git a/sysdeps/ieee754/ldbl-96/e_atanhl.c b/sysdeps/ieee754/ldbl-96/e_atanhl.c index fdcd1e9..5a2aebe 100644 --- a/sysdeps/ieee754/ldbl-96/e_atanhl.c +++ b/sysdeps/ieee754/ldbl-96/e_atanhl.c @@ -14,10 +14,6 @@ * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - /* __ieee754_atanhl(x) * Method : * 1.Reduced x to positive by atanh(-x) = -atanh(x) @@ -26,7 +22,7 @@ static char rcsid[] = "$NetBSD: $"; * atanhl(x) = --- * log(1 + -------) = 0.5 * log1p(2 * --------) * 2 1 - x 1 - x * - * For x<0.5 + * For x<0.5 * atanhl(x) = 0.5*log1pl(2x+2x*x/(1-x)) * * Special cases: @@ -39,24 +35,12 @@ static char rcsid[] = "$NetBSD: $"; #include "math.h" #include "math_private.h" -#ifdef __STDC__ static const long double one = 1.0, huge = 1e4900L; -#else -static long double one = 1.0, huge = 1e4900L; -#endif -#ifdef __STDC__ static const long double zero = 0.0; -#else -static double long zero = 0.0; -#endif -#ifdef __STDC__ - long double __ieee754_atanhl(long double x) -#else - long double __ieee754_atanhl(x) - long double x; -#endif +long double +__ieee754_atanhl(long double x) { long double t; int32_t ix; @@ -77,3 +61,4 @@ static double long zero = 0.0; t = 0.5*__log1pl((x+x)/(one-x)); if(se<=0x7fff) return t; else return -t; } +strong_alias (__ieee754_atanhl, __atanhl_finite) diff --git a/sysdeps/ieee754/ldbl-96/e_coshl.c b/sysdeps/ieee754/ldbl-96/e_coshl.c index 8c38fa4..6113f07 100644 --- a/sysdeps/ieee754/ldbl-96/e_coshl.c +++ b/sysdeps/ieee754/ldbl-96/e_coshl.c @@ -18,13 +18,13 @@ static char rcsid[] = "$NetBSD: e_cosh.c,v 1.7 1995/05/10 20:44:58 jtc Exp $"; * mathematically coshl(x) if defined to be (exp(x)+exp(-x))/2 * 1. Replace x by |x| (coshl(x) = coshl(-x)). * 2. - * [ exp(x) - 1 ]^2 + * [ exp(x) - 1 ]^2 * 0 <= x <= ln2/2 : coshl(x) := 1 + ------------------- - * 2*exp(x) + * 2*exp(x) * - * exp(x) + 1/exp(x) + * exp(x) + 1/exp(x) * ln2/2 <= x <= 22 : coshl(x) := ------------------- - * 2 + * 2 * 22 <= x <= lnovft : coshl(x) := expl(x)/2 * lnovft <= x <= ln2ovft: coshl(x) := expl(x/2)/2 * expl(x/2) * ln2ovft < x : coshl(x) := huge*huge (overflow) @@ -37,18 +37,10 @@ static char rcsid[] = "$NetBSD: e_cosh.c,v 1.7 1995/05/10 20:44:58 jtc Exp $"; #include "math.h" #include "math_private.h" -#ifdef __STDC__ static const long double one = 1.0, half=0.5, huge = 1.0e4900L; -#else -static long double one = 1.0, half=0.5, huge = 1.0e4900L; -#endif -#ifdef __STDC__ - long double __ieee754_coshl(long double x) -#else - long double __ieee754_coshl(x) - long double x; -#endif +long double +__ieee754_coshl (long double x) { long double t,w; int32_t ex; @@ -58,19 +50,17 @@ static long double one = 1.0, half=0.5, huge = 1.0e4900L; GET_LDOUBLE_WORDS(ex,mx,lx,x); ex &= 0x7fff; - /* x is INF or NaN */ - if(ex==0x7fff) return x*x; - - /* |x| in [0,0.5*ln2], return 1+expm1l(|x|)^2/(2*expl(|x|)) */ - if(ex < 0x3ffd || (ex == 0x3ffd && mx < 0xb17217f7u)) { - t = __expm1l(fabsl(x)); - w = one+t; - if (ex<0x3fbc) return w; /* cosh(tiny) = 1 */ - return one+(t*t)/(w+w); - } - - /* |x| in [0.5*ln2,22], return (exp(|x|)+1/exp(|x|)/2; */ + /* |x| in [0,22] */ if (ex < 0x4003 || (ex == 0x4003 && mx < 0xb0000000u)) { + /* |x| in [0,0.5*ln2], return 1+expm1l(|x|)^2/(2*expl(|x|)) */ + if(ex < 0x3ffd || (ex == 0x3ffd && mx < 0xb17217f7u)) { + t = __expm1l(fabsl(x)); + w = one+t; + if (ex<0x3fbc) return w; /* cosh(tiny) = 1 */ + return one+(t*t)/(w+w); + } + + /* |x| in [0.5*ln2,22], return (exp(|x|)+1/exp(|x|)/2; */ t = __ieee754_expl(fabsl(x)); return half*t+half/t; } @@ -88,6 +78,10 @@ static long double one = 1.0, half=0.5, huge = 1.0e4900L; return t*w; } + /* x is INF or NaN */ + if(ex==0x7fff) return x*x; + /* |x| >= log(2*maxdouble), cosh(x) overflow */ return huge*huge; } +strong_alias (__ieee754_coshl, __coshl_finite) diff --git a/sysdeps/ieee754/ldbl-96/e_gammal_r.c b/sysdeps/ieee754/ldbl-96/e_gammal_r.c index dd956fe..40c18ea 100644 --- a/sysdeps/ieee754/ldbl-96/e_gammal_r.c +++ b/sysdeps/ieee754/ldbl-96/e_gammal_r.c @@ -1,5 +1,5 @@ /* Implementation of gamma function according to ISO C. - Copyright (C) 1997, 1999, 2001, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 1997,1999,2001,2003,2004,2011 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -32,25 +32,27 @@ __ieee754_gammal_r (long double x, int *signgamp) GET_LDOUBLE_WORDS (es, hx, lx, x); - if (((es & 0x7fff) | hx | lx) == 0) + if (__builtin_expect (((es & 0x7fff) | hx | lx) == 0, 0)) { /* Return value for x == 0 is Inf with divide by zero exception. */ *signgamp = 0; return 1.0 / x; } - if (es == 0xffffffff && ((hx & 0x7fffffff) | lx) == 0) + if (__builtin_expect (es == 0xffffffff && ((hx & 0x7fffffff) | lx) == 0, 0)) { /* x == -Inf. According to ISO this is NaN. */ *signgamp = 0; return x - x; } - if ((es & 0x7fff) == 0x7fff && ((hx & 0x7fffffff) | lx) != 0) + if (__builtin_expect ((es & 0x7fff) == 0x7fff, 0) + && ((hx & 0x7fffffff) | lx) != 0) { /* NaN, return it. */ *signgamp = 0; return x; } - if ((es & 0x8000) != 0 && x < 0xffffffff && __rintl (x) == x) + if (__builtin_expect ((es & 0x8000) != 0, 0) + && x < 0xffffffff && __rintl (x) == x) { /* Return value for integer x < 0 is NaN with invalid exception. */ *signgamp = 0; @@ -60,3 +62,4 @@ __ieee754_gammal_r (long double x, int *signgamp) /* XXX FIXME. */ return __ieee754_expl (__ieee754_lgammal_r (x, signgamp)); } +strong_alias (__ieee754_gammal_r, __gammal_r_finite) diff --git a/sysdeps/ieee754/ldbl-96/e_hypotl.c b/sysdeps/ieee754/ldbl-96/e_hypotl.c index 1a40c55..a59320b 100644 --- a/sysdeps/ieee754/ldbl-96/e_hypotl.c +++ b/sysdeps/ieee754/ldbl-96/e_hypotl.c @@ -14,10 +14,6 @@ * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - /* __ieee754_hypotl(x,y) * * Method : @@ -46,8 +42,8 @@ static char rcsid[] = "$NetBSD: $"; * hypot(x,y) is NAN if x or y is NAN. * * Accuracy: - * hypot(x,y) returns sqrt(x^2+y^2) with error less - * than 1 ulps (units in the last place) + * hypot(x,y) returns sqrt(x^2+y^2) with error less + * than 1 ulps (units in the last place) */ #include "math.h" @@ -72,7 +68,7 @@ static char rcsid[] = "$NetBSD: $"; SET_LDOUBLE_EXP(b,eb); /* b <- |b| */ if((ea-eb)>0x46) {return a+b;} /* x/y > 2**70 */ k=0; - if(ea > 0x5f3f) { /* a>2**8000 */ + if(__builtin_expect(ea > 0x5f3f,0)) { /* a>2**8000 */ if(ea == 0x7fff) { /* Inf or NaN */ u_int32_t exp,high,low; w = a+b; /* for sNaN */ @@ -87,9 +83,9 @@ static char rcsid[] = "$NetBSD: $"; SET_LDOUBLE_EXP(a,ea); SET_LDOUBLE_EXP(b,eb); } - if(eb < 0x20bf) { /* b < 2**-8000 */ + if(__builtin_expect(eb < 0x20bf, 0)) { /* b < 2**-8000 */ if(eb == 0) { /* subnormal b or 0 */ - u_int32_t exp,high,low; + u_int32_t exp,high,low; GET_LDOUBLE_WORDS(exp,high,low,b); if((high|low)==0) return a; SET_LDOUBLE_WORDS(t1, 0x7ffd, 0, 0); /* t1=2^16382 */ @@ -97,7 +93,7 @@ static char rcsid[] = "$NetBSD: $"; a *= t1; k -= 16382; } else { /* scale a and b by 2^9600 */ - ea += 0x2580; /* a *= 2^9600 */ + ea += 0x2580; /* a *= 2^9600 */ eb += 0x2580; /* b *= 2^9600 */ k -= 9600; SET_LDOUBLE_EXP(a,ea); @@ -131,3 +127,4 @@ static char rcsid[] = "$NetBSD: $"; return t1*w; } else return w; } +strong_alias (__ieee754_hypotl, __hypotl_finite) diff --git a/sysdeps/ieee754/ldbl-96/e_j0l.c b/sysdeps/ieee754/ldbl-96/e_j0l.c index 12c906b..ce1f0f7 100644 --- a/sysdeps/ieee754/ldbl-96/e_j0l.c +++ b/sysdeps/ieee754/ldbl-96/e_j0l.c @@ -11,9 +11,9 @@ /* Long double expansions are Copyright (C) 2001 Stephen L. Moshier <moshier@na-net.ornl.gov> - and are incorporated herein by permission of the author. The author + and are incorporated herein by permission of the author. The author reserves the right to distribute this material elsewhere under different - copying permissions. These modifications are distributed here under + copying permissions. These modifications are distributed here under the following terms: This library is free software; you can redistribute it and/or @@ -74,17 +74,9 @@ #include "math.h" #include "math_private.h" -#ifdef __STDC__ static long double pzero (long double), qzero (long double); -#else -static long double pzero (), qzero (); -#endif -#ifdef __STDC__ static const long double -#else -static long double -#endif huge = 1e4930L, one = 1.0L, invsqrtpi = 5.6418958354775628694807945156077258584405e-1L, @@ -109,20 +101,10 @@ static long double /* 1.000000000000000000000000000000000000000E0L,*/ }; -#ifdef __STDC__ static const long double zero = 0.0; -#else -static long double zero = 0.0; -#endif -#ifdef __STDC__ long double __ieee754_j0l (long double x) -#else -long double -__ieee754_j0l (x) - long double x; -#endif { long double z, s, c, ss, cc, r, u, v; int32_t ix; @@ -130,7 +112,7 @@ __ieee754_j0l (x) GET_LDOUBLE_WORDS (se, i0, i1, x); ix = se & 0x7fff; - if (ix >= 0x7fff) + if (__builtin_expect (ix >= 0x7fff, 0)) return one / (x * x); x = fabsl (x); if (ix >= 0x4000) /* |x| >= 2.0 */ @@ -150,7 +132,7 @@ __ieee754_j0l (x) * j0(x) = 1/sqrt(pi) * (P(0,x)*cc - Q(0,x)*ss) / sqrt(x) * y0(x) = 1/sqrt(pi) * (P(0,x)*ss + Q(0,x)*cc) / sqrt(x) */ - if (ix > 0x4080) /* 2^129 */ + if (__builtin_expect (ix > 0x4080, 0)) /* 2^129 */ z = (invsqrtpi * cc) / __ieee754_sqrtl (x); else { @@ -160,7 +142,7 @@ __ieee754_j0l (x) } return z; } - if (ix < 0x3fef) /* |x| < 2**-16 */ + if (__builtin_expect (ix < 0x3fef, 0)) /* |x| < 2**-16 */ { if (huge + x > one) { /* raise inexact if x != 0 */ @@ -183,16 +165,13 @@ __ieee754_j0l (x) return ((one + u) * (one - u) + z * (r / s)); } } +strong_alias (__ieee754_j0l, __j0l_finite) /* y0(x) = 2/pi ln(x) J0(x) + U(x^2)/V(x^2) 0 < x <= 2 peak relative error 1.7e-21 */ -#ifdef __STDC__ static const long double -#else -static long double -#endif U[6] = { -1.054912306975785573710813351985351350861E10L, 2.520192609749295139432773849576523636127E10L, @@ -201,11 +180,7 @@ U[6] = { -3.440684087134286610316661166492641011539E5L, 1.005524356159130626192144663414848383774E3L, }; -#ifdef __STDC__ static const long double -#else -static long double -#endif V[5] = { 1.429337283720789610137291929228082613676E11L, 2.492593075325119157558811370165695013002E9L, @@ -215,14 +190,8 @@ V[5] = { /* 1.000000000000000000000000000000000000000E0L */ }; -#ifdef __STDC__ long double __ieee754_y0l (long double x) -#else -long double -__ieee754_y0l (x) - long double x; -#endif { long double z, s, c, ss, cc, u, v; int32_t ix; @@ -231,11 +200,11 @@ __ieee754_y0l (x) GET_LDOUBLE_WORDS (se, i0, i1, x); ix = se & 0x7fff; /* Y0(NaN) is NaN, y0(-inf) is Nan, y0(inf) is 0 */ - if (se & 0x8000) + if (__builtin_expect (se & 0x8000, 0)) return zero / (zero * x); - if (ix >= 0x7fff) + if (__builtin_expect (ix >= 0x7fff, 0)) return one / (x + x * x); - if ((i0 | i1) == 0) + if (__builtin_expect ((i0 | i1) == 0, 0)) return -HUGE_VALL + x; /* -inf and overflow exception. */ if (ix >= 0x4000) { /* |x| >= 2.0 */ @@ -266,7 +235,7 @@ __ieee754_y0l (x) else ss = z / cc; } - if (ix > 0x4080) /* 1e39 */ + if (__builtin_expect (ix > 0x4080, 0)) /* 1e39 */ z = (invsqrtpi * ss) / __ieee754_sqrtl (x); else { @@ -276,7 +245,7 @@ __ieee754_y0l (x) } return z; } - if (ix <= 0x3fde) /* x < 2^-33 */ + if (__builtin_expect (ix <= 0x3fde, 0)) /* x < 2^-33 */ { z = -7.380429510868722527629822444004602747322E-2L + tpi * __ieee754_logl (x); @@ -287,17 +256,14 @@ __ieee754_y0l (x) v = V[0] + z * (V[1] + z * (V[2] + z * (V[3] + z * (V[4] + z)))); return (u / v + tpi * (__ieee754_j0l (x) * __ieee754_logl (x))); } +strong_alias (__ieee754_y0l, __y0l_finite) /* The asymptotic expansions of pzero is * 1 - 9/128 s^2 + 11025/98304 s^4 - ..., where s = 1/x. * For x >= 2, We approximate pzero by * pzero(x) = 1 + s^2 R(s^2) / S(s^2) */ -#ifdef __STDC__ static const long double pR8[7] = { -#else -static long double pR8[7] = { -#endif /* 8 <= x <= inf Peak relative error 4.62 */ -4.094398895124198016684337960227780260127E-9L, @@ -308,11 +274,7 @@ static long double pR8[7] = { -5.827178869301452892963280214772398135283E-2L, -2.087563267939546435460286895807046616992E-2L, }; -#ifdef __STDC__ static const long double pS8[6] = { -#else -static long double pS8[6] = { -#endif 5.823145095287749230197031108839653988393E-8L, 1.279281986035060320477759999428992730280E-5L, 9.132668954726626677174825517150228961304E-4L, @@ -322,11 +284,7 @@ static long double pS8[6] = { /* 1.000000000000000000000000000000000000000E0L, */ }; -#ifdef __STDC__ static const long double pR5[7] = { -#else -static long double pR5[7] = { -#endif /* 4.54541015625 <= x <= 8 Peak relative error 6.51E-22 */ -2.041226787870240954326915847282179737987E-7L, @@ -337,11 +295,7 @@ static long double pR5[7] = { -8.641175552716402616180994954177818461588E-2L, -1.354654710097134007437166939230619726157E-2L, }; -#ifdef __STDC__ static const long double pS5[6] = { -#else -static long double pS5[6] = { -#endif 2.903078099681108697057258628212823545290E-6L, 3.253948449946735405975737677123673867321E-4L, 1.181269751723085006534147920481582279979E-2L, @@ -351,11 +305,7 @@ static long double pS5[6] = { /* 1.000000000000000000000000000000000000000E0L, */ }; -#ifdef __STDC__ static const long double pR3[7] = { -#else -static long double pR3[7] = { -#endif /* 2.85711669921875 <= x <= 4.54541015625 peak relative error 5.25e-21 */ -5.755732156848468345557663552240816066802E-6L, @@ -366,11 +316,7 @@ static long double pR3[7] = { -1.193350853469302941921647487062620011042E-1L, -8.567802507331578894302991505331963782905E-3L, }; -#ifdef __STDC__ static const long double pS3[6] = { -#else -static long double pS3[6] = { -#endif 8.185931139070086158103309281525036712419E-5L, 5.398016943778891093520574483111255476787E-3L, 1.130589193590489566669164765853409621081E-1L, @@ -380,11 +326,7 @@ static long double pS3[6] = { /* 1.000000000000000000000000000000000000000E0L, */ }; -#ifdef __STDC__ static const long double pR2[7] = { -#else -static long double pR2[7] = { -#endif /* 2 <= x <= 2.85711669921875 peak relative error 2.64e-21 */ -1.219525235804532014243621104365384992623E-4L, @@ -395,11 +337,7 @@ static long double pR2[7] = { -1.556241316844728872406672349347137975495E-1L, -5.355423239526452209595316733635519506958E-3L, }; -#ifdef __STDC__ static const long double pS2[6] = { -#else -static long double pS2[6] = { -#endif 1.734442793664291412489066256138894953823E-3L, 7.158111826468626405416300895617986926008E-2L, 9.153839713992138340197264669867993552641E-1L, @@ -409,20 +347,10 @@ static long double pS2[6] = { /* 1.000000000000000000000000000000000000000E0L, */ }; -#ifdef __STDC__ static long double pzero (long double x) -#else -static long double -pzero (x) - long double x; -#endif { -#ifdef __STDC__ const long double *p, *q; -#else - long double *p, *q; -#endif long double z, r, s; int32_t ix; u_int32_t se, i0, i1; @@ -468,11 +396,7 @@ pzero (x) * We approximate qzero by * qzero(x) = s*(-.125 + R(s^2) / S(s^2)) */ -#ifdef __STDC__ static const long double qR8[7] = { -#else -static long double qR8[7] = { -#endif /* 8 <= x <= inf peak relative error 2.23e-21 */ 3.001267180483191397885272640777189348008E-10L, @@ -483,11 +407,7 @@ static long double qR8[7] = { 3.881970028476167836382607922840452192636E-2L, 6.132191514516237371140841765561219149638E-2L, }; -#ifdef __STDC__ static const long double qS8[7] = { -#else -static long double qS8[7] = { -#endif 4.097730123753051126914971174076227600212E-9L, 1.199615869122646109596153392152131139306E-6L, 1.196337580514532207793107149088168946451E-4L, @@ -498,11 +418,7 @@ static long double qS8[7] = { /* 1.000000000000000000000000000000000000000E0L, */ }; -#ifdef __STDC__ static const long double qR5[7] = { -#else -static long double qR5[7] = { -#endif /* 4.54541015625 <= x <= 8 peak relative error 1.03e-21 */ 3.406256556438974327309660241748106352137E-8L, @@ -513,11 +429,7 @@ static long double qR5[7] = { 1.071578819056574524416060138514508609805E-1L, 7.458950172851611673015774675225656063757E-2L, }; -#ifdef __STDC__ static const long double qS5[7] = { -#else -static long double qS5[7] = { -#endif 4.650675622764245276538207123618745150785E-7L, 6.773573292521412265840260065635377164455E-5L, 3.340711249876192721980146877577806687714E-3L, @@ -528,11 +440,7 @@ static long double qS5[7] = { /* 1.000000000000000000000000000000000000000E0L,*/ }; -#ifdef __STDC__ static const long double qR3[7] = { -#else -static long double qR3[7] = { -#endif /* 2.85711669921875 <= x <= 4.54541015625 peak relative error 5.24e-21 */ 1.749459596550816915639829017724249805242E-6L, @@ -543,11 +451,7 @@ static long double qR3[7] = { 2.538595333972857367655146949093055405072E-1L, 8.560591367256769038905328596020118877936E-2L, }; -#ifdef __STDC__ static const long double qS3[7] = { -#else -static long double qS3[7] = { -#endif 2.388596091707517488372313710647510488042E-5L, 2.048679968058758616370095132104333998147E-3L, 5.824663198201417760864458765259945181513E-2L, @@ -558,11 +462,7 @@ static long double qS3[7] = { /* 1.000000000000000000000000000000000000000E0L, */ }; -#ifdef __STDC__ static const long double qR2[7] = { -#else -static long double qR2[7] = { -#endif /* 2 <= x <= 2.85711669921875 peak relative error 1.58e-21 */ 6.306524405520048545426928892276696949540E-5L, @@ -573,11 +473,7 @@ static long double qR2[7] = { 5.431871999743531634887107835372232030655E-1L, 9.447736151202905471899259026430157211949E-2L, }; -#ifdef __STDC__ static const long double qS2[7] = { -#else -static long double qS2[7] = { -#endif 8.610579901936193494609755345106129102676E-4L, 4.649054352710496997203474853066665869047E-2L, 8.104282924459837407218042945106320388339E-1L, @@ -588,20 +484,10 @@ static long double qS2[7] = { /* 1.000000000000000000000000000000000000000E0L, */ }; -#ifdef __STDC__ static long double qzero (long double x) -#else -static long double -qzero (x) - long double x; -#endif { -#ifdef __STDC__ const long double *p, *q; -#else - long double *p, *q; -#endif long double s, r, z; int32_t ix; u_int32_t se, i0, i1; diff --git a/sysdeps/ieee754/ldbl-96/e_j1l.c b/sysdeps/ieee754/ldbl-96/e_j1l.c index 62a8ce0c..369fd83 100644 --- a/sysdeps/ieee754/ldbl-96/e_j1l.c +++ b/sysdeps/ieee754/ldbl-96/e_j1l.c @@ -11,9 +11,9 @@ /* Long double expansions are Copyright (C) 2001 Stephen L. Moshier <moshier@na-net.ornl.gov> - and are incorporated herein by permission of the author. The author + and are incorporated herein by permission of the author. The author reserves the right to distribute this material elsewhere under different - copying permissions. These modifications are distributed here under + copying permissions. These modifications are distributed here under the following terms: This library is free software; you can redistribute it and/or @@ -38,17 +38,17 @@ * for x in (0,2) * j1(x) = x/2 + x*z*R0/S0, where z = x*x; * for x in (2,inf) - * j1(x) = sqrt(2/(pi*x))*(p1(x)*cos(x1)-q1(x)*sin(x1)) - * y1(x) = sqrt(2/(pi*x))*(p1(x)*sin(x1)+q1(x)*cos(x1)) - * where x1 = x-3*pi/4. It is better to compute sin(x1),cos(x1) + * j1(x) = sqrt(2/(pi*x))*(p1(x)*cos(x1)-q1(x)*sin(x1)) + * y1(x) = sqrt(2/(pi*x))*(p1(x)*sin(x1)+q1(x)*cos(x1)) + * where x1 = x-3*pi/4. It is better to compute sin(x1),cos(x1) * as follow: * cos(x1) = cos(x)cos(3pi/4)+sin(x)sin(3pi/4) * = 1/sqrt(2) * (sin(x) - cos(x)) * sin(x1) = sin(x)cos(3pi/4)-cos(x)sin(3pi/4) * = -1/sqrt(2) * (sin(x) + cos(x)) - * (To avoid cancellation, use + * (To avoid cancellation, use * sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x)) - * to compute the worse one.) + * to compute the worse one.) * * 3 Special cases * j1(nan)= nan @@ -66,25 +66,17 @@ * Note: For tiny x, 1/x dominate y1 and hence * y1(tiny) = -2/pi/tiny * 3. For x>=2. - * y1(x) = sqrt(2/(pi*x))*(p1(x)*sin(x1)+q1(x)*cos(x1)) - * where x1 = x-3*pi/4. It is better to compute sin(x1),cos(x1) + * y1(x) = sqrt(2/(pi*x))*(p1(x)*sin(x1)+q1(x)*cos(x1)) + * where x1 = x-3*pi/4. It is better to compute sin(x1),cos(x1) * by method mentioned above. */ #include "math.h" #include "math_private.h" -#ifdef __STDC__ static long double pone (long double), qone (long double); -#else -static long double pone (), qone (); -#endif -#ifdef __STDC__ static const long double -#else -static long double -#endif huge = 1e4930L, one = 1.0L, invsqrtpi = 5.6418958354775628694807945156077258584405e-1L, @@ -110,21 +102,11 @@ R[5] = { /* 1.000000000000000000000000000000000000000E0L, */ }; -#ifdef __STDC__ static const long double zero = 0.0; -#else -static long double zero = 0.0; -#endif -#ifdef __STDC__ long double __ieee754_j1l (long double x) -#else -long double -__ieee754_j1l (x) - long double x; -#endif { long double z, c, r, s, ss, cc, u, v, y; int32_t ix; @@ -132,7 +114,7 @@ __ieee754_j1l (x) GET_LDOUBLE_WORDS (se, i0, i1, x); ix = se & 0x7fff; - if (ix >= 0x7fff) + if (__builtin_expect (ix >= 0x7fff, 0)) return one / x; y = fabsl (x); if (ix >= 0x4000) @@ -152,7 +134,7 @@ __ieee754_j1l (x) * j1(x) = 1/sqrt(pi) * (P(1,x)*cc - Q(1,x)*ss) / sqrt(x) * y1(x) = 1/sqrt(pi) * (P(1,x)*ss + Q(1,x)*cc) / sqrt(x) */ - if (ix > 0x4080) + if (__builtin_expect (ix > 0x4080, 0)) z = (invsqrtpi * cc) / __ieee754_sqrtl (y); else { @@ -165,7 +147,7 @@ __ieee754_j1l (x) else return z; } - if (ix < 0x3fde) /* |x| < 2^-33 */ + if (__builtin_expect (ix < 0x3fde, 0)) /* |x| < 2^-33 */ { if (huge + x > one) return 0.5 * x; /* inexact if x!=0 necessary */ @@ -176,16 +158,13 @@ __ieee754_j1l (x) r *= x; return (x * 0.5 + r / s); } +strong_alias (__ieee754_j1l, __j1l_finite) /* Y1(x) = 2/pi * (log(x) * j1(x) - 1/x) + x R(x^2) 0 <= x <= 2 Peak relative error 2.3e-23 */ -#ifdef __STDC__ static const long double U0[6] = { -#else -static long double U0[6] = { -#endif -5.908077186259914699178903164682444848615E10L, 1.546219327181478013495975514375773435962E10L, -6.438303331169223128870035584107053228235E8L, @@ -193,11 +172,7 @@ static long double U0[6] = { -6.138043997084355564619377183564196265471E4L, 1.418503228220927321096904291501161800215E2L, }; -#ifdef __STDC__ static const long double V0[5] = { -#else -static long double V0[5] = { -#endif 3.013447341682896694781964795373783679861E11L, 4.669546565705981649470005402243136124523E9L, 3.595056091631351184676890179233695857260E7L, @@ -207,14 +182,8 @@ static long double V0[5] = { }; -#ifdef __STDC__ long double __ieee754_y1l (long double x) -#else -long double -__ieee754_y1l (x) - long double x; -#endif { long double z, s, c, ss, cc, u, v; int32_t ix; @@ -223,11 +192,11 @@ __ieee754_y1l (x) GET_LDOUBLE_WORDS (se, i0, i1, x); ix = se & 0x7fff; /* if Y1(NaN) is NaN, Y1(-inf) is NaN, Y1(inf) is 0 */ - if (se & 0x8000) + if (__builtin_expect (se & 0x8000, 0)) return zero / (zero * x); - if (ix >= 0x7fff) + if (__builtin_expect (ix >= 0x7fff, 0)) return one / (x + x * x); - if ((i0 | i1) == 0) + if (__builtin_expect ((i0 | i1) == 0, 0)) return -HUGE_VALL + x; /* -inf and overflow exception. */ if (ix >= 0x4000) { /* |x| >= 2.0 */ @@ -253,7 +222,7 @@ __ieee754_y1l (x) * sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x)) * to compute the worse one. */ - if (ix > 0x4080) + if (__builtin_expect (ix > 0x4080, 0)) z = (invsqrtpi * ss) / __ieee754_sqrtl (x); else { @@ -263,7 +232,7 @@ __ieee754_y1l (x) } return z; } - if (ix <= 0x3fbe) + if (__builtin_expect (ix <= 0x3fbe, 0)) { /* x < 2**-65 */ return (-tpi / x); } @@ -273,12 +242,13 @@ __ieee754_y1l (x) return (x * (u / v) + tpi * (__ieee754_j1l (x) * __ieee754_logl (x) - one / x)); } +strong_alias (__ieee754_y1l, __y1l_finite) /* For x >= 8, the asymptotic expansions of pone is * 1 + 15/128 s^2 - 4725/2^15 s^4 - ..., where s = 1/x. * We approximate pone by - * pone(x) = 1 + (R/S) + * pone(x) = 1 + (R/S) */ /* J1(x) cosX + Y1(x) sinX = sqrt( 2/(pi x)) P1(x) @@ -286,11 +256,7 @@ __ieee754_y1l (x) 8 <= x <= inf (0 <= z <= 0.125) Peak relative error 5.2e-22 */ -#ifdef __STDC__ static const long double pr8[7] = { -#else -static long double pr8[7] = { -#endif 8.402048819032978959298664869941375143163E-9L, 1.813743245316438056192649247507255996036E-6L, 1.260704554112906152344932388588243836276E-4L, @@ -299,11 +265,7 @@ static long double pr8[7] = { 1.131111483254318243139953003461511308672E-1L, 4.480715825681029711521286449131671880953E-2L, }; -#ifdef __STDC__ static const long double ps8[6] = { -#else -static long double ps8[6] = { -#endif 7.169748325574809484893888315707824924354E-8L, 1.556549720596672576431813934184403614817E-5L, 1.094540125521337139209062035774174565882E-3L, @@ -317,11 +279,7 @@ static long double ps8[6] = { P1(x) = 1 + z^2 R(z^2), z=1/x 4.54541015625 <= x <= 8 Peak relative error 7.7e-22 */ -#ifdef __STDC__ static const long double pr5[7] = { -#else -static long double pr5[7] = { -#endif 4.318486887948814529950980396300969247900E-7L, 4.715341880798817230333360497524173929315E-5L, 1.642719430496086618401091544113220340094E-3L, @@ -330,11 +288,7 @@ static long double pr5[7] = { 1.755576530055079253910829652698703791957E-1L, 3.218803858282095929559165965353784980613E-2L, }; -#ifdef __STDC__ static const long double ps5[6] = { -#else -static long double ps5[6] = { -#endif 3.685108812227721334719884358034713967557E-6L, 4.069102509511177498808856515005792027639E-4L, 1.449728676496155025507893322405597039816E-2L, @@ -348,11 +302,7 @@ static long double ps5[6] = { P1(x) = 1 + z^2 R(z^2), z=1/x 2.85711669921875 <= x <= 4.54541015625 Peak relative error 6.5e-21 */ -#ifdef __STDC__ static const long double pr3[7] = { -#else -static long double pr3[7] = { -#endif 1.265251153957366716825382654273326407972E-5L, 8.031057269201324914127680782288352574567E-4L, 1.581648121115028333661412169396282881035E-2L, @@ -361,11 +311,7 @@ static long double pr3[7] = { 2.559223765418386621748404398017602935764E-1L, 2.277136933287817911091370397134882441046E-2L, }; -#ifdef __STDC__ static const long double ps3[6] = { -#else -static long double ps3[6] = { -#endif 1.079681071833391818661952793568345057548E-4L, 6.986017817100477138417481463810841529026E-3L, 1.429403701146942509913198539100230540503E-1L, @@ -379,11 +325,7 @@ static long double ps3[6] = { P1(x) = 1 + z^2 R(z^2), z=1/x 2 <= x <= 2.85711669921875 Peak relative error 3.5e-21 */ -#ifdef __STDC__ static const long double pr2[7] = { -#else -static long double pr2[7] = { -#endif 2.795623248568412225239401141338714516445E-4L, 1.092578168441856711925254839815430061135E-2L, 1.278024620468953761154963591853679640560E-1L, @@ -392,11 +334,7 @@ static long double pr2[7] = { 3.544176317308370086415403567097130611468E-1L, 1.604142674802373041247957048801599740644E-2L, }; -#ifdef __STDC__ static const long double ps2[6] = { -#else -static long double ps2[6] = { -#endif 2.385605161555183386205027000675875235980E-3L, 9.616778294482695283928617708206967248579E-2L, 1.195215570959693572089824415393951258510E0L, @@ -407,20 +345,10 @@ static long double ps2[6] = { }; -#ifdef __STDC__ static long double pone (long double x) -#else -static long double -pone (x) - long double x; -#endif { -#ifdef __STDC__ const long double *p, *q; -#else - long double *p, *q; -#endif long double z, r, s; int32_t ix; u_int32_t se, i0, i1; @@ -462,7 +390,7 @@ pone (x) /* For x >= 8, the asymptotic expansions of qone is * 3/8 s - 105/1024 s^3 - ..., where s = 1/x. * We approximate pone by - * qone(x) = s*(0.375 + (R/S)) + * qone(x) = s*(0.375 + (R/S)) */ /* Y1(x)cosX - J1(x)sinX = sqrt( 2/(pi x)) Q1(x), @@ -470,11 +398,7 @@ pone (x) 8 <= x <= inf Peak relative error 8.3e-22 */ -#ifdef __STDC__ static const long double qr8[7] = { -#else -static long double qr8[7] = { -#endif -5.691925079044209246015366919809404457380E-10L, -1.632587664706999307871963065396218379137E-7L, -1.577424682764651970003637263552027114600E-5L, @@ -483,11 +407,7 @@ static long double qr8[7] = { -6.854943629378084419631926076882330494217E-2L, -1.055448290469180032312893377152490183203E-1L, }; -#ifdef __STDC__ static const long double qs8[7] = { -#else -static long double qs8[7] = { -#endif 5.550982172325019811119223916998393907513E-9L, 1.607188366646736068460131091130644192244E-6L, 1.580792530091386496626494138334505893599E-4L, @@ -502,11 +422,7 @@ static long double qs8[7] = { Q1(x) = z(.375 + z^2 R(z^2)), z=1/x 4.54541015625 <= x <= 8 Peak relative error 4.1e-22 */ -#ifdef __STDC__ static const long double qr5[7] = { -#else -static long double qr5[7] = { -#endif -6.719134139179190546324213696633564965983E-8L, -9.467871458774950479909851595678622044140E-6L, -4.429341875348286176950914275723051452838E-4L, @@ -515,11 +431,7 @@ static long double qr5[7] = { -1.964432669771684034858848142418228214855E-1L, -1.333896496989238600119596538299938520726E-1L, }; -#ifdef __STDC__ static const long double qs5[7] = { -#else -static long double qs5[7] = { -#endif 6.552755584474634766937589285426911075101E-7L, 9.410814032118155978663509073200494000589E-5L, 4.561677087286518359461609153655021253238E-3L, @@ -534,11 +446,7 @@ static long double qs5[7] = { Q1(x) = z(.375 + z^2 R(z^2)), z=1/x 2.85711669921875 <= x <= 4.54541015625 Peak relative error 2.2e-21 */ -#ifdef __STDC__ static const long double qr3[7] = { -#else -static long double qr3[7] = { -#endif -3.618746299358445926506719188614570588404E-6L, -2.951146018465419674063882650970344502798E-4L, -7.728518171262562194043409753656506795258E-3L, @@ -547,11 +455,7 @@ static long double qr3[7] = { -4.858192581793118040782557808823460276452E-1L, -1.592399251246473643510898335746432479373E-1L, }; -#ifdef __STDC__ static const long double qs3[7] = { -#else -static long double qs3[7] = { -#endif 3.529139957987837084554591421329876744262E-5L, 2.973602667215766676998703687065066180115E-3L, 8.273534546240864308494062287908662592100E-2L, @@ -566,11 +470,7 @@ static long double qs3[7] = { Q1(x) = z(.375 + z^2 R(z^2)), z=1/x 2 <= x <= 2.85711669921875 Peak relative error 6.9e-22 */ -#ifdef __STDC__ static const long double qr2[7] = { -#else -static long double qr2[7] = { -#endif -1.372751603025230017220666013816502528318E-4L, -6.879190253347766576229143006767218972834E-3L, -1.061253572090925414598304855316280077828E-1L, @@ -579,11 +479,7 @@ static long double qr2[7] = { -1.087955310491078933531734062917489870754E0L, -1.826821119773182847861406108689273719137E-1L, }; -#ifdef __STDC__ static const long double qs2[7] = { -#else -static long double qs2[7] = { -#endif 1.338768933634451601814048220627185324007E-3L, 7.071099998918497559736318523932241901810E-2L, 1.200511429784048632105295629933382142221E0L, @@ -595,20 +491,10 @@ static long double qs2[7] = { }; -#ifdef __STDC__ static long double qone (long double x) -#else -static long double -qone (x) - long double x; -#endif { -#ifdef __STDC__ const long double *p, *q; -#else - long double *p, *q; -#endif static long double s, r, z; int32_t ix; u_int32_t se, i0, i1; diff --git a/sysdeps/ieee754/ldbl-96/e_jnl.c b/sysdeps/ieee754/ldbl-96/e_jnl.c index bedff7d..3a70e10 100644 --- a/sysdeps/ieee754/ldbl-96/e_jnl.c +++ b/sysdeps/ieee754/ldbl-96/e_jnl.c @@ -11,9 +11,9 @@ /* Modifications for long double are Copyright (C) 2001 Stephen L. Moshier <moshier@na-net.ornl.gov> - and are incorporated herein by permission of the author. The author + and are incorporated herein by permission of the author. The author reserves the right to distribute this material elsewhere under different - copying permissions. These modifications are distributed here under + copying permissions. These modifications are distributed here under the following terms: This library is free software; you can redistribute it and/or @@ -59,28 +59,13 @@ #include "math.h" #include "math_private.h" -#ifdef __STDC__ static const long double -#else -static long double -#endif invsqrtpi = 5.64189583547756286948079e-1L, two = 2.0e0L, one = 1.0e0L; -#ifdef __STDC__ static const long double zero = 0.0L; -#else -static long double zero = 0.0L; -#endif -#ifdef __STDC__ long double __ieee754_jnl (int n, long double x) -#else -long double -__ieee754_jnl (n, x) - int n; - long double x; -#endif { u_int32_t se, i0, i1; int32_t i, ix, sgn; @@ -95,7 +80,7 @@ __ieee754_jnl (n, x) ix = se & 0x7fff; /* if J(n,NaN) is NaN */ - if ((ix == 0x7fff) && ((i0 & 0x7fffffff) != 0)) + if (__builtin_expect ((ix == 0x7fff) && ((i0 & 0x7fffffff) != 0), 0)) return x + x; if (n < 0) { @@ -109,7 +94,8 @@ __ieee754_jnl (n, x) return (__ieee754_j1l (x)); sgn = (n & 1) & (se >> 15); /* even n -- 0, odd n -- sign(x) */ x = fabsl (x); - if ((ix | i0 | i1) == 0 || ix >= 0x7fff) /* if x is 0 or inf */ + if (__builtin_expect ((ix | i0 | i1) == 0 || ix >= 0x7fff, 0)) + /* if x is 0 or inf */ b = zero; else if ((long double) n <= x) { @@ -298,16 +284,10 @@ __ieee754_jnl (n, x) else return b; } +strong_alias (__ieee754_jnl, __jnl_finite) -#ifdef __STDC__ long double __ieee754_ynl (int n, long double x) -#else -long double -__ieee754_ynl (n, x) - int n; - long double x; -#endif { u_int32_t se, i0, i1; int32_t i, ix; @@ -318,11 +298,11 @@ __ieee754_ynl (n, x) GET_LDOUBLE_WORDS (se, i0, i1, x); ix = se & 0x7fff; /* if Y(n,NaN) is NaN */ - if ((ix == 0x7fff) && ((i0 & 0x7fffffff) != 0)) + if (__builtin_expect ((ix == 0x7fff) && ((i0 & 0x7fffffff) != 0), 0)) return x + x; - if ((ix | i0 | i1) == 0) + if (__builtin_expect ((ix | i0 | i1) == 0, 0)) return -HUGE_VALL + x; /* -inf and overflow exception. */ - if (se & 0x8000) + if (__builtin_expect (se & 0x8000, 0)) return zero / (zero * x); sign = 1; if (n < 0) @@ -334,7 +314,7 @@ __ieee754_ynl (n, x) return (__ieee754_y0l (x)); if (n == 1) return (sign * __ieee754_y1l (x)); - if (ix == 0x7fff) + if (__builtin_expect (ix == 0x7fff, 0)) return zero; if (ix >= 0x412D) { /* x > 2**302 */ @@ -393,3 +373,4 @@ __ieee754_ynl (n, x) else return -b; } +strong_alias (__ieee754_ynl, __ynl_finite) diff --git a/sysdeps/ieee754/ldbl-96/e_lgammal_r.c b/sysdeps/ieee754/ldbl-96/e_lgammal_r.c index 36e3365..8a20e5e 100644 --- a/sysdeps/ieee754/ldbl-96/e_lgammal_r.c +++ b/sysdeps/ieee754/ldbl-96/e_lgammal_r.c @@ -94,11 +94,7 @@ #include "math.h" #include "math_private.h" -#ifdef __STDC__ static const long double -#else -static long double -#endif half = 0.5L, one = 1.0L, pi = 3.14159265358979323846264L, @@ -204,20 +200,10 @@ static long double w6 = -1.880801938119376907179E-3L, w7 = 4.885026142432270781165E-3L; -#ifdef __STDC__ static const long double zero = 0.0L; -#else -static long double zero = 0.0L; -#endif -#ifdef __STDC__ static long double sin_pi (long double x) -#else -static long double -sin_pi (x) - long double x; -#endif { long double y, z; int n, ix; @@ -283,15 +269,8 @@ sin_pi (x) } -#ifdef __STDC__ long double __ieee754_lgammal_r (long double x, int *signgamp) -#else -long double -__ieee754_lgammal_r (x, signgamp) - long double x; - int *signgamp; -#endif { long double t, y, z, nadj, p, p1, p2, q, r, w; int i, ix; @@ -301,7 +280,7 @@ __ieee754_lgammal_r (x, signgamp) GET_LDOUBLE_WORDS (se, i0, i1, x); ix = se & 0x7fff; - if ((ix | i0 | i1) == 0) + if (__builtin_expect((ix | i0 | i1) == 0, 0)) { if (se & 0x8000) *signgamp = -1; @@ -311,10 +290,10 @@ __ieee754_lgammal_r (x, signgamp) ix = (ix << 16) | (i0 >> 16); /* purge off +-inf, NaN, +-0, and negative arguments */ - if (ix >= 0x7fff0000) + if (__builtin_expect(ix >= 0x7fff0000, 0)) return x * x; - if (ix < 0x3fc08000) /* 2^-63 */ + if (__builtin_expect(ix < 0x3fc08000, 0)) /* 2^-63 */ { /* |x|<2**-63, return -log(|x|) */ if (se & 0x8000) { @@ -438,7 +417,7 @@ __ieee754_lgammal_r (x, signgamp) z = one / x; y = z * z; w = w0 + z * (w1 - + y * (w2 + y * (w3 + y * (w4 + y * (w5 + y * (w6 + y * w7)))))); + + y * (w2 + y * (w3 + y * (w4 + y * (w5 + y * (w6 + y * w7)))))); r = (x - half) * (t - one) + w; } else @@ -448,3 +427,4 @@ __ieee754_lgammal_r (x, signgamp) r = nadj - r; return r; } +strong_alias (__ieee754_lgammal_r, __lgammal_r_finite) diff --git a/sysdeps/ieee754/ldbl-96/e_remainderl.c b/sysdeps/ieee754/ldbl-96/e_remainderl.c index e721a6e..41c4c7b 100644 --- a/sysdeps/ieee754/ldbl-96/e_remainderl.c +++ b/sysdeps/ieee754/ldbl-96/e_remainderl.c @@ -14,14 +14,10 @@ * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - /* __ieee754_remainderl(x,p) * Return : - * returns x REM p = x - [x/p]*p as if in infinite - * precise arithmetic, where [x/p] is the (infinite bit) + * returns x REM p = x - [x/p]*p as if in infinite + * precise arithmetic, where [x/p] is the (infinite bit) * integer nearest x/p (in half way case choose the even one). * Method : * Based on fmod() return x-[x/p]chopped*p exactlp. @@ -30,19 +26,11 @@ static char rcsid[] = "$NetBSD: $"; #include "math.h" #include "math_private.h" -#ifdef __STDC__ static const long double zero = 0.0; -#else -static long double zero = 0.0; -#endif -#ifdef __STDC__ - long double __ieee754_remainderl(long double x, long double p) -#else - long double __ieee754_remainderl(x,p) - long double x,p; -#endif +long double +__ieee754_remainderl(long double x, long double p) { u_int32_t sx,sex,sep,x0,x1,p0,p1; long double p_half; @@ -54,7 +42,7 @@ static long double zero = 0.0; sex &= 0x7fff; /* purge off exception values */ - if((sep|p0|p1)==0) return (x*p)/(x*p); /* p = 0 */ + if((sep|p0|p1)==0) return (x*p)/(x*p); /* p = 0 */ if((sex==0x7fff)|| /* x not finite */ ((sep==0x7fff)&& /* p is NaN */ ((p0|p1)!=0))) @@ -81,3 +69,4 @@ static long double zero = 0.0; SET_LDOUBLE_EXP(x,sex^sx); return x; } +strong_alias (__ieee754_remainderl, __remainderl_finite) diff --git a/sysdeps/ieee754/ldbl-96/e_sinhl.c b/sysdeps/ieee754/ldbl-96/e_sinhl.c index 646d4fd..8593272 100644 --- a/sysdeps/ieee754/ldbl-96/e_sinhl.c +++ b/sysdeps/ieee754/ldbl-96/e_sinhl.c @@ -23,9 +23,9 @@ static char rcsid[] = "$NetBSD: $"; * mathematically sinh(x) if defined to be (exp(x)-exp(-x))/2 * 1. Replace x by |x| (sinhl(-x) = -sinhl(x)). * 2. - * E + E/(E+1) + * E + E/(E+1) * 0 <= x <= 25 : sinhl(x) := --------------, E=expm1l(x) - * 2 + * 2 * * 25 <= x <= lnovft : sinhl(x) := expl(x)/2 * lnovft <= x <= ln2ovft: sinhl(x) := expl(x/2)/2 * expl(x/2) @@ -39,18 +39,10 @@ static char rcsid[] = "$NetBSD: $"; #include "math.h" #include "math_private.h" -#ifdef __STDC__ static const long double one = 1.0, shuge = 1.0e4931L; -#else -static long double one = 1.0, shuge = 1.0e4931L; -#endif -#ifdef __STDC__ - long double __ieee754_sinhl(long double x) -#else - long double __ieee754_sinhl(x) - long double x; -#endif +long double +__ieee754_sinhl(long double x) { long double t,w,h; u_int32_t jx,ix,i0,i1; @@ -60,13 +52,13 @@ static long double one = 1.0, shuge = 1.0e4931L; ix = jx&0x7fff; /* x is INF or NaN */ - if(ix==0x7fff) return x+x; + if(__builtin_expect(ix==0x7fff, 0)) return x+x; h = 0.5; if (jx & 0x8000) h = -h; /* |x| in [0,25], return sign(x)*0.5*(E+E/(E+1))) */ if (ix < 0x4003 || (ix == 0x4003 && i0 <= 0xc8000000)) { /* |x|<25 */ - if (ix<0x3fdf) /* |x|<2**-32 */ + if (ix<0x3fdf) /* |x|<2**-32 */ if(shuge+x>one) return x;/* sinh(tiny) = tiny with inexact */ t = __expm1l(fabsl(x)); if(ix<0x3fff) return h*(2.0*t-t*t/(t+one)); @@ -89,3 +81,4 @@ static long double one = 1.0, shuge = 1.0e4931L; /* |x| > overflowthreshold, sinhl(x) overflow */ return x*shuge; } +strong_alias (__ieee754_sinhl, __sinhl_finite) diff --git a/sysdeps/ieee754/ldbl-96/s_asinhl.c b/sysdeps/ieee754/ldbl-96/s_asinhl.c index 6eb434c..9f37d48 100644 --- a/sysdeps/ieee754/ldbl-96/s_asinhl.c +++ b/sysdeps/ieee754/ldbl-96/s_asinhl.c @@ -52,19 +52,21 @@ huge= 1.000000000000000000e+4900L; int32_t hx,ix; GET_LDOUBLE_EXP(hx,x); ix = hx&0x7fff; - if(ix==0x7fff) return x+x; /* x is inf or NaN */ - if(ix< 0x3fde) { /* |x|<2**-34 */ + if(__builtin_expect(ix< 0x3fde, 0)) { /* |x|<2**-34 */ if(huge+x>one) return x; /* return x inexact except 0 */ } - if(ix>0x4020) { /* |x| > 2**34 */ + if(__builtin_expect(ix>0x4020,0)) { /* |x| > 2**34 */ + if(ix==0x7fff) return x+x; /* x is inf or NaN */ w = __ieee754_logl(fabsl(x))+ln2; - } else if (ix>0x4000) { /* 2**34 > |x| > 2.0 */ - t = fabsl(x); - w = __ieee754_logl(2.0*t+one/(__ieee754_sqrtl(x*x+one)+t)); - } else { /* 2.0 > |x| > 2**-28 */ - t = x*x; - w =__log1pl(fabsl(x)+t/(one+__ieee754_sqrtl(one+t))); + } else { + long double xa = fabsl(x); + if (ix>0x4000) { /* 2**34 > |x| > 2.0 */ + w = __ieee754_logl(2.0*xa+one/(__ieee754_sqrtl(xa*xa+one)+xa)); + } else { /* 2.0 > |x| > 2**-28 */ + t = xa*xa; + w =__log1pl(xa+t/(one+__ieee754_sqrtl(one+t))); + } } - if(hx&0x8000) return -w; else return w; + return __copysignl(w, x); } weak_alias (__asinhl, asinhl) diff --git a/sysdeps/powerpc/fpu/e_hypot.c b/sysdeps/powerpc/fpu/e_hypot.c index afbcc18..a8d67d8 100644 --- a/sysdeps/powerpc/fpu/e_hypot.c +++ b/sysdeps/powerpc/fpu/e_hypot.c @@ -115,3 +115,4 @@ __ieee754_hypot (double x, double y) } return __ieee754_sqrt (x * x + y * y); } +strong_alias (__ieee754_hypot, __hypot_finite) diff --git a/sysdeps/powerpc/fpu/e_hypotf.c b/sysdeps/powerpc/fpu/e_hypotf.c index 02ad773..915738c 100644 --- a/sysdeps/powerpc/fpu/e_hypotf.c +++ b/sysdeps/powerpc/fpu/e_hypotf.c @@ -116,3 +116,4 @@ __ieee754_hypotf (float x, float y) } return __ieee754_sqrtf (x * x + y * y); } +strong_alias (__ieee754_hypotf, __hypotf_finite) diff --git a/sysdeps/powerpc/fpu/e_sqrt.c b/sysdeps/powerpc/fpu/e_sqrt.c index e95b786..f9ded25 100644 --- a/sysdeps/powerpc/fpu/e_sqrt.c +++ b/sysdeps/powerpc/fpu/e_sqrt.c @@ -1,5 +1,5 @@ /* Double-precision floating point square root. - Copyright (C) 1997, 2002, 2003, 2004, 2008 Free Software Foundation, Inc. + Copyright (C) 1997, 2002-2004, 2008, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -46,21 +46,15 @@ extern const float __t_sqrt[1024]; generated guesses (which mostly runs on the integer unit, while the Newton-Raphson is running on the FPU). */ -#ifdef __STDC__ double __slow_ieee754_sqrt (double x) -#else -double -__slow_ieee754_sqrt (x) - double x; -#endif { const float inf = a_inf.value; if (x > 0) { /* schedule the EXTRACT_WORDS to get separation between the store - and the load. */ + and the load. */ ieee_double_shape_type ew_u; ieee_double_shape_type iw_u; ew_u.value = (x); @@ -147,7 +141,7 @@ __slow_ieee754_sqrt (x) else if (x < 0) { /* For some reason, some PowerPC32 processors don't implement - FE_INVALID_SQRT. */ + FE_INVALID_SQRT. */ #ifdef FE_INVALID_SQRT feraiseexcept (FE_INVALID_SQRT); @@ -160,14 +154,8 @@ __slow_ieee754_sqrt (x) return f_wash (x); } -#ifdef __STDC__ double __ieee754_sqrt (double x) -#else -double -__ieee754_sqrt (x) - double x; -#endif { double z; @@ -175,7 +163,7 @@ __ieee754_sqrt (x) if (__CPU_HAS_FSQRT) { /* Volatile is required to prevent the compiler from moving the - fsqrt instruction above the branch. */ + fsqrt instruction above the branch. */ __asm __volatile (" fsqrt %0,%1\n" :"=f" (z):"f" (x)); } @@ -184,3 +172,4 @@ __ieee754_sqrt (x) return z; } +strong_alias (__ieee754_sqrt, __sqrt_finite) diff --git a/sysdeps/powerpc/fpu/e_sqrtf.c b/sysdeps/powerpc/fpu/e_sqrtf.c index ca44fac..965faee 100644 --- a/sysdeps/powerpc/fpu/e_sqrtf.c +++ b/sysdeps/powerpc/fpu/e_sqrtf.c @@ -1,5 +1,5 @@ /* Single-precision floating point square root. - Copyright (C) 1997, 2003, 2004, 2008 Free Software Foundation, Inc. + Copyright (C) 1997, 2003, 2004, 2008, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -46,14 +46,8 @@ extern const float __t_sqrt[1024]; generated guesses (which mostly runs on the integer unit, while the Newton-Raphson is running on the FPU). */ -#ifdef __STDC__ float __slow_ieee754_sqrtf (float x) -#else -float -__slow_ieee754_sqrtf (x) - float x; -#endif { const float inf = a_inf.value; @@ -123,7 +117,7 @@ __slow_ieee754_sqrtf (x) else if (x < 0) { /* For some reason, some PowerPC32 processors don't implement - FE_INVALID_SQRT. */ + FE_INVALID_SQRT. */ #ifdef FE_INVALID_SQRT feraiseexcept (FE_INVALID_SQRT); @@ -137,14 +131,8 @@ __slow_ieee754_sqrtf (x) } -#ifdef __STDC__ float __ieee754_sqrtf (float x) -#else -float -__ieee754_sqrtf (x) - float x; -#endif { double z; @@ -152,7 +140,7 @@ __ieee754_sqrtf (x) if (__CPU_HAS_FSQRT) { /* Volatile is required to prevent the compiler from moving the - fsqrt instruction above the branch. */ + fsqrt instruction above the branch. */ __asm __volatile (" fsqrts %0,%1\n" :"=f" (z):"f" (x)); } @@ -161,3 +149,4 @@ __ieee754_sqrtf (x) return z; } +strong_alias (__ieee754_sqrtf, __sqrtf_finite) diff --git a/sysdeps/powerpc/powerpc64/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc64/fpu/e_sqrt.c index 0a229cb..314abba 100644 --- a/sysdeps/powerpc/powerpc64/fpu/e_sqrt.c +++ b/sysdeps/powerpc/powerpc64/fpu/e_sqrt.c @@ -1,5 +1,5 @@ /* Double-precision floating point square root. - Copyright (C) 1997, 2002, 2003, 2004, 2006 Free Software Foundation, Inc. + Copyright (C) 1997, 2002-2004, 2006, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -27,3 +27,4 @@ __ieee754_sqrt (double x) __asm __volatile ("fsqrt %0,%1" : "=f" (z) : "f" (x)); return z; } +strong_alias (__ieee754_sqrt, __sqrt_finite) diff --git a/sysdeps/powerpc/powerpc64/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc64/fpu/e_sqrtf.c index 0f17a64..7157214 100644 --- a/sysdeps/powerpc/powerpc64/fpu/e_sqrtf.c +++ b/sysdeps/powerpc/powerpc64/fpu/e_sqrtf.c @@ -1,5 +1,5 @@ /* Single-precision floating point square root. - Copyright (C) 1997, 2003, 2004, 2006 Free Software Foundation, Inc. + Copyright (C) 1997, 2003, 2004, 2006, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -27,3 +27,4 @@ __ieee754_sqrtf (float x) __asm ("fsqrts %0,%1" : "=f" (z) : "f" (x)); return z; } +strong_alias (__ieee754_sqrtf, __sqrtf_finite) diff --git a/sysdeps/s390/fpu/e_sqrt.c b/sysdeps/s390/fpu/e_sqrt.c index e4b183e..affd3a1 100644 --- a/sysdeps/s390/fpu/e_sqrt.c +++ b/sysdeps/s390/fpu/e_sqrt.c @@ -1,5 +1,5 @@ -/* Copyright (C) 2004 Free Software Foundation, Inc. - Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). +/* Copyright (C) 2004, 2011 Free Software Foundation, Inc. + Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -27,3 +27,4 @@ __ieee754_sqrt (double x) asm ( "sqdbr %0,%1" : "=f" (res) : "f" (x) ); return res; } +strong_alias (__ieee754_sqrt, __sqrt_finite) diff --git a/sysdeps/s390/fpu/e_sqrtf.c b/sysdeps/s390/fpu/e_sqrtf.c index 5b5e06e..4272f05 100644 --- a/sysdeps/s390/fpu/e_sqrtf.c +++ b/sysdeps/s390/fpu/e_sqrtf.c @@ -1,5 +1,5 @@ -/* Copyright (C) 2004 Free Software Foundation, Inc. - Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). +/* Copyright (C) 2004, 2011 Free Software Foundation, Inc. + Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -27,3 +27,4 @@ __ieee754_sqrtf (float x) asm ( "sqebr %0,%1" : "=f" (res) : "f" (x) ); return res; } +strong_alias (__ieee754_sqrtf, __sqrtf_finite) diff --git a/sysdeps/s390/fpu/e_sqrtl.c b/sysdeps/s390/fpu/e_sqrtl.c index e1daac1..45d0a0e 100644 --- a/sysdeps/s390/fpu/e_sqrtl.c +++ b/sysdeps/s390/fpu/e_sqrtl.c @@ -1,6 +1,6 @@ /* Square root. S/390 FPU version. - Copyright (C) 2004, 2006 Free Software Foundation, Inc. - Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). + Copyright (C) 2004, 2006, 2011 Free Software Foundation, Inc. + Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -28,3 +28,4 @@ __ieee754_sqrtl (long double x) asm ( "sqxbr %0,%1" : "=f" (res) : "f" (x) ); return res; } +strong_alias (__ieee754_sqrtl, __sqrtl_finite) diff --git a/sysdeps/sparc/sparc32/e_sqrt.c b/sysdeps/sparc/sparc32/e_sqrt.c index 0be4b6c..5969105 100644 --- a/sysdeps/sparc/sparc32/e_sqrt.c +++ b/sysdeps/sparc/sparc32/e_sqrt.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1992, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1992, 1997, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -32,3 +32,4 @@ __ieee754_sqrt (x) asm ("fsqrtd %1, %0" : "=f" (result) : "f" (x)); return result; } +strong_alias (__ieee754_sqrt, __sqrt_finite) diff --git a/sysdeps/sparc/sparc64/fpu/e_sqrtl.c b/sysdeps/sparc/sparc64/fpu/e_sqrtl.c index 4c3d19a..e1479c2 100644 --- a/sysdeps/sparc/sparc64/fpu/e_sqrtl.c +++ b/sysdeps/sparc/sparc64/fpu/e_sqrtl.c @@ -1,5 +1,5 @@ /* Long double square root, sparc64 version. - Copyright (C) 2000 Free Software Foundation, Inc. + Copyright (C) 2000, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jakub Jelinek <jakub@redhat.com>, 2000. @@ -29,3 +29,4 @@ __ieee754_sqrtl (long double x) _Qp_sqrt (&ret, &x); return ret; } +strong_alias (__ieee754_sqrtl, __sqrtl_finite) diff --git a/sysdeps/x86_64/fpu/bits/fenv.h b/sysdeps/x86_64/fpu/bits/fenv.h index 11859f0..be2518d 100644 --- a/sysdeps/x86_64/fpu/bits/fenv.h +++ b/sysdeps/x86_64/fpu/bits/fenv.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997,1998,1999,2000,2001,2004 Free Software Foundation, Inc. +/* Copyright (C) 1997-2001,2004,2011 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -95,3 +95,36 @@ fenv_t; /* Floating-point environment where none of the exception is masked. */ # define FE_NOMASK_ENV ((__const fenv_t *) -2) #endif + + +#ifdef __OPTIMIZE__ +/* Optimized versions. */ +extern int __feraiseexcept_renamed (int) __asm__ ("feraiseexcept"); +__extern_inline int feraiseexcept (int __excepts) +{ + if (__builtin_constant_p (__excepts) + && (__excepts & ~(FE_INVALID | FE_DIVBYZERO)) == 0) + { + if ((FE_INVALID & __excepts) != 0) + { + /* One example of a invalid operation is 0.0 / 0.0. */ + float __f = 0.0; + + __asm__ __volatile__ ("divss %0, %0 " : : "x" (__f)); + (void) &__f; + } + if ((FE_DIVBYZERO & __excepts) != 0) + { + float f = 1.0; + float g = 0.0; + + __asm__ __volatile__ ("divss %1, %0" : : "x" (f), "x" (g)); + (void) &f; + } + + return 0; + } + + return __feraiseexcept_renamed (__excepts); +} +#endif diff --git a/sysdeps/x86_64/fpu/bits/mathinline.h b/sysdeps/x86_64/fpu/bits/mathinline.h index 780f878..5bdf47e 100644 --- a/sysdeps/x86_64/fpu/bits/mathinline.h +++ b/sysdeps/x86_64/fpu/bits/mathinline.h @@ -103,7 +103,8 @@ __NTH (llrint (double __x)) } # endif -# if __FINITE_MATH_ONLY__ == 1 && (__WORDSIZE == 64 || defined __SSE2_MATH__) +# if defined __FINITE_MATH_ONLY__ && __FINITE_MATH_ONLY__ > 0 \ + && (__WORDSIZE == 64 || defined __SSE2_MATH__) /* Determine maximum of two values. */ __MATH_INLINE float __NTH (fmaxf (float __x, float __y)) diff --git a/sysdeps/x86_64/fpu/e_exp2l.S b/sysdeps/x86_64/fpu/e_exp2l.S index 336b989..7abf425 100644 --- a/sysdeps/x86_64/fpu/e_exp2l.S +++ b/sysdeps/x86_64/fpu/e_exp2l.S @@ -36,3 +36,4 @@ ENTRY(__ieee754_exp2l) fldz /* Set result to 0. */ 2: ret END (__ieee754_exp2l) +strong_alias (__ieee754_exp2l, __exp2l_finite) diff --git a/sysdeps/x86_64/fpu/e_fmodl.S b/sysdeps/x86_64/fpu/e_fmodl.S index 2967bf2..07c50df 100644 --- a/sysdeps/x86_64/fpu/e_fmodl.S +++ b/sysdeps/x86_64/fpu/e_fmodl.S @@ -20,3 +20,4 @@ ENTRY(__ieee754_fmodl) fstp %st(1) ret END (__ieee754_fmodl) +strong_alias (__ieee754_fmodl, __fmodl_finite) diff --git a/sysdeps/x86_64/fpu/e_log10l.S b/sysdeps/x86_64/fpu/e_log10l.S index 633234b..50c5875 100644 --- a/sysdeps/x86_64/fpu/e_log10l.S +++ b/sysdeps/x86_64/fpu/e_log10l.S @@ -10,14 +10,12 @@ #include <machine/asm.h> -RCSID("$NetBSD: $") - #ifdef __ELF__ - .section .rodata + .section .rodata.cst8,"aM",@progbits,8 #else .text #endif - .align ALIGNARG(4) + .p2align 3 ASM_TYPE_DIRECTIVE(one,@object) one: .double 1.0 ASM_SIZE_DIRECTIVE(one) @@ -30,9 +28,9 @@ limit: .double 0.29 #ifdef PIC -#define MO(op) op##(%rip) +# define MO(op) op##(%rip) #else -#define MO(op) op +# define MO(op) op #endif .text @@ -65,3 +63,20 @@ ENTRY(__ieee754_log10l) fstp %st(1) ret END(__ieee754_log10l) + + +ENTRY(__log10l_finite) + fldlg2 // log10(2) + fldt 8(%rsp) // x : log10(2) + fld %st // x : x : log10(2) +4: fsubl MO(one) // x-1 : x : log10(2) + fld %st // x-1 : x-1 : x : log10(2) + fabs // |x-1| : x-1 : x : log10(2) + fcompl MO(limit) // x-1 : x : log10(2) + fnstsw // x-1 : x : log10(2) + andb $0x45, %ah + jz 2b + fstp %st(1) // x-1 : log10(2) + fyl2xp1 // log10(x) + ret +END(__log10l_finite) diff --git a/sysdeps/x86_64/fpu/e_log2l.S b/sysdeps/x86_64/fpu/e_log2l.S index f04d30a..78dc2d5 100644 --- a/sysdeps/x86_64/fpu/e_log2l.S +++ b/sysdeps/x86_64/fpu/e_log2l.S @@ -10,11 +10,11 @@ #include <machine/asm.h> #ifdef __ELF__ - .section .rodata + .section .rodata.cst8,"aM",@progbits,8 #else .text #endif - .align ALIGNARG(4) + .p2align 3 ASM_TYPE_DIRECTIVE(one,@object) one: .double 1.0 ASM_SIZE_DIRECTIVE(one) @@ -27,9 +27,9 @@ limit: .double 0.29 #ifdef PIC -#define MO(op) op##(%rip) +# define MO(op) op##(%rip) #else -#define MO(op) op +# define MO(op) op #endif .text @@ -62,3 +62,20 @@ ENTRY(__ieee754_log2l) fstp %st(1) ret END (__ieee754_log2l) + + +ENTRY(__log2l_finite) + fldl MO(one) + fldt 8(%rsp) // x : 1 + fld %st // x : x : 1 + fsub %st(2), %st // x-1 : x : 1 + fld %st // x-1 : x-1 : x : 1 + fabs // |x-1| : x-1 : x : 1 + fcompl MO(limit) // x-1 : x : 1 + fnstsw // x-1 : x : 1 + andb $0x45, %ah + jz 2b + fstp %st(1) // x-1 : 1 + fyl2xp1 // log(x) + ret +END (__log2l_finite) diff --git a/sysdeps/x86_64/fpu/e_logl.S b/sysdeps/x86_64/fpu/e_logl.S index 2ba91ee..2503b9a 100644 --- a/sysdeps/x86_64/fpu/e_logl.S +++ b/sysdeps/x86_64/fpu/e_logl.S @@ -8,15 +8,13 @@ #include <machine/asm.h> -RCSID("$NetBSD: $") - #ifdef __ELF__ - .section .rodata + .section .rodata.cst8,"aM",@progbits,8 #else .text #endif - .align ALIGNARG(4) + .p2align 3 ASM_TYPE_DIRECTIVE(one,@object) one: .double 1.0 ASM_SIZE_DIRECTIVE(one) @@ -29,9 +27,9 @@ limit: .double 0.29 #ifdef PIC -#define MO(op) op##(%rip) +# define MO(op) op##(%rip) #else -#define MO(op) op +# define MO(op) op #endif .text @@ -64,3 +62,20 @@ ENTRY(__ieee754_logl) fstp %st(1) ret END (__ieee754_logl) + + +ENTRY(__logl_finite) + fldln2 // log(2) + fldt 8(%rsp) // x : log(2) + fld %st // x : x : log(2) + fsubl MO(one) // x-1 : x : log(2) + fld %st // x-1 : x-1 : x : log(2) + fabs // |x-1| : x-1 : x : log(2) + fcompl MO(limit) // x-1 : x : log(2) + fnstsw // x-1 : x : log(2) + andb $0x45, %ah + jz 2b + fstp %st(1) // x-1 : log(2) + fyl2xp1 // log(x) + ret +END (__logl_finite) diff --git a/sysdeps/x86_64/fpu/e_powl.S b/sysdeps/x86_64/fpu/e_powl.S index a0b1b1d..a65c465 100644 --- a/sysdeps/x86_64/fpu/e_powl.S +++ b/sysdeps/x86_64/fpu/e_powl.S @@ -22,12 +22,27 @@ #include <machine/asm.h> #ifdef __ELF__ - .section .rodata + .section .rodata.cst8,"aM",@progbits,8 #else .text #endif + .p2align 3 + ASM_TYPE_DIRECTIVE(one,@object) +one: .double 1.0 + ASM_SIZE_DIRECTIVE(one) + ASM_TYPE_DIRECTIVE(limit,@object) +limit: .double 0.29 + ASM_SIZE_DIRECTIVE(limit) + ASM_TYPE_DIRECTIVE(p63,@object) +p63: .byte 0, 0, 0, 0, 0, 0, 0xe0, 0x43 + ASM_SIZE_DIRECTIVE(p63) - .align ALIGNARG(4) +#ifdef __ELF__ + .section .rodata.cst16,"aM",@progbits,16 +#else + .text +#endif + .p2align 3 ASM_TYPE_DIRECTIVE(infinity,@object) inf_zero: infinity: @@ -43,21 +58,11 @@ minfinity: mzero: .byte 0, 0, 0, 0, 0, 0, 0, 0x80 ASM_SIZE_DIRECTIVE(minf_mzero) - ASM_TYPE_DIRECTIVE(one,@object) -one: .double 1.0 - ASM_SIZE_DIRECTIVE(one) - ASM_TYPE_DIRECTIVE(limit,@object) -limit: .double 0.29 - ASM_SIZE_DIRECTIVE(limit) - ASM_TYPE_DIRECTIVE(p63,@object) -p63: - .byte 0, 0, 0, 0, 0, 0, 0xe0, 0x43 - ASM_SIZE_DIRECTIVE(p63) #ifdef PIC -#define MO(op) op##(%rip) +# define MO(op) op##(%rip) #else -#define MO(op) op +# define MO(op) op #endif .text @@ -339,3 +344,4 @@ ENTRY(__ieee754_powl) ret END(__ieee754_powl) +strong_alias (__ieee754_powl, __powl_finite) diff --git a/sysdeps/x86_64/fpu/e_remainderl.S b/sysdeps/x86_64/fpu/e_remainderl.S index 480b1ca..4ee0910 100644 --- a/sysdeps/x86_64/fpu/e_remainderl.S +++ b/sysdeps/x86_64/fpu/e_remainderl.S @@ -18,3 +18,4 @@ ENTRY(__ieee754_remainderl) fstp %st(1) ret END (__ieee754_remainderl) +strong_alias (__ieee754_remainderl, __remainderl_finite) diff --git a/sysdeps/x86_64/fpu/e_scalbl.S b/sysdeps/x86_64/fpu/e_scalbl.S index 6b22970..5833321 100644 --- a/sysdeps/x86_64/fpu/e_scalbl.S +++ b/sysdeps/x86_64/fpu/e_scalbl.S @@ -10,8 +10,6 @@ #include <machine/asm.h> -RCSID("$NetBSD: $") - #ifdef __ELF__ .section .rodata #else @@ -23,16 +21,15 @@ RCSID("$NetBSD: $") zero_nan: .double 0.0 nan: .byte 0, 0, 0, 0, 0, 0, 0xff, 0x7f -minus_zero: .byte 0, 0, 0, 0, 0, 0, 0, 0x80 .byte 0, 0, 0, 0, 0, 0, 0xff, 0x7f ASM_SIZE_DIRECTIVE(zero_nan) #ifdef PIC -#define MO(op) op##(%rip) +# define MO(op) op##(%rip) #else -#define MO(op) op +# define MO(op) op #endif .text @@ -98,3 +95,4 @@ ENTRY(__ieee754_scalbl) fdiv %st ret END(__ieee754_scalbl) +strong_alias (__ieee754_scalbl, __scalbl_finite) diff --git a/sysdeps/x86_64/fpu/e_sqrt.c b/sysdeps/x86_64/fpu/e_sqrt.c index d588a8b..9912099 100644 --- a/sysdeps/x86_64/fpu/e_sqrt.c +++ b/sysdeps/x86_64/fpu/e_sqrt.c @@ -1,5 +1,5 @@ /* Square root of floating point number. - Copyright (C) 2002 Free Software Foundation, Inc. + Copyright (C) 2002, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -19,12 +19,14 @@ #include <math_private.h> +#undef __ieee754_sqrt double __ieee754_sqrt (double x) { double res; - asm ("sqrtsd %0, %1" : "=x" (res) : "x" (x)); + asm ("sqrtsd %1, %0" : "=x" (res) : "xm" (x)); return res; } +strong_alias (__ieee754_sqrt, __sqrt_finite) diff --git a/sysdeps/x86_64/fpu/e_sqrtf.c b/sysdeps/x86_64/fpu/e_sqrtf.c index f7801f0..dade4f5 100644 --- a/sysdeps/x86_64/fpu/e_sqrtf.c +++ b/sysdeps/x86_64/fpu/e_sqrtf.c @@ -1,5 +1,5 @@ /* Square root of floating point number. - Copyright (C) 2002 Free Software Foundation, Inc. + Copyright (C) 2002, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -19,12 +19,14 @@ #include <math_private.h> +#undef __ieee754_sqrtf float __ieee754_sqrtf (float x) { float res; - asm ("sqrtss %0, %1" : "=x" (res) : "x" (x)); + asm ("sqrtss %1, %0" : "=x" (res) : "xm" (x)); return res; } +strong_alias (__ieee754_sqrtf, __sqrtf_finite) diff --git a/sysdeps/x86_64/fpu/math_private.h b/sysdeps/x86_64/fpu/math_private.h index 37357d3..523ec54 100644 --- a/sysdeps/x86_64/fpu/math_private.h +++ b/sysdeps/x86_64/fpu/math_private.h @@ -58,22 +58,35 @@ do { \ #endif #define __isnan(d) \ - ({ long int __di; EXTRACT_WORDS64 (__di, d); \ + ({ long int __di; EXTRACT_WORDS64 (__di, (double) d); \ (__di & 0x7fffffffffffffffl) > 0x7ff0000000000000l; }) #define __isnanf(d) \ - ({ int __di; GET_FLOAT_WORD (__di, d); \ + ({ int __di; GET_FLOAT_WORD (__di, (float) d); \ (__di & 0x7fffffff) > 0x7f800000; }) #define __isinf_ns(d) \ - ({ long int __di; EXTRACT_WORDS64 (__di, d); \ + ({ long int __di; EXTRACT_WORDS64 (__di, (double) d); \ (__di & 0x7fffffffffffffffl) == 0x7ff0000000000000l; }) #define __isinf_nsf(d) \ - ({ int __di; GET_FLOAT_WORD (__di, d); \ + ({ int __di; GET_FLOAT_WORD (__di, (float) d); \ (__di & 0x7fffffff) == 0x7f800000; }) #define __finite(d) \ - ({ long int __di; EXTRACT_WORDS64 (__di, d); \ + ({ long int __di; EXTRACT_WORDS64 (__di, (double) d); \ (__di & 0x7fffffffffffffffl) < 0x7ff0000000000000l; }) #define __finitef(d) \ - ({ int __di; GET_FLOAT_WORD (__di, d); \ + ({ int __di; GET_FLOAT_WORD (__di, (float) d); \ (__di & 0x7fffffff) < 0x7f800000; }) + +#define __ieee754_sqrt(d) \ + ({ double __res; \ + asm ("sqrtsd %1, %0" : "=x" (__res) : "xm" ((double) d)); \ + __res; }) +#define __ieee754_sqrtf(d) \ + ({ float __res; \ + asm ("sqrtss %1, %0" : "=x" (__res) : "xm" ((float) d)); \ + __res; }) +#define __ieee754_sqrtl(d) \ + ({ long double __res; \ + asm ("fsqrt" : "=t" (__res) : "0" ((long double) d)); \ + __res; }) |