#include <math.h>
|
|
double
scalbln (double x, long n); |
|
float
scalblnf (float x, long n); |
|
long double
scalblnl (long double x, long n); |
|
double
scalbn (double x, int n); |
|
float
scalbnf (float x, int n); |
|
long double
scalbnl (long double x, int n); |
x (*, FLT_RADIX**n);
±HUGE_VAL, (±HUGE_VALF,, and, ±HUGE_VALL);
(according to the sign of
x
) as appropriate for the return type of the function.
x is NaN , a shall be returned.
x is ±0 or ±Inf, x shall be returned.
n is 0, x shall be returned.
#include <math.h>
int main( )
{
/*scalbn(), scalbnf() and scalbnl()*/
double x1 = 0.8, x2 = 4.0 ;
y = scalbn( x1, x2 );
printf( "scalbn( %f, %f) = %f\n", x1, x2, y );
y = scalbnf( x1, x2 );
printf( "scalbnf( %f, %f) = %f\n", x1, x2, y );
y = scalbnl( x1, x2 );
printf( "scalbnl( %f, %f) = %f\n", x1, x2, y );
/*scalbln(), scalblnf() and scalblnl()*/
x1 = 0.8, x2 = 4.0 ;
y = scalbln( x1, x2 );
printf( "scalbln( %f, %f) = %f\n", x1, x2, y );
y = scalblnf( x1, x2 );
printf( "scalblnf( %f, %f) = %f\n", x1, x2, y );
y = scalblnl( x1, x2 );
printf( "scalblnl( %f, %f) = %f\n", x1, x2, y );
}
Output
scalbn ( 0.8, 4.0 ) = 12.800000
scalbnf( 0.8, 4.0 ) = 12.800000
scalbnl( 0.8, 4.0 ) = 12.800000
scalbln ( 0.8, 4.0 ) = 12.800000
scalblnf( 0.8, 4.0 ) = 12.800000
scalblnl( 0.8, 4.0 ) = 12.800000
These routines conform to -isoC-99, and they implement the Scalb function recommended by -ieee754.
Here long double version apis are just an alias to the corresponding double version apis, Long double version Apis behaves similiar to that of double version Apis.
The scalbn and scalbnf functions appeared in BSD 4.3 and 2.0 , respectively. The scalbln and scalblnf functions first appeared in 5.3 , and scalblnl and scalbln in 5.5 .
Feedback
For additional information or queries on this page send feedback
|
© 2005-2007 Nokia |