www.delorie.com/djgpp/doc/libc/libc_523.html   search  
libc.a reference

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

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/ISO C C89; C99
POSIX 1003.2-1992; 1003.1-2001

Example

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


  webmaster     delorie software   privacy  
  Copyright © 2004     Updated Apr 2004