mikroSDK Reference Manual
|
ANSI C Stdlib Library. More...
Functions list | |
int | abs (int num) |
Returns absolute value of given argument. More... | |
float | atof (char *str) |
Converts string to float. More... | |
int | atoi (char *str) |
Converts string to integer. More... | |
long | atol (char *str) |
Converts string to number of type long. More... | |
div_t | div (int number, int denom) |
Divides number (numerator) by denom (denominator). More... | |
ldiv_t | ldiv (long number, long denom) |
Divides number (numerator) by denom (denominator). More... | |
uldiv_t | uldiv (unsigned long number, unsigned long denom) |
Divides number (numerator) by denom (denominator). More... | |
long | labs (long num) |
Returns the absolute value of num. More... | |
long | max (long num1, long num2) |
Returns maximum value of num1 and num2. More... | |
long | min (long num1, long num2) |
Returns minimum value of num1 and num2. More... | |
int | rand () |
Pseudo-random number generator. More... | |
void | srand (unsigned seed) |
Seeds the random number generator used by the function rand. More... | |
int | xtoi (char *str) |
Extracts hex value from a given string. More... | |
ANSI C Stdlib Library provides a set of standard ANSI C library functions of general utility.
int abs | ( | int | num | ) |
The abs function computes the absolute value of an integer num. If the result cannot be represented, the behavior is undefined.
Returns absolute value of given argument.
The abs function computes the absolute value of an integer num. If the result cannot be represented, the behavior is undefined.
[in] | num | Number the absolute value is set for. |
float atof | ( | char * | str | ) |
The atof function converts the initial portion of the string pointed to by str to double representation. Except for the behavior on error, it is equivalent to strtod
.
Converts string to float.
The atof function converts the initial portion of the string pointed to by str to double representation. Except for the behavior on error, it is equivalent to strtod
.
[in] | str | String to be converted. |
int atoi | ( | char * | str | ) |
The atoi function converts the initial portion of the string pointed to by str to int representation. Except for the behavior on error, it is equivalent to strtol
.
Converts string to integer.
The atoi function converts the initial portion of the string pointed to by str to int representation. Except for the behavior on error, it is equivalent to strtol
.
[in] | str | String to be converted. |
long atol | ( | char * | str | ) |
The atol function converts the initial portion of the string pointed to by str to long int representation. Except for the behavior on error, it is equivalent to strtol
.
Converts string to number of type long.
The atol function converts the initial portion of the string pointed to by str to long int representation. Except for the behavior on error, it is equivalent to strtol
.
[in] | str | String to be converted. |
div_t div | ( | int | number, |
int | denom | ||
) |
The div function computes the quotient and remainder of the division of the numerator number by the denominator denom. If the division is inexact, the resulting quotient is the integer of lesser magnitude that is the nearest to the algebraic quotient. If the result cannot be represented, the behavior is undefined. Otherwise, quotient * denom + remainder shall equal number.
Divides number (numerator) by denom (denominator).
The div function computes the quotient and remainder of the division of the numerator number by the denominator denom. If the division is inexact, the resulting quotient is the integer of lesser magnitude that is the nearest to the algebraic quotient. If the result cannot be represented, the behavior is undefined. Otherwise, quotient * denom + remainder shall equal number.
[in] | number | Number to be divided. |
[in] | denom | Number to be divided by. |
ldiv_t ldiv | ( | long | number, |
long | denom | ||
) |
The ldiv function is similar to the div function, except that the arguments and the members of the returned structure (which has type ldiv-t) all have type long int.
Divides number (numerator) by denom (denominator).
The ldiv function is similar to the div function, except that the arguments and the members of the returned structure (which has type ldiv-t) all have type long int.
[in] | number | Number to be divided. |
[in] | denom | Number to be divided by. |
uldiv_t uldiv | ( | unsigned long | number, |
unsigned long | denom | ||
) |
The uldiv function is similar to the div function, except that the arguments and the members of the returned structure (which has type uldiv-t) all have type unsigned long int.
Divides number (numerator) by denom (denominator).
The uldiv function is similar to the div function, except that the arguments and the members of the returned structure (which has type uldiv-t) all have type unsigned long int.
[in] | number | Number to be divided. |
[in] | denom | Number to be divided by. |
long labs | ( | long | num | ) |
The labs function is similar to the abs function, except that the argument and the returned value each have type long int.
Returns the absolute value of num.
The labs function is similar to the abs function, except that the argument and the returned value each have type long int.
[in] | num | Number the absolute value is set for. |
long max | ( | long | num1, |
long | num2 | ||
) |
Returns maximum value of num1 and num2.
[in] | num1 | Number 1 to be checked. |
[in] | num2 | Number 2 to be checked. |
long min | ( | long | num1, |
long | num2 | ||
) |
Returns minimum value of num1 and num2.
[in] | num1 | Number 1 to be checked. |
[in] | num2 | Number 2 to be checked. |
int rand | ( | ) |
The rand function computes a sequence of pseudo-random integers in the range 0 to RAND_MAX.
Pseudo-random number generator.
The rand function computes a sequence of pseudo-random integers in the range 0 to RAND_MAX.
void srand | ( | unsigned | seed | ) |
The srand function uses the argument as a seed for a new sequence of pseudo-random numbers to be returned by subsequent calls to rand. If srand is then called with the same seed value, the sequence of pseudo-random numbers shall be repeated. If rand is called before any calls to srand have been made, the same sequence shall be generated as when srand is first called with a seed value of 1.
Seeds the random number generator used by the function rand.
The srand function uses the argument as a seed for a new sequence of pseudo-random numbers to be returned by subsequent calls to rand. If srand is then called with the same seed value, the sequence of pseudo-random numbers shall be repeated. If rand is called before any calls to srand have been made, the same sequence shall be generated as when srand is first called with a seed value of 1.
[in] | seed | Number to be used as new seed. |
int xtoi | ( | char * | str | ) |
Extracts hex value from a given string.
[in] | str | String the value is extracted from. |