ldexp(), ldexpf()

multiply by a power of 2 

Function


SYNOPSIS

#include <math.h>

double ldexp(double x, int exp);

float ldexpf(float x, int exp);


DESCRIPTION

The ldexp() function multiplies a floating-point number by 2 raised to the power of exp. A range error can occur during the operation.

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

The ldexpf() function is a single-precision version of ldexp().


PARAMETERS

x 

Is the number to be multiplied by 2 raised to the power of exp.

exp 

Is the exponent.


RETURN VALUES

The ldexp() and ldexpf() functions return the value of x times 2 raised to the power exp.

If the value of x is NaN, NaN is returned and errno is set to EDOM.

If either function overflows, ±HUGE_VAL is returned (according to the sign of x), and errno is set to ERANGE. If it underflows, 0 is returned and errno is set to ERANGE.


CONFORMANCE

ANSI/ISO 9899-1990.


MULTITHREAD SAFETY LEVEL

MT-Safe.


PORTING ISSUES

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


SEE ALSO

Functions:
frexp(), logb(), modf(), scalb()


PTC MKS Toolkit 10.4 Documentation Build 39.