#include <stdlib.h>
int
abs
(int j
);
The abs function computes the absolute value of an integer j. If the result cannot be represented, the behavior is undefined.
The abs function returns the absolute value.
The abs function is both built-in and supplied as a library function. Usually the built-in function is used, and the appropriate instructions will be generated. If the address of the abs function is taken, then the address is the address of the library function.
On the M1750, in the special case where j is -32768, fixed point overflow will be detected by the 1750 and if the corresponding interrupt is enabled the signal SIGFIXED_OVERFLOW will be raised.
The standard behavior may be modified in the run-time system file crt0.s.
#include <stdlib.h>
div_t
div
(int numer ,
int denom );
The div function computes the quotient and remainder of the division of the numerator numer by the denominator denom. If the division is inexact, the resulting quotient is the integer of lesser magnitude that is nearest to the algebraic quotient. If the result cannot be represented, the behavior is undefined: otherwise quot * denom + rem shall equal numer.
The div function returns a structure of type div_t comprising both the quotient and the remainder. The structure shall contain the following members, in either order:
int quot; /* quotient */ int rem; /* remainder */
If denom is zero, or if numer is -32768 and denom is -1, then fixed point overflow is detected. If the corresponding interrupt is enabled, then SIGFIXED_OVERFLOW is raised.
#include <stdlib.h>
long
labs
( long
);
The labs function computes the absolute value of an integer j. If the result cannot be represented, the behavior is undefined.
The labs function returns the absolute value.
The labs function is both built-in and supplied as a library function.Usually the built-in function is used, and in this case the 1750 instruction DABS will be generated. If the address of the abs function is taken, then the address is the address of the library function.
In the special case where j is -2147483648, fixed point overflow will be detected by the 1750 and if the corresponding interrupt is enabled the signal SIGFIXED_OVERFLOW will be raised.
The standard behavior may be modified in the run-time system file crt0.s.
#include <stdlib.h>
ldiv_t
ldiv
(long numer
, long denom );
The ldiv function computes the quotient and remainder of the division of the numerator numer by the denominator denom. If the division is inexact, the resulting quotient is the integer of lesser magnitude that is nearest to the algebraic quotient. If the result cannot be represented, the behavior is undefined: otherwise quot * denom + rem shall equal numer.
The ldiv function returns a structure of type ldiv_t comprising both the quotient and the remainder. The structure shall contain the following members, in either order:
long int quot; /* quotient */ long int rem; /* remainder */
If denom is zero, or if numer is -2147483648 and denom is -1, then fixed point overflow is detected. If the corresponding interrupt is enabled, then SIGFIXED_OVERFLOW is raised.