summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/math.h8
-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
5 files changed, 81 insertions, 12 deletions
diff --git a/include/math.h b/include/math.h
index a51e4d3598b..2d9d4333110 100644
--- a/include/math.h
+++ b/include/math.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: math.h,v 1.25 2009/04/08 23:09:50 martynas Exp $ */
+/* $OpenBSD: math.h,v 1.26 2009/07/25 11:38:09 martynas Exp $ */
/*
* ====================================================
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
@@ -180,9 +180,7 @@ double log1p(double);
double log2(double);
double logb(double);
double scalbn(double, int);
-#if 0
double scalbln(double, long int);
-#endif
double cbrt(double);
double hypot(double, double);
@@ -288,9 +286,7 @@ float log2f(float);
float logbf(float);
float modff(float, float *);
float scalbnf(float, int);
-#if 0
float scalblnf(float, long int);
-#endif
float cbrtf(float);
float fabsf(float);
@@ -415,9 +411,7 @@ long double logbl(long double);
long double modfl(long double, long double *);
#endif
long double scalbnl(long double, int);
-#if 0
long double scalblnl(long double, long int);
-#endif
#if 0
long double cbrtl(long double);
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);
+}
+