From aec561acc50c78a9cbe2cc567c1ce6ddbd0a365c Mon Sep 17 00:00:00 2001 From: Erik van der Kouwe Date: Fri, 8 Jan 2010 07:27:54 +0000 Subject: [PATCH] Add scalbn family of functions --- include/math.h | 4 ++++ lib/math/Makefile.in | 1 + lib/math/scalbn.c | 22 ++++++++++++++++++++++ man/man3/ldexp.3 | 19 +++++++++++++++++++ 4 files changed, 46 insertions(+) create mode 100644 lib/math/scalbn.c create mode 100644 man/man3/ldexp.3 diff --git a/include/math.h b/include/math.h index 81778e429..264fe0f73 100644 --- a/include/math.h +++ b/include/math.h @@ -34,6 +34,10 @@ _PROTOTYPE( double log10, (double _x) ); _PROTOTYPE( double modf, (double _x, double *_iptr) ); _PROTOTYPE( double pow, (double _x, double _y) ); _PROTOTYPE( double rint, (double _x) ); +_PROTOTYPE( double scalbn, (double _x, int _exp) ); +_PROTOTYPE( float scalbnf, (float _x, int _exp) ); +_PROTOTYPE( double scalbln, (double _x, long _exp) ); +_PROTOTYPE( float scalblnf, (float _x, long _exp) ); _PROTOTYPE( double sin, (double _x) ); _PROTOTYPE( double sinh, (double _x) ); _PROTOTYPE( double sqrt, (double _x) ); diff --git a/lib/math/Makefile.in b/lib/math/Makefile.in index 434ca242e..3d949b73f 100644 --- a/lib/math/Makefile.in +++ b/lib/math/Makefile.in @@ -19,6 +19,7 @@ libc_FILES=" \ log10.c \ pow.c \ s_rint.c \ + scalbn.c \ sin.c \ sinh.c \ sqrt.c \ diff --git a/lib/math/scalbn.c b/lib/math/scalbn.c new file mode 100644 index 000000000..311c40e01 --- /dev/null +++ b/lib/math/scalbn.c @@ -0,0 +1,22 @@ +#include + +double scalbln(double x, long n) +{ + return ldexp(x, n); +} + +float scalblnf(float x, long n) +{ + return ldexp(x, n); +} + +double scalbn(double x, int n) +{ + return ldexp(x, n); +} + +float scalbnf(float x, int n) +{ + return ldexp(x, n); +} + diff --git a/man/man3/ldexp.3 b/man/man3/ldexp.3 new file mode 100644 index 000000000..87792d487 --- /dev/null +++ b/man/man3/ldexp.3 @@ -0,0 +1,19 @@ +.TH LDEXP 3 "January 7, 2009" +.UC 4 +.SH NAME +ldexp, scalbn, scalbnf, scalbln, scalblnf \- compute absolute value +.SH SYNOPSIS +.nf +.ft B +#include + +double ldexp(double \fIx\fP, int \fIn\fP); +double scalbn(double \fIx\fP, int \fIn\fP); +float scalbnf(float \fIx\fP, int \fIn\fP); +double scalbln(double \fIx\fP, long \fIn\fP); +float scalblnf(float \fIx\fP, long \fIn\fP); +.fi +.SH DESCRIPTION +These functions all compute \fIx\fP * 2^\fIn\fP. +.SH "RETURN VALUE +These functions all return \fIx\fP * 2^\fIn\fP. -- 2.44.0