C++ Standard Library C++ STL Library

C++ <cmath> - exp10() Function



The C++ <cmath> exp10() function returns 10 raised to the power of specified number, i.e., 10x.

Syntax

double exp10 (double x);
float exp10 (float x);
long double exp10 (long double x);
double exp10 (T x);                              

Parameters

x Specify the exponent of 10.

Return Value

Returns 10 raised to the power of specified number, i.e., 10x.

Example:

In the example below, exp10() function is used to calculate 10 raised to the power of specified number.

#include <iostream>
#include <cmath>
using namespace std;
 
int main (){
  cout<<exp10(2)<<"\n";
  cout<<exp10(-2)<<"\n";
  cout<<exp10(1.5)<<"\n";
  cout<<exp10(-1.5)<<"\n";  
  return 0;
}

The output of the above code will be:

100
0.01
31.6228
0.0316228

❮ C++ <cmath> Library

5