C++ Math exp2()

The function computes the base - 2 exponential function of a given number.

Suppose a number is 'x':

Syntax

Parameter

x: It is the value of the exponent.

Return value

It returns, 2 raised to the power x.

Example 1

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

Output:

Value of x is : 4
exp2(x) = 16

Example 2

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

Output:

Value of x is : -2
exp2(x) = 0.25





Latest Courses