C ldexp() Function

Last Updated:

C ldexp()

The ldexp() function returns x multiplied by 2 raised to the power of exponent.

This function is defined in <math.h> header file.

Example

C Compiler
#include <stdio.h> #include <math.h> int main() { double x = 4, ret; int e = 3; ret = ldexp(x, e); printf("%f * 2^%d = %f\n", x, e, ret); return 0; }

Syntax

double ldexp(double x, int e)

Parameter Values

ValueTypeExplanation
x Required Specifies the significand.
e Required Specifies the exponent.

Return Value

ValueExplanation
Number Returns x multiplied by 2 raised to the power of exponent.

Share this Page

Meet the Author