Javatpoint Logo
Javatpoint Logo

C++ Math exp()

The function computes the exponential e raised to the power given number.

Suppose a number is x:

exp() = ex

Syntax

Consider a number 'x'. Syntax would be:

Parameter

x: The value whose exponential value is to be calculated.

Return value

It returns the exponential value of type float, double or long double.

If value is too large, the function returns HUGE_VAL

Example 1

Let's see a simple example when the value of x is positive.

Output:

Value of x is : 0.2
Exponential value of x is : 1.2214

In this example, exp() function calculates the exponential value of x when the value of x is positive.

Example 2

Let's see a simple example when the value of x is negative

Output:

Value of x is : -5.3
Exponential value of x is : 0.00499159

In this example, exp() function calculates the exponential value of x when the value of x is negative.


Next TopicC++ Math Functions




Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


B.Tech / MCA