MentOS  0.8.0
The Mentoring Operating System
Macros | Functions
math.c File Reference

Macros

#define MAXPOWTWO   4.503599627370496000E+15
 Max power for forward and reverse projections.
 

Functions

double round (double x)
 Returns the integral value that is nearest to x, with halfway cases rounded away from zero. More...
 
double floor (double x)
 Rounds x downward, returning the largest integral value that is not greater than x. More...
 
double ceil (double x)
 Rounds x upward, returning the smallest integral value that is not less than x. More...
 
double pow (double base, double exponent)
 Returns base raised to the power exponent: More...
 
double exp (double x)
 Returns the base-e exponential function of x, which is e raised to the power x: e^x. More...
 
double fabs (double x)
 Returns the absolute value of x: |x|. More...
 
float fabsf (float x)
 Returns the absolute value of x: |x|. More...
 
double sqrt (double x)
 Returns the square root of x. More...
 
float sqrtf (float x)
 Returns the square root of x. More...
 
int isinf (double x)
 Checks if the input value is Infinite (INF). More...
 
int isnan (double x)
 Checks if the input value is Not A Number (NAN). More...
 
double log10 (double x)
 Logarithm function in base 10. More...
 
double ln (double x)
 Natural logarithm function. More...
 
double logx (double x, double y)
 Logarithm function in base x. More...
 
double modf (double x, double *intpart)
 Breaks x into an integral and a fractional part, both parts have the same sign as x. More...
 

Detailed Description

Function Documentation

◆ ceil()

double ceil ( double  x)

Rounds x upward, returning the smallest integral value that is not less than x.

Parameters
xValue to round up.
Returns
The smallest integral value that is not less than x (as a floating-point value).

◆ exp()

double exp ( double  x)

Returns the base-e exponential function of x, which is e raised to the power x: e^x.

Parameters
xValue of the exponent.
Returns
Exponential value of x.

If the magnitude of the result is too large to be represented by a value of the return type, the function returns HUGE_VAL (or HUGE_VALF or HUGE_VALL) with the proper sign, and an overflow range error occurs and the global variable errno is set to ERANGE.

◆ fabs()

double fabs ( double  x)

Returns the absolute value of x: |x|.

Parameters
xValue whose absolute value is returned.
Returns
The absolute value of x.

◆ fabsf()

float fabsf ( float  x)

Returns the absolute value of x: |x|.

Parameters
xValue whose absolute value is returned.
Returns
The absolute value of x.

◆ floor()

double floor ( double  x)

Rounds x downward, returning the largest integral value that is not greater than x.

Parameters
xValue to round down.
Returns
The value of x rounded downward (as a floating-point value).

◆ isinf()

int isinf ( double  x)

Checks if the input value is Infinite (INF).

Parameters
xThe value to check.
Returns
1 if INF, 0 otherwise.

◆ isnan()

int isnan ( double  x)

Checks if the input value is Not A Number (NAN).

Parameters
xThe value to check.
Returns
1 if NAN, 0 otherwise.

◆ ln()

double ln ( double  x)

Natural logarithm function.

Parameters
xTopic of the logarithm function.
Returns
Return the result.

◆ log10()

double log10 ( double  x)

Logarithm function in base 10.

Parameters
xTopic of the logarithm function.
Returns
Return the result.

◆ logx()

double logx ( double  x,
double  y 
)

Logarithm function in base x.

Parameters
xBase of the logarithm.
yTopic of the logarithm function.
Returns
Return the result.

◆ modf()

double modf ( double  x,
double *  intpart 
)

Breaks x into an integral and a fractional part, both parts have the same sign as x.

Parameters
xThe value we want to break.
intpartWhere we store the integer part.
Returns
the fractional part.

◆ pow()

double pow ( double  base,
double  exponent 
)

Returns base raised to the power exponent:

Parameters
baseBase value.
exponentExponent value.
Returns
The result of raising base to the power exponent.

If the base is finite negative and the exponent is finite but not an integer value, it causes a domain error. If both base and exponent are zero, it may also cause a domain error on certain implementations. If base is zero and exponent is negative, it may cause a domain error or a pole error (or none, depending on the library implementation). The function may also cause a range error if the result is too great or too small to be represented by a value of the return type.

◆ round()

double round ( double  x)

Returns the integral value that is nearest to x, with halfway cases rounded away from zero.

Parameters
xValue to round.
Returns
The value of x rounded to the nearest integral (as a floating-point value).

◆ sqrt()

double sqrt ( double  x)

Returns the square root of x.

Parameters
xValue whose square root is computed.
Returns
Square root of x. If x is negative, the global variable errno is set to EDOM.

◆ sqrtf()

float sqrtf ( float  x)

Returns the square root of x.

Parameters
xValue whose square root is computed.
Returns
Square root of x. If x is negative, the global variable errno is set to EDOM.