Name
logb, logbf, logbl, scalb, scalbf, scalbl, significand, significandf, significandl
- IEEE test functions
Library
libm.lib
Synopsis
|
long double
logbl (long double x);
|
|
double
scalb (double x, double n);
|
|
float
scalbf (float x, float n);
|
|
long double
scalbl (long double x, long double n);
|
|
double
significand (double x);
|
|
float
significandf (float x);
|
|
long double
significandl (long double x);
|
Detailed description
These functions allow users to test conformance to
-ieee754.
Their use is not otherwise recommended.
logb (x);
and
logbf (x);
return
x ’s exponent
n,
a signed integer converted to double-precision floating-point.
logb (±oo);
= +oo;
logb (0);
= -oo
scalb (x, n);
and
scalbf (x, n);
return
x *(2** n)
computed by exponent manipulation.
If
n
is not an integer, ±oo, or an NaN, the result is unspecified.
significand (x);
and
significandf (x);
return
sig,
where
x
=
sig * 2** n
with 1 <=
sig
< 2.
significand (x);
and
significandf (x);
are not defined when
x
is 0, ±oo, or NaN.
Here , long double version function are just aliases to
their corresponding double version apis.
Examples
#include <math.h>
int main( )
{
double e = 2.718282;
/*Logb(), logbf() and logbl() */
y = logb( e );
printf( "logb( %f) = %f\n", e, y );
y = logbf( e );
printf( "logbf( %f) = %f\n", e, y );
y = logbl( e );
printf( "logbl( %f) = %f\n\n", e, y );
/*scalb(), scalbf() and scalbl()*/
double x1 = 0.8, x2 = 4.0 ;
y = scalb( x1, x2 );
printf( "scalb( %f, %f) = %f\n", x1, x2, y );
y = scalbf( x1, x2 );
printf( "scalbf( %f, %f) = %f\n", x1, x2, y );
y = scalbl( x1, x2 );
printf( "scalbl( %f, %f) = %f\n", x1, x2, y );
/*significand(), significandf() and significandl()*/
x2 = 4.0 ;
y = significand( x2 );
printf( "significand(%f) = %f\n", x2, y );
y = significandf( x2 );
printf( "significandf(%f) = %f\n",x2, y );
y = significandl( x2 );
printf( "significandl(%f) = %f\n",x2, y );
}
Output
logb( 2.718282) = 1.000000
logbf( 2.718282) = 1.000000
logbl( 2.718282) = 1.000000
scalb( 0.8, 4.0 ) = 12.800000
scalbf( 0.8, 4.0 ) = 12.800000
scalbl( 0.8, 4.0 ) = 12.800000
significand ( 4.0) = 1.000000
significandf( 4.0) = 1.000000
significandl( 4.0) = 1.000000
See also
ieee
math
Feedback
For additional information or queries on this page send feedback
© 2005-2007 Nokia
|
|