# ldexp function(Combine Fraction and Exponent) in C Language – example and detail

In the C Programming Language, the ldexp characteristic combines a fraction and an exponent into a floating-point value.

## Syntax

The syntax for the ldexp function in the C Language is:

``double ldexp(double fraction, int exp);``

Parameters or Arguments

fraction The fractional phase of the value. exp The exponent part of the value.

## Returns

The ldexp function returns a floating-point cost combining a fraction and an exponent based totally on the equation: fraction x 2 exponent

In the C Language, the required header for the ldexp characteristic is:

``#include <math.h>``

## Applies To

In the C Language, the ldexp characteristic can be used in the following versions:

ANSI/ISO 9899-1990

## ldexp Example

``````/* Example using ldexp by TechOnTheNet.com */

#include <stdio.h>
#include <math.h>

int main(int argc, const char * argv[])
{
/* Define temporary variables */
double value;
int e;
double result;

/* Assign the value and exponential we will use to find the ldexp */
value = 1.5;
e = 2;

/* Calculate the ldexp of the value and the exponential */
result = ldexp(value, e);

/* Display the result of the calculation */
printf("The ldexp of %f with exponential %d is %f\n", value, e, result);

return 0;
}``````

When compiled and run, this application will output:

``The ldexp of 1.500000 with exponential 2 is 6.000000``

## Similar Functions

Other C features that are similar to the ldexp function:

frexp function <math.h>