Sun Microsystems Logo
Products and Services
 
Support and Training
 
 

A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  
 
Mathematical Library Functionsscalb(3M)


NAME

 scalb - load exponent of a radix-independent floating-point number

SYNOPSIS

 
#include <math.h>
double scalb(double x, double n);

DESCRIPTION

 

The scalb() function computes x * rn, where r is the radix of the machine's floating point arithmetic. When r is 2, scalb() is equivalent to ldexp(3C).


RETURN VALUES

 

Upon successful completion, the scalb() function returns x * rn.

If the correct value would overflow, scalb() returns +-HUGE_VAL (according to the sign of x) and sets errno to ERANGE.

If the correct value would underflow to 0.0, scalb() returns 0 and sets errno to ERANGE.

The scalb() function returns x when x is +-Inf.

If x or n is NaN, then scalb() returns NaN.

For exceptional cases, matherr(3M) tabulates the values to be returned as dictated by Standards other than XPG4.


ERRORS

 

The scalb() function will fail if:

ERANGE
The correct value would overflow or underflow.

USAGE

 

An application wishing to check for error situations should set errno to 0 before calling scalb(). If errno is non-zero on return, or the return value is NaN, an error has occurred.


ATTRIBUTES

 

See attributes(5) for descriptions of the following attributes:

ATTRIBUTE TYPEATTRIBUTE VALUE
MT-LevelMT-Safe

SEE ALSO

 

ldexp(3C), matherr(3M), attributes(5)



SunOS 5.9Go To TopLast Changed 29 Dec 1996


Updated: 2004-01-16, 18:03