summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/libm/Makefile10
-rw-r--r--lib/libm/noieee_src/n_scalbln.c31
-rw-r--r--lib/libm/shlib_version2
-rw-r--r--lib/libm/src/s_scalbln.c42
4 files changed, 80 insertions, 5 deletions
diff --git a/lib/libm/Makefile b/lib/libm/Makefile
index 46cec8c24ab..98374352f90 100644
--- a/lib/libm/Makefile
+++ b/lib/libm/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.67 2009/07/15 20:08:43 martynas Exp $
+# $OpenBSD: Makefile,v 1.68 2009/07/25 11:38:10 martynas Exp $
# $NetBSD: Makefile,v 1.28 1995/11/20 22:06:19 jtc Exp $
#
# @(#)Makefile 5.1beta 93/09/24
@@ -100,7 +100,8 @@ COMMON_SRCS = b_exp__D.c b_log__D.c b_tgamma.c \
s_lrintf.c s_modff.c s_nan.c \
s_nextafter.c s_nextafterf.c s_remquo.c s_remquof.c s_rint.c \
s_rintf.c s_round.c s_roundf.c \
- s_scalbn.c s_scalbnf.c s_signgam.c s_significand.c s_significandf.c \
+ s_scalbln.c s_scalbn.c s_scalbnf.c s_signgam.c s_significand.c \
+ s_significandf.c \
s_sin.c s_sinf.c s_tan.c s_tanf.c s_tanh.c s_tanhf.c s_trunc.c \
s_truncf.c w_drem.c w_dremf.c w_gamma.c w_gamma_r.c w_gammaf.c \
w_gammaf_r.c w_lgamma.c w_lgammaf.c
@@ -122,8 +123,9 @@ NOIEEE_SRCS = n_acosh.c n_argred.c n_asincos.c n_asinh.c n_atan.c \
n_erf.c n_exp.c n_exp__E.c n_expm1.c n_fdim.c n_floor.c \
n_fmax.c n_fmaxf.c n_fmin.c n_fminf.c n_fmod.c n_hypot.c \
n_infnan.c n_j0.c n_j1.c n_jn.c n_lgamma.c n_log.c n_log10.c \
- n_log1p.c n_log__L.c n_nan.c n_pow.c n_round.c n_sincos.c n_sinh.c \
- n_sqrt.c n_support.c n_tan.c n_tanh.c n_tgamma.c
+ n_log1p.c n_log__L.c n_nan.c n_pow.c n_round.c n_scalbln.c \
+ n_sincos.c n_sinh.c n_sqrt.c n_support.c n_tan.c n_tanh.c \
+ n_tgamma.c
# OpenBSD's C library supplies these functions:
#COMMON_SRCS+= s_fabs.c s_frexp.c s_modf.c
diff --git a/lib/libm/noieee_src/n_scalbln.c b/lib/libm/noieee_src/n_scalbln.c
new file mode 100644
index 00000000000..c1fd86a4682
--- /dev/null
+++ b/lib/libm/noieee_src/n_scalbln.c
@@ -0,0 +1,31 @@
+/* $OpenBSD: n_scalbln.c,v 1.1 2009/07/25 11:38:10 martynas Exp $ */
+
+/*
+ * Written by Martynas Venckus. Public domain
+ */
+
+#include <limits.h>
+#include <math.h>
+
+double
+scalbln(double x, long n)
+{
+ if (n < INT_MIN)
+ return scalbn(x, INT_MIN);
+ else if (n > INT_MAX)
+ return scalbn(x, INT_MAX);
+ else
+ return scalbn(x, (int)n);
+}
+
+long double
+scalblnl(long double x, long n)
+{
+ if (n < INT_MIN)
+ return scalbnl(x, INT_MIN);
+ else if (n > INT_MAX)
+ return scalbnl(x, INT_MAX);
+ else
+ return scalbnl(x, (int)n);
+}
+
diff --git a/lib/libm/shlib_version b/lib/libm/shlib_version
index 3066b9771e7..900b4048a96 100644
--- a/lib/libm/shlib_version
+++ b/lib/libm/shlib_version
@@ -1,2 +1,2 @@
major=5
-minor=0
+minor=1
diff --git a/lib/libm/src/s_scalbln.c b/lib/libm/src/s_scalbln.c
new file mode 100644
index 00000000000..28edf3115a4
--- /dev/null
+++ b/lib/libm/src/s_scalbln.c
@@ -0,0 +1,42 @@
+/* $OpenBSD: s_scalbln.c,v 1.1 2009/07/25 11:38:10 martynas Exp $ */
+
+/*
+ * Written by Martynas Venckus. Public domain
+ */
+
+#include <limits.h>
+#include <math.h>
+
+double
+scalbln(double x, long n)
+{
+ if (n < INT_MIN)
+ return scalbn(x, INT_MIN);
+ else if (n > INT_MAX)
+ return scalbn(x, INT_MAX);
+ else
+ return scalbn(x, (int)n);
+}
+
+float
+scalblnf(float x, long n)
+{
+ if (n < INT_MIN)
+ return scalbnf(x, INT_MIN);
+ else if (n > INT_MAX)
+ return scalbnf(x, INT_MAX);
+ else
+ return scalbnf(x, (int)n);
+}
+
+long double
+scalblnl(long double x, long n)
+{
+ if (n < INT_MIN)
+ return scalbnl(x, INT_MIN);
+ else if (n > INT_MAX)
+ return scalbnl(x, INT_MAX);
+ else
+ return scalbnl(x, (int)n);
+}
+