aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/libm-ieee754
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/libm-ieee754')
-rw-r--r--sysdeps/libm-ieee754/e_exp10.c29
-rw-r--r--sysdeps/libm-ieee754/e_exp10f.c29
-rw-r--r--sysdeps/libm-ieee754/e_exp10l.c29
-rw-r--r--sysdeps/libm-ieee754/k_standard.c40
-rw-r--r--sysdeps/libm-ieee754/w_exp10.c59
-rw-r--r--sysdeps/libm-ieee754/w_exp10f.c57
-rw-r--r--sysdeps/libm-ieee754/w_exp10l.c56
7 files changed, 296 insertions, 3 deletions
diff --git a/sysdeps/libm-ieee754/e_exp10.c b/sysdeps/libm-ieee754/e_exp10.c
new file mode 100644
index 0000000..3b36764
--- /dev/null
+++ b/sysdeps/libm-ieee754/e_exp10.c
@@ -0,0 +1,29 @@
+/* Copyright (C) 1998 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 Library General Public License as
+ published by the Free Software Foundation; either version 2 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <math.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/sysdeps/libm-ieee754/e_exp10f.c b/sysdeps/libm-ieee754/e_exp10f.c
new file mode 100644
index 0000000..200eecd
--- /dev/null
+++ b/sysdeps/libm-ieee754/e_exp10f.c
@@ -0,0 +1,29 @@
+/* Copyright (C) 1998 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 Library General Public License as
+ published by the Free Software Foundation; either version 2 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <math.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/sysdeps/libm-ieee754/e_exp10l.c b/sysdeps/libm-ieee754/e_exp10l.c
new file mode 100644
index 0000000..e2820d2
--- /dev/null
+++ b/sysdeps/libm-ieee754/e_exp10l.c
@@ -0,0 +1,29 @@
+/* Copyright (C) 1998 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 Library General Public License as
+ published by the Free Software Foundation; either version 2 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <math.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/sysdeps/libm-ieee754/k_standard.c b/sysdeps/libm-ieee754/k_standard.c
index 6c410c4..aeaa50f 100644
--- a/sysdeps/libm-ieee754/k_standard.c
+++ b/sysdeps/libm-ieee754/k_standard.c
@@ -83,6 +83,8 @@ static double zero = 0.0; /* used as const */
* 43-- +0**neg
* 44-- exp2 overflow
* 45-- exp2 underflow
+ * 46-- exp10 overflow
+ * 47-- exp10 underflow
*/
@@ -874,7 +876,7 @@ static double zero = 0.0; /* used as const */
/* exp(finite) overflow */
exc.type = OVERFLOW;
exc.name = type < 100 ? "exp2" : (type < 200
- ? "exp2f" : "exp2l");
+ ? "exp2f" : "exp2l");
if (_LIB_VERSION == _SVID_)
exc.retval = HUGE;
else
@@ -891,7 +893,7 @@ static double zero = 0.0; /* used as const */
/* exp(finite) underflow */
exc.type = UNDERFLOW;
exc.name = type < 100 ? "exp2" : (type < 200
- ? "exp2f" : "exp2l");
+ ? "exp2f" : "exp2l");
exc.retval = zero;
if (_LIB_VERSION == _POSIX_)
__set_errno (ERANGE);
@@ -899,7 +901,39 @@ static double zero = 0.0; /* used as const */
__set_errno (ERANGE);
}
break;
- /* #### Last used is 44/144/244 ### */
+
+ case 46:
+ case 146:
+ case 246:
+ /* exp(finite) overflow */
+ exc.type = OVERFLOW;
+ exc.name = type < 100 ? "exp10" : (type < 200
+ ? "exp10f" : "exp10l");
+ 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);
+ }
+ break;
+ case 47:
+ case 147:
+ case 247:
+ /* exp(finite) underflow */
+ exc.type = UNDERFLOW;
+ exc.name = type < 100 ? "exp10" : (type < 200
+ ? "exp10f" : "exp10l");
+ exc.retval = zero;
+ if (_LIB_VERSION == _POSIX_)
+ __set_errno (ERANGE);
+ else if (!matherr(&exc)) {
+ __set_errno (ERANGE);
+ }
+ break;
+ /* #### Last used is 47/147/247 ### */
}
return exc.retval;
}
diff --git a/sysdeps/libm-ieee754/w_exp10.c b/sysdeps/libm-ieee754/w_exp10.c
new file mode 100644
index 0000000..cb27159
--- /dev/null
+++ b/sysdeps/libm-ieee754/w_exp10.c
@@ -0,0 +1,59 @@
+/* @(#)w_exp10.c
+ * Conversion to exp10 by Ulrich Drepper <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.
+ * ====================================================
+ */
+
+/*
+ * wrapper exp10(x)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+static const double
+#else
+static double
+#endif
+o_threshold= 3.0825471555991674389672e+02,
+u_threshold= -3.2360724533877978485251e+02;
+
+#ifdef __STDC__
+ double __exp10(double x) /* wrapper exp10 */
+#else
+ double __exp10(x) /* wrapper exp10 */
+ double x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_exp10(x);
+#else
+ double z;
+ z = __ieee754_exp10(x);
+ if(_LIB_VERSION == _IEEE_) return z;
+ if(__finite(x)) {
+ if(x>o_threshold)
+ return __kernel_standard(x,x,46); /* exp10 overflow */
+ else if(x<u_threshold)
+ return __kernel_standard(x,x,47); /* exp10 underflow */
+ }
+ return z;
+#endif
+}
+weak_alias (__exp10, exp10)
+strong_alias (__exp10, __pow10)
+weak_alias (__pow10, pow10)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__exp10, __exp10l)
+weak_alias (__exp10, exp10l)
+strong_alias (__exp10l, __pow10l)
+weak_alias (__pow10l, pow10l)
+#endif
diff --git a/sysdeps/libm-ieee754/w_exp10f.c b/sysdeps/libm-ieee754/w_exp10f.c
new file mode 100644
index 0000000..f78be79
--- /dev/null
+++ b/sysdeps/libm-ieee754/w_exp10f.c
@@ -0,0 +1,57 @@
+/* w_exp10f.c -- float version of w_exp10.c.
+ * Conversion to exp10 by Ulrich Drepper <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.
+ * ====================================================
+ */
+
+/*
+ * wrapper expf10(x)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+static const float
+#else
+static float
+#endif
+o_threshold= 3.853183944498959298709e+01,
+u_threshold= -4.515449934959717928174e+01;
+
+#ifdef __STDC__
+ float __exp10f(float x) /* wrapper exp10f */
+#else
+ float __exp10f(x) /* wrapper exp10f */
+ float x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_exp10f(x);
+#else
+ float z;
+ z = __ieee754_exp10f(x);
+ if(_LIB_VERSION == _IEEE_) return z;
+ if(__finitef(x)) {
+ if(x>o_threshold)
+ /* exp overflow */
+ return (float)__kernel_standard((double)x,(double)x,146);
+ else if(x<u_threshold)
+ /* exp underflow */
+ return (float)__kernel_standard((double)x,(double)x,147);
+ }
+ return z;
+#endif
+}
+weak_alias (__exp10f, exp10f)
+strong_alias (__exp10f, __pow10f)
+weak_alias (__pow10f, pow10f)
diff --git a/sysdeps/libm-ieee754/w_exp10l.c b/sysdeps/libm-ieee754/w_exp10l.c
new file mode 100644
index 0000000..7117873
--- /dev/null
+++ b/sysdeps/libm-ieee754/w_exp10l.c
@@ -0,0 +1,56 @@
+/* w_exp10l.c -- long double version of w_exp10.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.
+ * ====================================================
+ */
+
+/*
+ * wrapper exp10l(x)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+static const long double
+#else
+static long double
+#endif
+o_threshold= 4.93207544895866790234755e+03,
+u_threshold= -4.95104033868549871764588e+03;
+
+#ifdef __STDC__
+ long double __exp10l(long double x) /* wrapper exp10 */
+#else
+ long double __exp10l(x) /* wrapper exp10 */
+ long double x;
+#endif
+{
+#ifdef _IEEE_LIBM
+ return __ieee754_exp10l(x);
+#else
+ long double z;
+ z = __ieee754_exp10l(x);
+ if(_LIB_VERSION == _IEEE_) return z;
+ if(__finitel(x)) {
+ if(x>o_threshold)
+ return __kernel_standard(x,x,246); /* exp10 overflow */
+ else if(x<u_threshold)
+ return __kernel_standard(x,x,247); /* exp10 underflow */
+ }
+ return z;
+#endif
+}
+weak_alias (__exp10l, exp10l)
+strong_alias (__exp10l, __pow10l)
+weak_alias (__pow10l, pow10l)