mikroSDK Reference Manual
|
ANSI C Math Library. More...
Functions list | |
double | fabs (double num) |
Calculates floating point abolute value of given number. More... | |
double | floor (double num) |
Rounds a number DOWN to the nearest integer. More... | |
double | ceil (double num) |
Rounds a number UP to the nearest integer. More... | |
double | frexp (double num, int16_t *exp_ptr) |
Function splits a floating-point number. More... | |
double | ldexp (double num, int16_t new_exp) |
Calculates the result of multiplying the floating-point number by 2 raised to the power n. More... | |
double | modf (double num, double *int_ptr) |
Splits argument num split to the fractional part (function return value) and integer part (in number int_ptr). More... | |
double | sqrt (double num) |
Calculates square root of given number. More... | |
double | atan (double num) |
Calculates arc tangent of given number. More... | |
double | asin (double num) |
Calculates the arc sine of given number, in range [-1..+1]. More... | |
double | acos (double num) |
Calculates the arccosine of given number, in range [-1..+1]. More... | |
double | atan2 (double y, double x) |
Calculates the arctangent of given number, in range [-1..+1]. More... | |
double | sin (double num) |
Calculates the sine of a given angle (in radians). More... | |
double | cos (double num) |
Calculates the cosine of a given angle (in radians). More... | |
double | tan (double num) |
Calculates the tangent of given angle (in radians). More... | |
double | exp (double pow) |
Calculates the number e raised to the power of argument power. More... | |
double | log (double num) |
Calculates the natural logarithm - ln( num ). More... | |
double | log10 (double num) |
Calculates the base 10 logarithm. More... | |
double | pow (double num, double pow) |
Calculates the power of a number. More... | |
double | sinh (double num) |
Calculates the hyperbolic sine of a given number. If the value of num is too large (if overflow occurs), the function fails. More... | |
double | cosh (double num) |
Calculates the hyperbolic cosine of given number. More... | |
double | tanh (double num) |
Calculates the hyperbolic tangent of given number. More... | |
ANSI C Math Library provides a set of standard ANSI C library functions for floating point math handling.
double fabs | ( | double | num | ) |
The fabs function computes the absolute value of a floating-point number num.
Calculates floating point abolute value of given number.
The fabs function computes the absolute value of a floating-point number num.
[in] | num | Number which the absolute value is calculated for. |
double floor | ( | double | num | ) |
The floor function computes the largeht integral value not greater than num.
Rounds a number DOWN to the nearest integer.
The floor function computes the largeht integral value not greater than num.
[in] | num | Number to be rounded. |
double ceil | ( | double | num | ) |
The ceil function computes the smallest integral value not less than num.
Rounds a number UP to the nearest integer.
The ceil function computes the smallest integral value not less than num.
[in] | num | Number to be rounded. |
double frexp | ( | double | num, |
int16_t * | exp_ptr | ||
) |
The frexp function breaks a floating-point number into a normalized fraction and an integral power of 2. It stores the integer in the int object pointed to by exp_ptr.
Function splits a floating-point number.
The frexp function breaks a floating-point number into a normalized fraction and an integral power of 2. It stores the integer in the int object pointed to by exp_ptr.
[in] | num | Floating point number that gets split. |
[in] | exp_ptr | Pointer to variable in which the exponent gets stored. |
double ldexp | ( | double | num, |
int16_t | new_exp | ||
) |
The ldexp function multiplies a tloating-point number by an integral power of 2. A range error may occur.
Calculates the result of multiplying the floating-point number by 2 raised to the power n.
The ldexp function multiplies a tloating-point number by an integral power of 2. A range error may occur.
[in] | num | Floating point number to be multiplied. |
[in] | new_exp | Integral exponent. |
double modf | ( | double | num, |
double * | int_ptr | ||
) |
The modf function breaks the argument value into integral and fractional parts, each of which has the same sign as the argument. It stores the integral part as a double in the object pointed to by int_ptr.
Splits argument num split to the fractional part (function return value) and integer part (in number int_ptr).
The modf function breaks the argument value into integral and fractional parts, each of which has the same sign as the argument. It stores the integral part as a double in the object pointed to by int_ptr.
[in] | num | Number that gets split. |
[in] | int_ptr | Pointer to variable in which the integer part gets stored. |
double sqrt | ( | double | num | ) |
The sqrt function computes the nonnegative square root of num. A domain error occurs if the argument is negative.
Calculates square root of given number
The sqrt function computes the nonnegative square root of num. A domain error occurs if the argument is negative.
[in] | num | Number the square root is calculated for. |
double atan | ( | double | num | ) |
The atan function computes the principal value of the arc tangent of num.
Calculates arc tangent of given number.
The atan function computes the principal value of the arc tangent of num.
[in] | num | Number the arctangent is calculated for. |
double asin | ( | double | num | ) |
The asin function computes the principal value of the arc sine of num. A domain error occurs for arguments not in the range [-1, +1].
Calculates the arc sine of given number, in range [-1..+1].
The asin function computes the principal value of the arc sine of num. A domain error occurs for arguments not in the range [-1, +1].
[in] | num | Number the arcsine is calculated for. |
double acos | ( | double | num | ) |
The acos tunction computes the principal value of the arc cosine of num. A domain error occurs for arguments not in the range [-1, +1].
Calculates the arccosine of given number, in range [-1..+1].
The acos tunction computes the principal value of the arc cosine of num. A domain error occurs for arguments not in the range [-1, +1].
[in] | num | Number which the arc cosine is calculated for. |
double atan2 | ( | double | y, |
double | x | ||
) |
The atan2 function computes the principal value of the arc tangent of y/x, using the signs of both arguments to determine the quadrant of the return value. A domain error may occur if both arguments are zero.
Calculates the arctangent of given number, in range [-1..+1].
The atan2 function computes the principal value of the arc tangent of y/x, using the signs of both arguments to determine the quadrant of the return value. A domain error may occur if both arguments are zero.
[in] | y | First value. |
[in] | x | Second value. |
double sin | ( | double | num | ) |
The sin function computes the sine of num (measured in radians).
Calculates the sine of a given angle (in radians).
The sin function computes the sine of num (measured in radians).
[in] | num | Number the sine is calculated for. |
double cos | ( | double | num | ) |
The cos function computes the cosine of num (measured in radians).
Calculates the cosine of a given angle (in radians).
The cos function computes the cosine of num (measured in radians).
[in] | num | Number the cosine is calculated for. |
double tan | ( | double | num | ) |
The tan function returns the tangent of num (measured in radians).
Calculates the tangent of given angle (in radians).
The tan function returns the tangent of num (measured in radians).
[in] | num | Number the tangent is calculated for. |
double exp | ( | double | pow | ) |
The exp function computes the exponential function of pow. A range error occurs if the magnitude of pow is too large.
Calculates the number e raised to the power of argument power.
The exp function computes the exponential function of pow. A range error occurs if the magnitude of pow is too large.
[in] | pow | Power which the e constant is to be raised for. |
double log | ( | double | num | ) |
The log function compute5 the natural logarithm of num. A domain error occurs if the argument is negative. A range error might occur if the argument is zero.
Calculates the natural logarithm - ln( num ).
The log function compute5 the natural logarithm of num. A domain error occurs if the argument is negative. A range error might occur if the argument is zero.
[in] | num | Number the natural logaritm is calculated from. |
double log10 | ( | double | num | ) |
The log10 function computes the base-ten logarithm of x. A domain error occurs if the argument is negative. A range error may occur if the argument is zero.
Calculates the base 10 logarithm.
The log10 function computes the base-ten logarithm of x. A domain error occurs if the argument is negative. A range error may occur if the argument is zero.
[in] | num | Number the base 10 logaritm is calculated from. |
double pow | ( | double | num, |
double | pow | ||
) |
The pow function computes num raised to the power pow. A domain error occurs if num is negative and pow is not an integral value. A domain error occurs if the result cannot be represented when num is zero and pow is less than or equal to zero. A range error might occur.
Calculates the power of a number
The pow function computes num raised to the power pow. A domain error occurs if num is negative and pow is not an integral value. A domain error occurs if the result cannot be represented when num is zero and pow is less than or equal to zero. A range error might occur.
[in] | num | Number to be raised. |
[in] | pow | Number which the num is raised to. |
double sinh | ( | double | num | ) |
The sinh function computes the hyperbolic sine of num. A range error occurs if the magnitude of num is too large.
Calculates the hyperbolic sine of a given number. If the value of num is too large (if overflow occurs), the function fails.
The sinh function computes the hyperbolic sine of num. A range error occurs if the magnitude of num is too large.
[in] | num | Number the hyperbolic sine is calculated for. |
double cosh | ( | double | num | ) |
The cash function computes the hyperbolic cosine of num. A range error occurs if the magnitude of num is too large.
Calculates the hyperbolic cosine of given number.
The cash function computes the hyperbolic cosine of num. A range error occurs if the magnitude of num is too large.
[in] | num | Number the hyperbolic cosine is calculated for. |
double tanh | ( | double | num | ) |
The tanh function computes the hyperbolic tangent of num.
Calculates the hyperbolic tangent of given number.
The tanh function computes the hyperbolic tangent of num.
[in] | num | Number the hyperbolic tangent is calculated for. |