summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libc/sysdeps/linux/common/bits/mathcalls.h6
-rw-r--r--libm/Makefile.in4
-rw-r--r--libm/e_exp10.c33
-rw-r--r--libm/math_private.h1
4 files changed, 39 insertions, 5 deletions
diff --git a/libc/sysdeps/linux/common/bits/mathcalls.h b/libc/sysdeps/linux/common/bits/mathcalls.h
index 9bebb5190..8ab807578 100644
--- a/libc/sysdeps/linux/common/bits/mathcalls.h
+++ b/libc/sysdeps/linux/common/bits/mathcalls.h
@@ -145,11 +145,11 @@ __MATHCALLI (log10,, (_Mdouble_ __x))
__MATHCALLI (modf,, (_Mdouble_ __x, _Mdouble_ *__iptr))
_Mdouble_END_NAMESPACE
-#if 0 /*def __USE_GNU*/
+#if defined __USE_GNU
/* A function missing in all standards: compute exponent to base ten. */
-__MATHCALL (exp10,, (_Mdouble_ __x))
+__MATHCALLI (exp10,, (_Mdouble_ __x))
/* Another name occasionally used. */
-__MATHCALL (pow10,, (_Mdouble_ __x))
+__MATHCALLI (pow10,, (_Mdouble_ __x))
#endif
#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
diff --git a/libm/Makefile.in b/libm/Makefile.in
index d886cdbc5..f0e552880 100644
--- a/libm/Makefile.in
+++ b/libm/Makefile.in
@@ -56,7 +56,7 @@ LD_MSRC := ldouble_wrappers.c
ifeq ($(DO_C99_MATH),y)
libm_CSRC := \
e_acos.c e_acosh.c e_asin.c e_atan2.c e_atanh.c e_cosh.c \
- e_exp.c e_fmod.c e_hypot.c \
+ e_exp.c e_exp10.c e_fmod.c e_hypot.c \
e_lgamma_r.c e_log.c e_log2.c e_log10.c \
e_pow.c e_remainder.c e_rem_pio2.c e_scalb.c e_sinh.c \
e_sqrt.c k_cos.c k_rem_pio2.c k_sin.c k_standard.c k_tan.c \
@@ -238,7 +238,7 @@ libm_CSRC := \
s_expm1.c s_scalbn.c s_copysign.c e_acos.c e_asin.c e_atan2.c \
k_cos.c e_cosh.c e_exp.c e_fmod.c e_log.c e_log10.c e_pow.c \
k_sin.c e_sinh.c e_sqrt.c k_tan.c e_rem_pio2.c k_rem_pio2.c \
- s_finite.c
+ s_finite.c e_exp10.c
# We'll add sqrtf to avoid problems with libstdc++
FL_MOBJ := sqrtf.o
endif
diff --git a/libm/e_exp10.c b/libm/e_exp10.c
new file mode 100644
index 000000000..f0ee87809
--- /dev/null
+++ b/libm/e_exp10.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 1998-2015 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#include "math.h"
+#include "math_private.h"
+#include <float.h>
+
+double __ieee754_exp10 (double arg)
+{
+ if (isfinite (arg) && arg < DBL_MIN_10_EXP - DBL_DIG - 10)
+ return DBL_MIN * DBL_MIN;
+ else
+ /* This is a very stupid and inprecise implementation. It'll get
+ replaced sometime (soon?). */
+ return __ieee754_exp (M_LN10 * arg);
+}
+strong_alias(__ieee754_exp10, exp10)
+libm_hidden_def(exp10)
diff --git a/libm/math_private.h b/libm/math_private.h
index be8031ef8..b62dcfe1a 100644
--- a/libm/math_private.h
+++ b/libm/math_private.h
@@ -158,6 +158,7 @@ extern double __ieee754_atanh (double) attribute_hidden;
extern double __ieee754_asin (double) attribute_hidden;
extern double __ieee754_atan2 (double,double) attribute_hidden;
extern double __ieee754_exp (double) attribute_hidden;
+extern double __ieee754_exp10 (double) attribute_hidden;
extern double __ieee754_cosh (double) attribute_hidden;
extern double __ieee754_fmod (double,double) attribute_hidden;
extern double __ieee754_pow (double,double) attribute_hidden;