From 0ecb606cb6cf65de1d9fc8a919bceb4be476c602 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 12 Jul 2007 18:26:36 +0000 Subject: 2.5-18.1 --- math/Makefile | 16 +- math/Versions | 9 +- math/basic-test.c | 36 +- math/bits/mathcalls.h | 13 +- math/bug-nextafter.c | 255 ++++++++ math/bug-nexttoward.c | 255 ++++++++ math/cabsf.c | 29 + math/cargf.c | 29 + math/cimagf.c | 28 + math/complex.h | 11 +- math/conjf.c | 28 + math/crealf.c | 28 + math/divtc3.c | 75 +++ math/e_acoshl.c | 14 + math/e_acosl.c | 14 + math/e_asinl.c | 14 + math/e_atan2l.c | 14 + math/e_atanhl.c | 14 + math/e_coshl.c | 14 + math/e_exp10.c | 30 + math/e_exp10f.c | 30 + math/e_exp10l.c | 30 + math/e_exp2l.c | 10 + math/e_expl.c | 14 + math/e_fmodl.c | 14 + math/e_gammal_r.c | 15 + math/e_hypotl.c | 14 + math/e_j0l.c | 25 + math/e_j1l.c | 25 + math/e_jnl.c | 25 + math/e_lgammal_r.c | 17 + math/e_log10l.c | 14 + math/e_log2l.c | 14 + math/e_logl.c | 14 + math/e_powl.c | 14 + math/e_rem_pio2l.c | 15 + math/e_scalb.c | 71 +++ math/e_scalbf.c | 68 +++ math/e_scalbl.c | 75 +++ math/e_sinhl.c | 14 + math/e_sqrtl.c | 14 + math/fclrexcpt.c | 37 ++ math/fedisblxcpt.c | 30 + math/feenablxcpt.c | 30 + math/fegetenv.c | 38 ++ math/fegetexcept.c | 30 + math/fegetround.c | 29 + math/feholdexcpt.c | 30 + math/fesetenv.c | 38 ++ math/fesetround.c | 30 + math/feupdateenv.c | 37 ++ math/fgetexcptflg.c | 37 ++ math/fpu_control.c | 25 + math/fraiseexcpt.c | 38 ++ math/fsetexcptflg.c | 37 ++ math/ftestexcept.c | 29 + math/gen-libm-test.pl | 19 +- math/k_cosl.c | 15 + math/k_rem_pio2l.c | 16 + math/k_sincosl.c | 1 + math/k_sinl.c | 15 + math/k_tanl.c | 15 + math/libm-test.inc | 1571 +++++++++++++++++++++++++++++++++++++++++++++++- math/math.h | 31 +- math/math_private.h | 21 +- math/multc3.c | 80 +++ math/s_asinhl.c | 15 + math/s_atanl.c | 15 + math/s_cacos.c | 41 ++ math/s_cacosf.c | 39 ++ math/s_cacosh.c | 95 +++ math/s_cacoshf.c | 108 ++++ math/s_cacoshl.c | 91 +++ math/s_cacosl.c | 37 ++ math/s_casin.c | 66 ++ math/s_casinf.c | 64 ++ math/s_casinh.c | 84 +++ math/s_casinhf.c | 82 +++ math/s_casinhl.c | 80 +++ math/s_casinl.c | 62 ++ math/s_catan.c | 89 +++ math/s_catanf.c | 87 +++ math/s_catanh.c | 84 +++ math/s_catanhf.c | 82 +++ math/s_catanhl.c | 80 +++ math/s_catanl.c | 85 +++ math/s_cbrtl.c | 15 + math/s_ccos.c | 80 +++ math/s_ccosf.c | 78 +++ math/s_ccosh.c | 105 ++++ math/s_ccoshf.c | 103 ++++ math/s_ccoshl.c | 101 ++++ math/s_ccosl.c | 76 +++ math/s_cexp.c | 127 ++++ math/s_cexpf.c | 125 ++++ math/s_cexpl.c | 123 ++++ math/s_clog.c | 65 ++ math/s_clog10.c | 65 ++ math/s_clog10f.c | 63 ++ math/s_clog10l.c | 61 ++ math/s_clogf.c | 63 ++ math/s_clogl.c | 61 ++ math/s_cpow.c | 34 ++ math/s_cpowf.c | 32 + math/s_cpowl.c | 30 + math/s_cproj.c | 51 ++ math/s_cprojf.c | 49 ++ math/s_cprojl.c | 48 ++ math/s_csin.c | 131 ++++ math/s_csinf.c | 129 ++++ math/s_csinh.c | 126 ++++ math/s_csinhf.c | 124 ++++ math/s_csinhl.c | 122 ++++ math/s_csinl.c | 127 ++++ math/s_csqrt.c | 114 ++++ math/s_csqrtf.c | 112 ++++ math/s_csqrtl.c | 110 ++++ math/s_ctan.c | 84 +++ math/s_ctanf.c | 83 +++ math/s_ctanh.c | 84 +++ math/s_ctanhf.c | 82 +++ math/s_ctanhl.c | 80 +++ math/s_ctanl.c | 81 +++ math/s_erfl.c | 26 + math/s_expm1l.c | 16 + math/s_fdim.c | 40 ++ math/s_fdimf.c | 36 ++ math/s_fdiml.c | 36 ++ math/s_fma.c | 33 + math/s_fmaf.c | 28 + math/s_fmal.c | 28 + math/s_fmax.c | 33 + math/s_fmaxf.c | 29 + math/s_fmaxl.c | 29 + math/s_fmin.c | 33 + math/s_fminf.c | 29 + math/s_fminl.c | 29 + math/s_ldexp.c | 37 ++ math/s_ldexpf.c | 37 ++ math/s_ldexpl.c | 37 ++ math/s_log1pl.c | 15 + math/s_nan.c | 44 ++ math/s_nanf.c | 40 ++ math/s_nanl.c | 40 ++ math/s_nextafter.c | 100 +++ math/s_nexttowardf.c | 85 +++ math/s_nexttowardl.c | 1 + math/s_significand.c | 39 ++ math/s_significandf.c | 32 + math/s_significandl.c | 39 ++ math/s_tanhl.c | 15 + math/setfpucw.c | 37 ++ math/t_sincosl.c | 1 + math/test-misc.c | 114 +++- math/test-tgmath-int.c | 71 +++ math/tgmath.h | 15 +- math/w_acos.c | 48 ++ math/w_acosf.c | 48 ++ math/w_acosh.c | 47 ++ math/w_acoshf.c | 48 ++ math/w_acoshl.c | 47 ++ math/w_acosl.c | 48 ++ math/w_asin.c | 49 ++ math/w_asinf.c | 49 ++ math/w_asinl.c | 49 ++ math/w_atan2.c | 47 ++ math/w_atan2f.c | 46 ++ math/w_atan2l.c | 47 ++ math/w_atanh.c | 52 ++ math/w_atanhf.c | 53 ++ math/w_atanhl.c | 52 ++ math/w_cosh.c | 47 ++ math/w_coshf.c | 47 ++ math/w_coshl.c | 47 ++ math/w_drem.c | 20 + math/w_dremf.c | 17 + math/w_dreml.c | 18 + math/w_exp10.c | 51 ++ math/w_exp10f.c | 46 ++ math/w_exp10l.c | 46 ++ math/w_exp2.c | 36 ++ math/w_exp2f.c | 32 + math/w_exp2l.c | 31 + math/w_expl.c | 13 + math/w_fmod.c | 48 ++ math/w_fmodf.c | 48 ++ math/w_fmodl.c | 48 ++ math/w_hypot.c | 48 ++ math/w_hypotf.c | 48 ++ math/w_hypotl.c | 48 ++ math/w_j0.c | 76 +++ math/w_j0f.c | 74 +++ math/w_j0l.c | 76 +++ math/w_j1.c | 77 +++ math/w_j1f.c | 75 +++ math/w_j1l.c | 76 +++ math/w_jn.c | 99 +++ math/w_jnf.c | 71 +++ math/w_jnl.c | 98 +++ math/w_lgamma.c | 60 ++ math/w_lgamma_r.c | 51 ++ math/w_lgammaf.c | 53 ++ math/w_lgammaf_r.c | 52 ++ math/w_lgammal.c | 58 ++ math/w_lgammal_r.c | 52 ++ math/w_log.c | 48 ++ math/w_log10.c | 51 ++ math/w_log10f.c | 52 ++ math/w_log10l.c | 51 ++ math/w_log2.c | 32 + math/w_log2f.c | 30 + math/w_log2l.c | 28 + math/w_logf.c | 49 ++ math/w_logl.c | 48 ++ math/w_pow.c | 70 +++ math/w_powf.c | 77 +++ math/w_powl.c | 68 +++ math/w_remainder.c | 47 ++ math/w_remainderf.c | 47 ++ math/w_remainderl.c | 48 ++ math/w_scalb.c | 65 ++ math/w_scalbf.c | 66 ++ math/w_scalbl.c | 65 ++ math/w_sinh.c | 47 ++ math/w_sinhf.c | 47 ++ math/w_sinhl.c | 47 ++ math/w_sqrt.c | 47 ++ math/w_sqrtf.c | 47 ++ math/w_sqrtl.c | 47 ++ math/w_tgamma.c | 56 ++ math/w_tgammaf.c | 53 ++ math/w_tgammal.c | 55 ++ 232 files changed, 13351 insertions(+), 45 deletions(-) create mode 100644 math/cabsf.c create mode 100644 math/cargf.c create mode 100644 math/cimagf.c create mode 100644 math/conjf.c create mode 100644 math/crealf.c create mode 100644 math/divtc3.c create mode 100644 math/e_acoshl.c create mode 100644 math/e_acosl.c create mode 100644 math/e_asinl.c create mode 100644 math/e_atan2l.c create mode 100644 math/e_atanhl.c create mode 100644 math/e_coshl.c create mode 100644 math/e_exp10.c create mode 100644 math/e_exp10f.c create mode 100644 math/e_exp10l.c create mode 100644 math/e_exp2l.c create mode 100644 math/e_expl.c create mode 100644 math/e_fmodl.c create mode 100644 math/e_gammal_r.c create mode 100644 math/e_hypotl.c create mode 100644 math/e_j0l.c create mode 100644 math/e_j1l.c create mode 100644 math/e_jnl.c create mode 100644 math/e_lgammal_r.c create mode 100644 math/e_log10l.c create mode 100644 math/e_log2l.c create mode 100644 math/e_logl.c create mode 100644 math/e_powl.c create mode 100644 math/e_rem_pio2l.c create mode 100644 math/e_scalb.c create mode 100644 math/e_scalbf.c create mode 100644 math/e_scalbl.c create mode 100644 math/e_sinhl.c create mode 100644 math/e_sqrtl.c create mode 100644 math/fclrexcpt.c create mode 100644 math/fedisblxcpt.c create mode 100644 math/feenablxcpt.c create mode 100644 math/fegetenv.c create mode 100644 math/fegetexcept.c create mode 100644 math/fegetround.c create mode 100644 math/feholdexcpt.c create mode 100644 math/fesetenv.c create mode 100644 math/fesetround.c create mode 100644 math/feupdateenv.c create mode 100644 math/fgetexcptflg.c create mode 100644 math/fpu_control.c create mode 100644 math/fraiseexcpt.c create mode 100644 math/fsetexcptflg.c create mode 100644 math/ftestexcept.c create mode 100644 math/k_cosl.c create mode 100644 math/k_rem_pio2l.c create mode 100644 math/k_sincosl.c create mode 100644 math/k_sinl.c create mode 100644 math/k_tanl.c create mode 100644 math/multc3.c create mode 100644 math/s_asinhl.c create mode 100644 math/s_atanl.c create mode 100644 math/s_cacos.c create mode 100644 math/s_cacosf.c create mode 100644 math/s_cacosh.c create mode 100644 math/s_cacoshf.c create mode 100644 math/s_cacoshl.c create mode 100644 math/s_cacosl.c create mode 100644 math/s_casin.c create mode 100644 math/s_casinf.c create mode 100644 math/s_casinh.c create mode 100644 math/s_casinhf.c create mode 100644 math/s_casinhl.c create mode 100644 math/s_casinl.c create mode 100644 math/s_catan.c create mode 100644 math/s_catanf.c create mode 100644 math/s_catanh.c create mode 100644 math/s_catanhf.c create mode 100644 math/s_catanhl.c create mode 100644 math/s_catanl.c create mode 100644 math/s_cbrtl.c create mode 100644 math/s_ccos.c create mode 100644 math/s_ccosf.c create mode 100644 math/s_ccosh.c create mode 100644 math/s_ccoshf.c create mode 100644 math/s_ccoshl.c create mode 100644 math/s_ccosl.c create mode 100644 math/s_cexp.c create mode 100644 math/s_cexpf.c create mode 100644 math/s_cexpl.c create mode 100644 math/s_clog.c create mode 100644 math/s_clog10.c create mode 100644 math/s_clog10f.c create mode 100644 math/s_clog10l.c create mode 100644 math/s_clogf.c create mode 100644 math/s_clogl.c create mode 100644 math/s_cpow.c create mode 100644 math/s_cpowf.c create mode 100644 math/s_cpowl.c create mode 100644 math/s_cproj.c create mode 100644 math/s_cprojf.c create mode 100644 math/s_cprojl.c create mode 100644 math/s_csin.c create mode 100644 math/s_csinf.c create mode 100644 math/s_csinh.c create mode 100644 math/s_csinhf.c create mode 100644 math/s_csinhl.c create mode 100644 math/s_csinl.c create mode 100644 math/s_csqrt.c create mode 100644 math/s_csqrtf.c create mode 100644 math/s_csqrtl.c create mode 100644 math/s_ctan.c create mode 100644 math/s_ctanf.c create mode 100644 math/s_ctanh.c create mode 100644 math/s_ctanhf.c create mode 100644 math/s_ctanhl.c create mode 100644 math/s_ctanl.c create mode 100644 math/s_erfl.c create mode 100644 math/s_expm1l.c create mode 100644 math/s_fdim.c create mode 100644 math/s_fdimf.c create mode 100644 math/s_fdiml.c create mode 100644 math/s_fma.c create mode 100644 math/s_fmaf.c create mode 100644 math/s_fmal.c create mode 100644 math/s_fmax.c create mode 100644 math/s_fmaxf.c create mode 100644 math/s_fmaxl.c create mode 100644 math/s_fmin.c create mode 100644 math/s_fminf.c create mode 100644 math/s_fminl.c create mode 100644 math/s_ldexp.c create mode 100644 math/s_ldexpf.c create mode 100644 math/s_ldexpl.c create mode 100644 math/s_log1pl.c create mode 100644 math/s_nan.c create mode 100644 math/s_nanf.c create mode 100644 math/s_nanl.c create mode 100644 math/s_nextafter.c create mode 100644 math/s_nexttowardf.c create mode 100644 math/s_nexttowardl.c create mode 100644 math/s_significand.c create mode 100644 math/s_significandf.c create mode 100644 math/s_significandl.c create mode 100644 math/s_tanhl.c create mode 100644 math/setfpucw.c create mode 100644 math/t_sincosl.c create mode 100644 math/test-tgmath-int.c create mode 100644 math/w_acos.c create mode 100644 math/w_acosf.c create mode 100644 math/w_acosh.c create mode 100644 math/w_acoshf.c create mode 100644 math/w_acoshl.c create mode 100644 math/w_acosl.c create mode 100644 math/w_asin.c create mode 100644 math/w_asinf.c create mode 100644 math/w_asinl.c create mode 100644 math/w_atan2.c create mode 100644 math/w_atan2f.c create mode 100644 math/w_atan2l.c create mode 100644 math/w_atanh.c create mode 100644 math/w_atanhf.c create mode 100644 math/w_atanhl.c create mode 100644 math/w_cosh.c create mode 100644 math/w_coshf.c create mode 100644 math/w_coshl.c create mode 100644 math/w_drem.c create mode 100644 math/w_dremf.c create mode 100644 math/w_dreml.c create mode 100644 math/w_exp10.c create mode 100644 math/w_exp10f.c create mode 100644 math/w_exp10l.c create mode 100644 math/w_exp2.c create mode 100644 math/w_exp2f.c create mode 100644 math/w_exp2l.c create mode 100644 math/w_expl.c create mode 100644 math/w_fmod.c create mode 100644 math/w_fmodf.c create mode 100644 math/w_fmodl.c create mode 100644 math/w_hypot.c create mode 100644 math/w_hypotf.c create mode 100644 math/w_hypotl.c create mode 100644 math/w_j0.c create mode 100644 math/w_j0f.c create mode 100644 math/w_j0l.c create mode 100644 math/w_j1.c create mode 100644 math/w_j1f.c create mode 100644 math/w_j1l.c create mode 100644 math/w_jn.c create mode 100644 math/w_jnf.c create mode 100644 math/w_jnl.c create mode 100644 math/w_lgamma.c create mode 100644 math/w_lgamma_r.c create mode 100644 math/w_lgammaf.c create mode 100644 math/w_lgammaf_r.c create mode 100644 math/w_lgammal.c create mode 100644 math/w_lgammal_r.c create mode 100644 math/w_log.c create mode 100644 math/w_log10.c create mode 100644 math/w_log10f.c create mode 100644 math/w_log10l.c create mode 100644 math/w_log2.c create mode 100644 math/w_log2f.c create mode 100644 math/w_log2l.c create mode 100644 math/w_logf.c create mode 100644 math/w_logl.c create mode 100644 math/w_pow.c create mode 100644 math/w_powf.c create mode 100644 math/w_powl.c create mode 100644 math/w_remainder.c create mode 100644 math/w_remainderf.c create mode 100644 math/w_remainderl.c create mode 100644 math/w_scalb.c create mode 100644 math/w_scalbf.c create mode 100644 math/w_scalbl.c create mode 100644 math/w_sinh.c create mode 100644 math/w_sinhf.c create mode 100644 math/w_sinhl.c create mode 100644 math/w_sqrt.c create mode 100644 math/w_sqrtf.c create mode 100644 math/w_sqrtl.c create mode 100644 math/w_tgamma.c create mode 100644 math/w_tgammaf.c create mode 100644 math/w_tgammal.c (limited to 'math') diff --git a/math/Makefile b/math/Makefile index c4501b87f4..1ab1b13b07 100644 --- a/math/Makefile +++ b/math/Makefile @@ -1,4 +1,5 @@ -# Copyright (C) 1996-2001, 2002, 2003, 2004 Free Software Foundation, Inc. +# Copyright (C) 1996-2001,2002,2003,2004,2005,2006 +# 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 @@ -89,7 +90,7 @@ distribute += $(filter-out $(generated),$(long-m-yes:=.c) $(long-c-yes:=.c)) # Rules for the test suite. tests = test-matherr test-fenv atest-exp atest-sincos atest-exp2 basic-test \ test-misc test-fpucw tst-definitions test-tgmath test-tgmath-ret \ - bug-nextafter bug-nexttoward bug-tgmath1 + bug-nextafter bug-nexttoward bug-tgmath1 test-tgmath-int # We do the `long double' tests only if this data type is available and # distinct from `double'. test-longdouble-yes = test-ldouble test-ildoubl @@ -107,7 +108,7 @@ generated += $(libm-tests-generated) libm-test.stmp # This is needed for dependencies before-compile += $(objpfx)libm-test.c -ulps-file = $(firstword $(wildcard $(config-sysdirs:%=$(..)%/libm-test-ulps))) +ulps-file = $(firstword $(wildcard $(sysdirs:%=%/libm-test-ulps))) $(addprefix $(objpfx), $(libm-tests-generated)): $(objpfx)libm-test.stmp @@ -149,6 +150,15 @@ distribute += ieee-math.c include ../Rules +# The generated sysd-rules file defines rules like this for sources +# coming from sysdeps/ directories. These rules find the generic sources. +define o-iterator-doit +$(objpfx)m_%$o: s_%.c $(before-compile); $$(compile-command.c) +endef +object-suffixes-left := $(all-object-suffixes) +include $(o-iterator) + + # This file defines the default _LIB_VERSION variable that controls # the error return conventions for the math functions. CPPFLAGS-s_lib_version.c := -D_POSIX_MODE diff --git a/math/Versions b/math/Versions index bd24fc6698..39c47626f6 100644 --- a/math/Versions +++ b/math/Versions @@ -94,7 +94,7 @@ libm { } GLIBC_2.1 { # mathematical functions - exp2; exp2f; exp2l; + exp2; exp2f; # exp2l; -- bug omitted this until GLIBC_2.4 (below) exp10; exp10f; exp10l; fdim; fdimf; fdiml; fma; fmaf; fmal; @@ -161,4 +161,11 @@ libm { # fp environment function feenableexcept; fedisableexcept; fegetexcept; } + GLIBC_2.4 { + # A bug in sysdeps/generic/w_exp2.c kept this from appearing + # in GLIBC_2.1 as it should have on platforms using that + # implementation file. On others, sysdeps/CPU/Versions now + # puts exp2l in GLIBC_2.1, which will override this entry. + exp2l; + } } diff --git a/math/basic-test.c b/math/basic-test.c index e42c014572..e48a3ae4e0 100644 --- a/math/basic-test.c +++ b/math/basic-test.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1999 Free Software Foundation, Inc. +/* Copyright (C) 1999, 2007 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Andreas Jaeger , 1999. @@ -44,7 +44,7 @@ NAME (void) \ \ zero_var = 0.0; \ one_var = 1.0; \ - NaN_var = zero_var/zero_var; \ + NaN_var = zero_var / zero_var; \ Inf_var = one_var / zero_var; \ \ (void) &zero_var; \ @@ -103,21 +103,51 @@ NAME (void) \ check (#FLOAT " isinf (-HUGE_VALx) == -1", isinf (x1) == -1); \ } +#define TEST_TRUNC(NAME, FLOAT, DOUBLE) \ +void \ +NAME (void) \ +{ \ + volatile DOUBLE Inf_var, NaN_var, zero_var, one_var; \ + FLOAT x1, x2; \ + \ + zero_var = 0.0; \ + one_var = 1.0; \ + NaN_var = zero_var / zero_var; \ + Inf_var = one_var / zero_var; \ + \ + (void) &NaN_var; \ + (void) &Inf_var; \ + \ + x1 = (FLOAT) NaN_var; \ + check (" "#FLOAT" x = ("#FLOAT") ("#DOUBLE") NaN", isnan (x1) != 0); \ + x2 = (FLOAT) Inf_var; \ + check (" "#FLOAT" x = ("#FLOAT") ("#DOUBLE") Inf", isinf (x2) != 0); \ +} + TEST_FUNC (float_test, float, nanf, FLT_EPSILON, HUGE_VALF) TEST_FUNC (double_test, double, nan, DBL_EPSILON, HUGE_VAL) +TEST_TRUNC (truncdfsf_test, float, double) #ifndef NO_LONG_DOUBLE TEST_FUNC (ldouble_test, long double, nanl, LDBL_EPSILON, HUGE_VALL) +TEST_TRUNC (trunctfsf_test, float, long double) +TEST_TRUNC (trunctfdf_test, double, long double) #endif int -main (void) +do_test (void) { float_test (); double_test (); + truncdfsf_test(); #ifndef NO_LONG_DOUBLE ldouble_test (); + trunctfsf_test(); + trunctfdf_test(); #endif return errors != 0; } + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/math/bits/mathcalls.h b/math/bits/mathcalls.h index 75b2f74556..64da6276f6 100644 --- a/math/bits/mathcalls.h +++ b/math/bits/mathcalls.h @@ -1,5 +1,5 @@ /* Prototype declarations for math functions; helper file for . - Copyright (C) 1996-2002, 2003 Free Software Foundation, Inc. + Copyright (C) 1996-2002, 2003, 2006 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 @@ -281,7 +281,7 @@ __MATHCALL (rint,, (_Mdouble_ __x)); /* Return X + epsilon if X < Y, X - epsilon if X > Y. */ __MATHCALLX (nextafter,, (_Mdouble_ __x, _Mdouble_ __y), (__const__)); -# ifdef __USE_ISOC99 +# if defined __USE_ISOC99 && !defined __LDBL_COMPAT __MATHCALLX (nexttoward,, (_Mdouble_ __x, long double __y), (__const__)); # endif @@ -353,10 +353,13 @@ __MATHDECL_1 (int, __signbit,, (_Mdouble_ __value)) /* Multiply-add function computed as a ternary operation. */ __MATHCALL (fma,, (_Mdouble_ __x, _Mdouble_ __y, _Mdouble_ __z)); +#endif /* Use ISO C99. */ + +#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 __END_NAMESPACE_C99 +#endif -# if defined __USE_MISC || defined __USE_XOPEN_EXTENDED +#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED /* Return X times (2 to the Nth power). */ __MATHCALL (scalb,, (_Mdouble_ __x, _Mdouble_ __n)); -# endif -#endif /* Use ISO C99. */ +#endif diff --git a/math/bug-nextafter.c b/math/bug-nextafter.c index 2a967c75bf..1d21841ea6 100644 --- a/math/bug-nextafter.c +++ b/math/bug-nextafter.c @@ -4,6 +4,9 @@ #include #include +float zero = 0.0; +float inf = INFINITY; + int main (void) { @@ -34,6 +37,81 @@ main (void) ++result; } + i = 0; + m = FLT_MIN; + feclearexcept (FE_ALL_EXCEPT); + i = nextafterf (m, i); + if (i < 0 || i >= FLT_MIN) + { + puts ("nextafterf+ failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nextafterf+ did not underflow"); + ++result; + } + i = 0; + feclearexcept (FE_ALL_EXCEPT); + i = nextafterf (-m, -i); + if (i > 0 || i <= -FLT_MIN) + { + puts ("nextafterf- failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nextafterf- did not underflow"); + ++result; + } + i = -INFINITY; + feclearexcept (FE_ALL_EXCEPT); + m = nextafterf (zero, inf); + if (m < 0.0 || m >= FLT_MIN) + { + puts ("nextafterf+ failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nextafterf+ did not underflow"); + ++result; + } + feclearexcept (FE_ALL_EXCEPT); + if (nextafterf (m, i) != 0.0) + { + puts ("nextafterf+ failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nextafterf+ did not underflow"); + ++result; + } + feclearexcept (FE_ALL_EXCEPT); + m = nextafterf (copysignf (zero, -1.0), -inf); + if (m > 0.0 || m <= -FLT_MIN) + { + puts ("nextafterf- failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nextafterf- did not underflow"); + ++result; + } + feclearexcept (FE_ALL_EXCEPT); + if (nextafterf (m, -i) != 0.0) + { + puts ("nextafterf- failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nextafterf- did not underflow"); + ++result; + } + double di = INFINITY; double dm = DBL_MAX; feclearexcept (FE_ALL_EXCEPT); @@ -59,5 +137,182 @@ main (void) ++result; } + di = 0; + dm = DBL_MIN; + feclearexcept (FE_ALL_EXCEPT); + di = nextafter (dm, di); + if (di < 0 || di >= DBL_MIN) + { + puts ("nextafter+ failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nextafter+ did not underflow"); + ++result; + } + di = 0; + feclearexcept (FE_ALL_EXCEPT); + di = nextafter (-dm, -di); + if (di > 0 || di <= -DBL_MIN) + { + puts ("nextafter- failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nextafter- did not underflow"); + ++result; + } + di = -INFINITY; + feclearexcept (FE_ALL_EXCEPT); + dm = nextafter (zero, inf); + if (dm < 0.0 || dm >= DBL_MIN) + { + puts ("nextafter+ failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nextafter+ did not underflow"); + ++result; + } + feclearexcept (FE_ALL_EXCEPT); + if (nextafter (dm, di) != 0.0) + { + puts ("nextafter+ failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nextafter+ did not underflow"); + ++result; + } + feclearexcept (FE_ALL_EXCEPT); + dm = nextafter (copysign (zero, -1.0), -inf); + if (dm > 0.0 || dm <= -DBL_MIN) + { + puts ("nextafter- failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nextafter- did not underflow"); + ++result; + } + feclearexcept (FE_ALL_EXCEPT); + if (nextafter (dm, -di) != 0.0) + { + puts ("nextafter- failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nextafter- did not underflow"); + ++result; + } + +#ifndef NO_LONG_DOUBLE + long double li = INFINITY; + long double lm = LDBL_MAX; + feclearexcept (FE_ALL_EXCEPT); + if (nextafterl (lm, li) != li) + { + puts ("nextafterl+ failed"); + ++result; + } + if (fetestexcept (FE_OVERFLOW) == 0) + { + puts ("nextafterl+ did not overflow"); + ++result; + } + feclearexcept (FE_ALL_EXCEPT); + if (nextafterl (-lm, -li) != -li) + { + puts ("nextafterl failed"); + ++result; + } + if (fetestexcept (FE_OVERFLOW) == 0) + { + puts ("nextafterl- did not overflow"); + ++result; + } + + li = 0; + lm = LDBL_MIN; + feclearexcept (FE_ALL_EXCEPT); + li = nextafterl (lm, li); + if (li < 0 || li >= LDBL_MIN) + { + puts ("nextafterl+ failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nextafterl+ did not underflow"); + ++result; + } + li = 0; + feclearexcept (FE_ALL_EXCEPT); + li = nextafterl (-lm, -li); + if (li > 0 || li <= -LDBL_MIN) + { + puts ("nextafterl- failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nextafterl- did not underflow"); + ++result; + } + li = -INFINITY; + feclearexcept (FE_ALL_EXCEPT); + lm = nextafterl (zero, inf); + if (lm < 0.0 || lm >= LDBL_MIN) + { + puts ("nextafterl+ failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nextafterl+ did not underflow"); + ++result; + } + feclearexcept (FE_ALL_EXCEPT); + if (nextafterl (lm, li) != 0.0) + { + puts ("nextafterl+ failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nextafterl+ did not underflow"); + ++result; + } + feclearexcept (FE_ALL_EXCEPT); + lm = nextafterl (copysign (zero, -1.0), -inf); + if (lm > 0.0 || lm <= -LDBL_MIN) + { + puts ("nextafterl- failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nextafterl- did not underflow"); + ++result; + } + feclearexcept (FE_ALL_EXCEPT); + if (nextafterl (lm, -li) != 0.0) + { + puts ("nextafterl- failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nextafterl- did not underflow"); + ++result; + } +#endif + return result; } diff --git a/math/bug-nexttoward.c b/math/bug-nexttoward.c index e306a129c2..ff57e5e3f5 100644 --- a/math/bug-nexttoward.c +++ b/math/bug-nexttoward.c @@ -4,6 +4,9 @@ #include #include +float zero = 0.0; +float inf = INFINITY; + int main (void) { @@ -35,6 +38,81 @@ main (void) ++result; } + fi = 0; + m = FLT_MIN; + feclearexcept (FE_ALL_EXCEPT); + fi = nexttowardf (m, fi); + if (fi < 0 || fi >= FLT_MIN) + { + puts ("nexttowardf+ failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nexttowardf+ did not underflow"); + ++result; + } + fi = 0; + feclearexcept (FE_ALL_EXCEPT); + fi = nexttowardf (-m, -fi); + if (fi > 0 || fi <= -FLT_MIN) + { + puts ("nexttowardf- failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nexttowardf- did not underflow"); + ++result; + } + fi = -INFINITY; + feclearexcept (FE_ALL_EXCEPT); + m = nexttowardf (zero, inf); + if (m < 0.0 || m >= FLT_MIN) + { + puts ("nexttowardf+ failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nexttowardf+ did not underflow"); + ++result; + } + feclearexcept (FE_ALL_EXCEPT); + if (nexttowardf (m, fi) != 0.0) + { + puts ("nexttowardf+ failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nexttowardf+ did not underflow"); + ++result; + } + feclearexcept (FE_ALL_EXCEPT); + m = nexttowardf (copysignf (zero, -1.0), -inf); + if (m > 0.0 || m <= -FLT_MIN) + { + puts ("nexttowardf- failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nexttowardf- did not underflow"); + ++result; + } + feclearexcept (FE_ALL_EXCEPT); + if (nexttowardf (m, -fi) != 0.0) + { + puts ("nexttowardf- failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nexttowardf- did not underflow"); + ++result; + } + tl = (long double) DBL_MAX + 1.0e305L; double di = INFINITY; double dm = DBL_MAX; @@ -61,5 +139,182 @@ main (void) ++result; } + di = 0; + dm = DBL_MIN; + feclearexcept (FE_ALL_EXCEPT); + di = nexttoward (dm, di); + if (di < 0 || di >= DBL_MIN) + { + puts ("nexttoward+ failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nexttoward+ did not underflow"); + ++result; + } + di = 0; + feclearexcept (FE_ALL_EXCEPT); + di = nexttoward (-dm, -di); + if (di > 0 || di <= -DBL_MIN) + { + puts ("nexttoward- failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nexttoward- did not underflow"); + ++result; + } + di = -INFINITY; + feclearexcept (FE_ALL_EXCEPT); + dm = nexttoward (zero, inf); + if (dm < 0.0 || dm >= DBL_MIN) + { + puts ("nexttoward+ failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nexttoward+ did not underflow"); + ++result; + } + feclearexcept (FE_ALL_EXCEPT); + if (nexttoward (dm, di) != 0.0) + { + puts ("nexttoward+ failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nexttoward+ did not underflow"); + ++result; + } + feclearexcept (FE_ALL_EXCEPT); + dm = nexttoward (copysign (zero, -1.0), -inf); + if (dm > 0.0 || dm <= -DBL_MIN) + { + puts ("nexttoward- failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nexttoward- did not underflow"); + ++result; + } + feclearexcept (FE_ALL_EXCEPT); + if (nexttoward (dm, -di) != 0.0) + { + puts ("nexttoward- failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nexttoward- did not underflow"); + ++result; + } + +#ifndef NO_LONG_DOUBLE + long double li = INFINITY; + long double lm = LDBL_MAX; + feclearexcept (FE_ALL_EXCEPT); + if (nexttowardl (lm, li) != li) + { + puts ("nexttowardl+ failed"); + ++result; + } + if (fetestexcept (FE_OVERFLOW) == 0) + { + puts ("nexttowardl+ did not overflow"); + ++result; + } + feclearexcept (FE_ALL_EXCEPT); + if (nexttowardl (-lm, -li) != -li) + { + puts ("nexttowardl failed"); + ++result; + } + if (fetestexcept (FE_OVERFLOW) == 0) + { + puts ("nexttowardl- did not overflow"); + ++result; + } + + li = 0; + lm = LDBL_MIN; + feclearexcept (FE_ALL_EXCEPT); + li = nexttowardl (lm, li); + if (li < 0 || li >= LDBL_MIN) + { + puts ("nexttowardl+ failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nexttowardl+ did not underflow"); + ++result; + } + li = 0; + feclearexcept (FE_ALL_EXCEPT); + li = nexttowardl (-lm, -li); + if (li > 0 || li <= -LDBL_MIN) + { + puts ("nexttowardl- failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nexttowardl- did not underflow"); + ++result; + } + li = -INFINITY; + feclearexcept (FE_ALL_EXCEPT); + lm = nexttowardl (zero, inf); + if (lm < 0.0 || lm >= LDBL_MIN) + { + puts ("nexttowardl+ failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nexttowardl+ did not underflow"); + ++result; + } + feclearexcept (FE_ALL_EXCEPT); + if (nexttowardl (lm, li) != 0.0) + { + puts ("nexttowardl+ failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nexttowardl+ did not underflow"); + ++result; + } + feclearexcept (FE_ALL_EXCEPT); + lm = nexttowardl (copysign (zero, -1.0), -inf); + if (lm > 0.0 || lm <= -LDBL_MIN) + { + puts ("nexttowardl- failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nexttowardl- did not underflow"); + ++result; + } + feclearexcept (FE_ALL_EXCEPT); + if (nexttowardl (lm, -li) != 0.0) + { + puts ("nexttowardl- failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nexttowardl- did not underflow"); + ++result; + } +#endif + return result; } diff --git a/math/cabsf.c b/math/cabsf.c new file mode 100644 index 0000000000..956db76ba1 --- /dev/null +++ b/math/cabsf.c @@ -0,0 +1,29 @@ +/* Return the complex absolute value of float complex value. + Copyright (C) 1997, 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + 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. */ + +#include +#include + +float +__cabsf (float _Complex z) +{ + return __hypotf (__real__ z, __imag__ z); +} +weak_alias (__cabsf, cabsf) diff --git a/math/cargf.c b/math/cargf.c new file mode 100644 index 0000000000..df1f20bc48 --- /dev/null +++ b/math/cargf.c @@ -0,0 +1,29 @@ +/* Compute argument of complex float value. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + 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. */ + +#include +#include + +float +__cargf (__complex__ float x) +{ + return __atan2f (__imag__ x, __real__ x); +} +weak_alias (__cargf, cargf) diff --git a/math/cimagf.c b/math/cimagf.c new file mode 100644 index 0000000000..d4e441e69f --- /dev/null +++ b/math/cimagf.c @@ -0,0 +1,28 @@ +/* Return imaginary part of complex float value. + Copyright (C) 1997, 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + 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. */ + +#include + +float +__cimagf (float _Complex z) +{ + return __imag__ z; +} +weak_alias (__cimagf, cimagf) diff --git a/math/complex.h b/math/complex.h index f005a93912..751aaf763f 100644 --- a/math/complex.h +++ b/math/complex.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998, 1999, 2000, 2006 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 @@ -84,7 +84,14 @@ __BEGIN_DECLS /* And the long double versions. It is non-critical to define them here unconditionally since `long double' is required in ISO C99. */ -#if __STDC__ - 0 || __GNUC__ - 0 && !defined __NO_LONG_DOUBLE_MATH +#if (__STDC__ - 0 || __GNUC__ - 0) \ + && (!defined __NO_LONG_DOUBLE_MATH || defined __LDBL_COMPAT) +# ifdef __LDBL_COMPAT +# undef __MATHDECL_1 +# define __MATHDECL_1(type, function, args) \ + extern type __REDIRECT_NTH(__MATH_PRECNAME(function), args, function) +# endif + # ifndef _Mlong_double_ # define _Mlong_double_ long double # endif diff --git a/math/conjf.c b/math/conjf.c new file mode 100644 index 0000000000..7893891933 --- /dev/null +++ b/math/conjf.c @@ -0,0 +1,28 @@ +/* Return complex conjugate of complex float value. + Copyright (C) 1997, 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + 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. */ + +#include + +float _Complex +__conjf (float _Complex z) +{ + return ~z; +} +weak_alias (__conjf, conjf) diff --git a/math/crealf.c b/math/crealf.c new file mode 100644 index 0000000000..e3235a874f --- /dev/null +++ b/math/crealf.c @@ -0,0 +1,28 @@ +/* Return real part of complex float value. + Copyright (C) 1997, 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + 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. */ + +#include + +float +__crealf (float _Complex z) +{ + return __real__ z; +} +weak_alias (__crealf, crealf) diff --git a/math/divtc3.c b/math/divtc3.c new file mode 100644 index 0000000000..d974ae6454 --- /dev/null +++ b/math/divtc3.c @@ -0,0 +1,75 @@ +/* Copyright (C) 2005, 2006 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson , 2005. + + 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. */ + +#include +#include +#include + +attribute_hidden +long double _Complex +__divtc3 (long double a, long double b, long double c, long double d) +{ + long double denom, ratio, x, y; + + /* ??? We can get better behavior from logarithmic scaling instead of + the division. But that would mean starting to link libgcc against + libm. We could implement something akin to ldexp/frexp as gcc builtins + fairly easily... */ + if (fabsl (c) < fabsl (d)) + { + ratio = c / d; + denom = (c * ratio) + d; + x = ((a * ratio) + b) / denom; + y = ((b * ratio) - a) / denom; + } + else + { + ratio = d / c; + denom = (d * ratio) + c; + x = ((b * ratio) + a) / denom; + y = (b - (a * ratio)) / denom; + } + + /* Recover infinities and zeros that computed as NaN+iNaN; the only cases + are nonzero/zero, infinite/finite, and finite/infinite. */ + if (isnan (x) && isnan (y)) + { + if (denom == 0.0 && (!isnan (a) || !isnan (b))) + { + x = __copysignl (INFINITY, c) * a; + y = __copysignl (INFINITY, c) * b; + } + else if ((isinf (a) || isinf (b)) && isfinite (c) && isfinite (d)) + { + a = __copysignl (isinf (a) ? 1 : 0, a); + b = __copysignl (isinf (b) ? 1 : 0, b); + x = INFINITY * (a * c + b * d); + y = INFINITY * (b * c - a * d); + } + else if ((isinf (c) || isinf (d)) && isfinite (a) && isfinite (b)) + { + c = __copysignl (isinf (c) ? 1 : 0, c); + d = __copysignl (isinf (d) ? 1 : 0, d); + x = 0.0 * (a * c + b * d); + y = 0.0 * (b * c - a * d); + } + } + + return x + I * y; +} diff --git a/math/e_acoshl.c b/math/e_acoshl.c new file mode 100644 index 0000000000..2c2fbe8eb4 --- /dev/null +++ b/math/e_acoshl.c @@ -0,0 +1,14 @@ +#include +#include +#include + +long double +__ieee754_acoshl (long double x) +{ + fputs ("__ieee754_acoshl not implemented\n", stderr); + __set_errno (ENOSYS); + return 0.0; +} + +stub_warning (acoshl) +#include diff --git a/math/e_acosl.c b/math/e_acosl.c new file mode 100644 index 0000000000..d844d885b8 --- /dev/null +++ b/math/e_acosl.c @@ -0,0 +1,14 @@ +#include +#include +#include + +long double +__ieee754_acosl (long double x) +{ + fputs ("__ieee754_acosl not implemented\n", stderr); + __set_errno (ENOSYS); + return 0.0; +} + +stub_warning (acosl) +#include diff --git a/math/e_asinl.c b/math/e_asinl.c new file mode 100644 index 0000000000..3b26f030ef --- /dev/null +++ b/math/e_asinl.c @@ -0,0 +1,14 @@ +#include +#include +#include + +long double +__ieee754_asinl (long double x) +{ + fputs ("__ieee754_asinl not implemented\n", stderr); + __set_errno (ENOSYS); + return 0.0; +} + +stub_warning (asinl) +#include diff --git a/math/e_atan2l.c b/math/e_atan2l.c new file mode 100644 index 0000000000..0caed8a32f --- /dev/null +++ b/math/e_atan2l.c @@ -0,0 +1,14 @@ +#include +#include +#include + +long double +__ieee754_atan2l (long double x, long double y) +{ + fputs ("__ieee754_atan2l not implemented\n", stderr); + __set_errno (ENOSYS); + return 0.0; +} + +stub_warning (atan2l) +#include diff --git a/math/e_atanhl.c b/math/e_atanhl.c new file mode 100644 index 0000000000..625d42db31 --- /dev/null +++ b/math/e_atanhl.c @@ -0,0 +1,14 @@ +#include +#include +#include + +long double +__ieee754_atanhl (long double x) +{ + fputs ("__ieee754_atanhl not implemented\n", stderr); + __set_errno (ENOSYS); + return 0.0; +} + +stub_warning (__ieee754_atanhl) +#include diff --git a/math/e_coshl.c b/math/e_coshl.c new file mode 100644 index 0000000000..0da319b785 --- /dev/null +++ b/math/e_coshl.c @@ -0,0 +1,14 @@ +#include +#include +#include + +long double +__ieee754_coshl (long double x) +{ + fputs ("__ieee754_coshl not implemented\n", stderr); + __set_errno (ENOSYS); + return 0.0; +} + +stub_warning (__ieee754_coshl) +#include diff --git a/math/e_exp10.c b/math/e_exp10.c new file mode 100644 index 0000000000..a3eccbb9e6 --- /dev/null +++ b/math/e_exp10.c @@ -0,0 +1,30 @@ +/* Copyright (C) 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1998. + + 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. */ + +#include +#include "math_private.h" + + +double +__ieee754_exp10 (double arg) +{ + /* This is a very stupid and inprecise implementation. It'll get + replaced sometime (soon?). */ + return __ieee754_exp (M_LN10 * arg); +} diff --git a/math/e_exp10f.c b/math/e_exp10f.c new file mode 100644 index 0000000000..7d06d074b8 --- /dev/null +++ b/math/e_exp10f.c @@ -0,0 +1,30 @@ +/* Copyright (C) 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1998. + + 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. */ + +#include +#include "math_private.h" + + +float +__ieee754_exp10f (float arg) +{ + /* This is a very stupid and inprecise implementation. It'll get + replaced sometime (soon?). */ + return __ieee754_expf (M_LN10 * arg); +} diff --git a/math/e_exp10l.c b/math/e_exp10l.c new file mode 100644 index 0000000000..56f0cfec2f --- /dev/null +++ b/math/e_exp10l.c @@ -0,0 +1,30 @@ +/* Copyright (C) 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1998. + + 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. */ + +#include +#include "math_private.h" + + +long double +__ieee754_exp10l (long double arg) +{ + /* This is a very stupid and inprecise implementation. It'll get + replaced sometime (soon?). */ + return __ieee754_expl (M_LN10l * arg); +} diff --git a/math/e_exp2l.c b/math/e_exp2l.c new file mode 100644 index 0000000000..7e598d8d2d --- /dev/null +++ b/math/e_exp2l.c @@ -0,0 +1,10 @@ +#include +#include "math_private.h" + +long double +__ieee754_exp2l (long double x) +{ + /* This is a very stupid and inprecise implementation. It'll get + replaced sometime (soon?). */ + return __ieee754_expl (M_LN2l * x); +} diff --git a/math/e_expl.c b/math/e_expl.c new file mode 100644 index 0000000000..f9467c38ab --- /dev/null +++ b/math/e_expl.c @@ -0,0 +1,14 @@ +#include +#include +#include + +long double +__ieee754_expl (long double x) +{ + fputs ("__ieee754_expl not implemented\n", stderr); + __set_errno (ENOSYS); + return 0.0; +} + +stub_warning (expl) +#include diff --git a/math/e_fmodl.c b/math/e_fmodl.c new file mode 100644 index 0000000000..380da24e41 --- /dev/null +++ b/math/e_fmodl.c @@ -0,0 +1,14 @@ +#include +#include +#include + +long double +__ieee754_fmodl (long double x, long double y) +{ + fputs ("__ieee754_fmodl not implemented\n", stderr); + __set_errno (ENOSYS); + return 0.0; +} + +stub_warning (fmodl) +#include diff --git a/math/e_gammal_r.c b/math/e_gammal_r.c new file mode 100644 index 0000000000..1c45c8421b --- /dev/null +++ b/math/e_gammal_r.c @@ -0,0 +1,15 @@ +#include +#include +#include + +long double +__ieee754_gammal_r (long double x, int *signgamp) +{ + *signgamp = 0; + fputs ("__ieee754_gammal_r not implemented\n", stderr); + __set_errno (ENOSYS); + return 0.0; +} + +stub_warning (__ieee754_gammal_r) +#include diff --git a/math/e_hypotl.c b/math/e_hypotl.c new file mode 100644 index 0000000000..07df22eb36 --- /dev/null +++ b/math/e_hypotl.c @@ -0,0 +1,14 @@ +#include +#include +#include + +long double +__ieee754_hypotl (long double x, long double y) +{ + fputs ("__ieee754_hypotl not implemented\n", stderr); + __set_errno (ENOSYS); + return 0.0; +} + +stub_warning (__ieee754_hypotl) +#include diff --git a/math/e_j0l.c b/math/e_j0l.c new file mode 100644 index 0000000000..1bf0a1de73 --- /dev/null +++ b/math/e_j0l.c @@ -0,0 +1,25 @@ +#include +#include +#include +#include "math_private.h" + +long double +__ieee754_j0l (long double x) +{ + fputs ("__ieee754_j0l not implemented\n", stderr); + __set_errno (ENOSYS); + return 0.0; +} + +stub_warning (j0l) + +long double +__ieee754_y0l (long double x) +{ + fputs ("__ieee754_y0l not implemented\n", stderr); + __set_errno (ENOSYS); + return 0.0; +} + +stub_warning (y0l) +#include diff --git a/math/e_j1l.c b/math/e_j1l.c new file mode 100644 index 0000000000..656abeba57 --- /dev/null +++ b/math/e_j1l.c @@ -0,0 +1,25 @@ +#include +#include +#include +#include "math_private.h" + +long double +__ieee754_j1l (long double x) +{ + fputs ("__ieee754_j1l not implemented\n", stderr); + __set_errno (ENOSYS); + return 0.0; +} + +stub_warning (j1l) + +long double +__ieee754_y1l (long double x) +{ + fputs ("__ieee754_y1l not implemented\n", stderr); + __set_errno (ENOSYS); + return 0.0; +} + +stub_warning (y1l) +#include diff --git a/math/e_jnl.c b/math/e_jnl.c new file mode 100644 index 0000000000..1bfc0695a5 --- /dev/null +++ b/math/e_jnl.c @@ -0,0 +1,25 @@ +#include +#include +#include +#include "math_private.h" + +long double +__ieee754_jnl (int n, long double x) +{ + fputs ("__ieee754_jnl not implemented\n", stderr); + __set_errno (ENOSYS); + return 0.0; +} + +stub_warning (jnl) + +long double +__ieee754_ynl (int n, long double x) +{ + fputs ("__ieee754_ynl not implemented\n", stderr); + __set_errno (ENOSYS); + return 0.0; +} + +stub_warning (ynl) +#include diff --git a/math/e_lgammal_r.c b/math/e_lgammal_r.c new file mode 100644 index 0000000000..1784b2663f --- /dev/null +++ b/math/e_lgammal_r.c @@ -0,0 +1,17 @@ +#include +#include +#include +#include "math_private.h" + +long double +__ieee754_lgammal_r (long double x, int *signgamp) +{ + *signgamp = 0; + fputs ("__ieee754_lgammal_r not implemented\n", stderr); + __set_errno (ENOSYS); + return 0.0; +} + +stub_warning (lgammal) +stub_warning (lgammal_r) +#include diff --git a/math/e_log10l.c b/math/e_log10l.c new file mode 100644 index 0000000000..5bc264b32c --- /dev/null +++ b/math/e_log10l.c @@ -0,0 +1,14 @@ +#include +#include +#include + +long double +__ieee754_log10l (long double x) +{ + fputs ("__ieee754_log10l not implemented\n", stderr); + __set_errno (ENOSYS); + return 0.0; +} + +stub_warning (log10l) +#include diff --git a/math/e_log2l.c b/math/e_log2l.c new file mode 100644 index 0000000000..681904bfbb --- /dev/null +++ b/math/e_log2l.c @@ -0,0 +1,14 @@ +#include +#include +#include + +long double +__ieee754_log2l (long double x) +{ + fputs ("__ieee754_log2l not implemented\n", stderr); + __set_errno (ENOSYS); + return 0.0; +} + +stub_warning (log2l) +#include diff --git a/math/e_logl.c b/math/e_logl.c new file mode 100644 index 0000000000..9ba9cfc799 --- /dev/null +++ b/math/e_logl.c @@ -0,0 +1,14 @@ +#include +#include +#include + +long double +__ieee754_logl (long double x) +{ + fputs ("__ieee754_logl not implemented\n", stderr); + __set_errno (ENOSYS); + return 0.0; +} + +stub_warning (logl) +#include diff --git a/math/e_powl.c b/math/e_powl.c new file mode 100644 index 0000000000..afc2248b6b --- /dev/null +++ b/math/e_powl.c @@ -0,0 +1,14 @@ +#include +#include +#include + +long double +__ieee754_powl (long double x, long double y) +{ + fputs ("__ieee754_powl not implemented\n", stderr); + __set_errno (ENOSYS); + return 0.0; +} + +stub_warning (powl) +#include diff --git a/math/e_rem_pio2l.c b/math/e_rem_pio2l.c new file mode 100644 index 0000000000..617215516b --- /dev/null +++ b/math/e_rem_pio2l.c @@ -0,0 +1,15 @@ +#include +#include +#include +#include "math_private.h" + +int +__ieee754_rem_pio2l (long double x, long double *y) +{ + fputs ("__ieee754_rem_pio2l not implemented\n", stderr); + __set_errno (ENOSYS); + return 0; +} + +stub_warning (__ieee754_rem_pio2l) +#include diff --git a/math/e_scalb.c b/math/e_scalb.c new file mode 100644 index 0000000000..606af53724 --- /dev/null +++ b/math/e_scalb.c @@ -0,0 +1,71 @@ +/* @(#)e_scalb.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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: e_scalb.c,v 1.6 1995/05/10 20:46:09 jtc Exp $"; +#endif + +/* + * __ieee754_scalb(x, fn) is provide for + * passing various standard test suite. One + * should use scalbn() instead. + */ + +#include +#include +#include "math_private.h" + +#ifdef _SCALB_INT +#ifdef __STDC__ + double __ieee754_scalb(double x, int fn) +#else + double __ieee754_scalb(x,fn) + double x; int fn; +#endif +#else +#ifdef __STDC__ + double __ieee754_scalb(double x, double fn) +#else + double __ieee754_scalb(x,fn) + double x, fn; +#endif +#endif +{ +#ifdef _SCALB_INT + return __scalbn(x,fn); +#else + if (__isnan(x)||__isnan(fn)) return x*fn; + if (!__finite(fn)) { + if(fn>0.0) return x*fn; + else if (x == 0) + return x; + else if (!__finite (x)) + { +# ifdef FE_INVALID + feraiseexcept (FE_INVALID); +# endif + return __nan (""); + } + else return x/(-fn); + } + if (__rint(fn)!=fn) + { +# ifdef FE_INVALID + feraiseexcept (FE_INVALID); +# endif + return __nan (""); + } + if ( fn > 65000.0) return __scalbn(x, 65000); + if (-fn > 65000.0) return __scalbn(x,-65000); + return __scalbn(x,(int)fn); +#endif +} diff --git a/math/e_scalbf.c b/math/e_scalbf.c new file mode 100644 index 0000000000..95a72eb56d --- /dev/null +++ b/math/e_scalbf.c @@ -0,0 +1,68 @@ +/* e_scalbf.c -- float version of e_scalb.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: e_scalbf.c,v 1.3 1995/05/10 20:46:12 jtc Exp $"; +#endif + +#include +#include +#include "math_private.h" + +#ifdef _SCALB_INT +#ifdef __STDC__ + float __ieee754_scalbf(float x, int fn) +#else + float __ieee754_scalbf(x,fn) + float x; int fn; +#endif +#else +#ifdef __STDC__ + float __ieee754_scalbf(float x, float fn) +#else + float __ieee754_scalbf(x,fn) + float x, fn; +#endif +#endif +{ +#ifdef _SCALB_INT + return __scalbnf(x,fn); +#else + if (__isnanf(x)||__isnanf(fn)) return x*fn; + if (!__finitef(fn)) { + if(fn>(float)0.0) return x*fn; + else if (x == 0) + return x; + else if (!__finitef (x)) + { +# ifdef FE_INVALID + feraiseexcept (FE_INVALID); +# endif + return __nanf (""); + } + else return x/(-fn); + } + if (__rintf(fn)!=fn) + { +# ifdef FE_INVALID + feraiseexcept (FE_INVALID); +# endif + return __nanf (""); + } + if ( fn > (float)65000.0) return __scalbnf(x, 65000); + if (-fn > (float)65000.0) return __scalbnf(x,-65000); + return __scalbnf(x,(int)fn); +#endif +} diff --git a/math/e_scalbl.c b/math/e_scalbl.c new file mode 100644 index 0000000000..1f5677d9f4 --- /dev/null +++ b/math/e_scalbl.c @@ -0,0 +1,75 @@ +/* e_scalbl.c -- long double version of s_scalb.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: $"; +#endif + +/* + * __ieee754_scalbl(x, fn) is provide for + * passing various standard test suite. One + * should use scalbnl() instead. + */ + +#include +#include +#include "math_private.h" + +#ifdef _SCALB_INT +#ifdef __STDC__ + long double __ieee754_scalbl(long double x, int fn) +#else + long double __ieee754_scalbl(x,fn) + long double x; int fn; +#endif +#else +#ifdef __STDC__ + long double __ieee754_scalbl(long double x, long double fn) +#else + long double __ieee754_scalbl(x,fn) + long double x, fn; +#endif +#endif +{ +#ifdef _SCALB_INT + return __scalbnl(x,fn); +#else + if (__isnanl(x)||__isnanl(fn)) return x*fn; + if (!__finitel(fn)) { + if(fn>0.0) return x*fn; + else if (x == 0) + return x; + else if (!__finitel (x)) + { +# ifdef FE_INVALID + feraiseexcept (FE_INVALID); +# endif + return __nanl (""); + } + else return x/(-fn); + } + if (__rintl(fn)!=fn) + { +# ifdef FE_INVALID + feraiseexcept (FE_INVALID); +# endif + return __nanl (""); + } + if ( fn > 65000.0) return __scalbnl(x, 65000); + if (-fn > 65000.0) return __scalbnl(x,-65000); + return __scalbnl(x,(int)fn); +#endif +} diff --git a/math/e_sinhl.c b/math/e_sinhl.c new file mode 100644 index 0000000000..4cec79cb2d --- /dev/null +++ b/math/e_sinhl.c @@ -0,0 +1,14 @@ +#include +#include +#include + +long double +__ieee754_sinhl (long double x) +{ + fputs ("__ieee754_sinhl not implemented\n", stderr); + __set_errno (ENOSYS); + return 0.0; +} + +stub_warning (__ieee754_sinhl) +#include diff --git a/math/e_sqrtl.c b/math/e_sqrtl.c new file mode 100644 index 0000000000..7680bdb145 --- /dev/null +++ b/math/e_sqrtl.c @@ -0,0 +1,14 @@ +#include +#include +#include + +long double +__ieee754_sqrtl (long double x) +{ + fputs ("__ieee754_sqrtl not implemented\n", stderr); + __set_errno (ENOSYS); + return 0.0; +} + +stub_warning (sqrtl) +#include diff --git a/math/fclrexcpt.c b/math/fclrexcpt.c new file mode 100644 index 0000000000..560e326ee3 --- /dev/null +++ b/math/fclrexcpt.c @@ -0,0 +1,37 @@ +/* Clear given exceptions in current floating-point environment. + Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + 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