Go to the first, previous, next, last section, table of contents.


ldexp

Syntax

#include <math.h>

double ldexp(double val, int exp);

Description

This function computes val*2^exp.

Return Value

val*2^exp. ldexp(0., exp) returns 0 for all values of exp, without setting errno. For non-zero values of val, errno is set to ERANGE if the result cannot be accurately represented by a double, and the return value is then the nearest representable double (possibly, an Inf). If val is a NaN or Inf, the return value is NaN and errno is set to EDOM.

Portability

ANSI, POSIX

Example

ldexp(3.5,4) == 3.5 * (2^4) == 56.0


Go to the first, previous, next, last section, table of contents.