Add scalbn family of functions

This commit is contained in:
Erik van der Kouwe 2010-01-08 07:27:54 +00:00
parent 17b10f1bf3
commit aec561acc5
4 changed files with 46 additions and 0 deletions

View file

@ -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) );

View file

@ -19,6 +19,7 @@ libc_FILES=" \
log10.c \
pow.c \
s_rint.c \
scalbn.c \
sin.c \
sinh.c \
sqrt.c \

22
lib/math/scalbn.c Normal file
View file

@ -0,0 +1,22 @@
#include <math.h>
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);
}

19
man/man3/ldexp.3 Normal file
View file

@ -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 <math.h>
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.