# scalb(), scalbf(), scalbn(), scalbnf()multiply by a power of the machine's radix

## SYNOPSIS

#include <math.h>

double scalb (double x, double n)

float scalbf (float x, float n)

double scalbn(double x, int n)

float scalbnf(float x, int n)

float scalblnf(float x, long n);

double scalbln(double x, long n);

long double scalblnl(long double x, long n);

long double scalbnl(long double x, int n);

## DESCRIPTION

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

The scalbn() function differs from scalb() only in the type of its second argument.

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.

The scalbf() and scalbnf() functions are the single-precision of scalb() and scalbn() respectively.

## PARAMETERS

x

Is the value of the scale.

n

Is the value of the exponent.

## RETURN VALUES

On success, the scalb() function returns x * r^n.

If the correct value would overflow, then +HUGE_VAL or -HUGE_VAL (according to the sign of x) is returned, and:

• In POSIX mode, errno is set to ERANGE.

• In XOPEN or SVID mode, the matherr() function is called.

If the correct value would underflow, scalb() returns 0 and:

• In POSIX mode, errno is set to ERANGE.

• In XOPEN or SVID mode, the matherr() function is called.

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

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

UNIX 98.

MT-Safe.

None.

## AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition