| <<< Functions | Index | Character classification and conversion library functions >>> |
C++ <cmath> header brings collection of math functions such as:
log( x ); // natural logarithm of x
pow( x, y ); // x raised to power y
sin( x ); // trigonometric sine of x
sqrt( x ); // square root of x
tan( x ); // trigonometric tangent.For example,
For example,
#include <iostream>
#include <cmath>
int main()
{
double result = sqrt( 1234.5 );
std::cout << "Square root of 1234.5 is " << result << '\n';
return 0;
}
| <<< Functions | Index | Character classification and conversion library functions >>> |