learnprogramming123
 LEARN PROGRAMMING 123 your resources to programming and free tutition

 C++ soon here!
 VB - soon here!

Next Back

<math.h>        -        Mathematics

This header provides trigonometric, hyperbolic, exponential, logarithmic and several miscellaneous mathematical functions. These functions normally expect parameters of type double and return values of type double.

 double acos(double x); returns the arc cosine of x double asin(double x); returns the arc sine of x double atan(double x); returns the arc tangent of x double atan2(double x, double y); returns the arc tangent of y/x double ceil(double x); returns the result of rounding x towards infiniy to the nearest integer double cos(double x); returns the cosine of x double cosh(double x); returns the hyperbolic cosine of x double exp(double x); reurns the exponentional result of x double fabs(double x); returns the absolute value of x double floor(double x); returns the result of rounding x towardszero to the nearest integer double fmod(double x, double y); returns the remainder after division x/y double frexp(double val, int *exptr); function returns the mantisa and stores the exponent in the location pointed at by exptr double idexp(double x, int exp); returns x multiplied by 2 and raised to the power of exp double log(double x); returns the natural logarithm of x double log10(double x); returns the base 10 logarithm of x double modf(double x, double *intptr); returns the signed fractional part of x and stores the integer part at the location pointed at by intptr double pow(double x, double y); returns x raised to the power of y double sin(double x); returns the sine of x double sinh(double x); returns the hyperbolic sine of x double sqrt(double x); returns the square root of x double tan(double x); returns the tangent of x double tanh(double x); returns the hyperbolic tangent of x

Example:

This is a very simple program that will calculate 2 to the power of 32.

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

int main(void)
{

double z=0;

z = pow( 2, 32);

printf("2 to the power of 32 is %e\n", z);

return 0;

}

Please note that the answer is in standard index form (scientific notation).