imaxabs() — Absolute value for intmax_t
Standards
Standards / Extensions | C or C++ | Dependencies |
---|---|---|
C99 |
both | z/OS® V1R7 |
Format
#define _ISOC99_SOURCE
#include <inttypes.h>
intmax_t imaxabs(intmax_t j);
Compile requirement: Function imaxabs() requires
long long to be available.
General description
The imaxabs() function computes the absolute value of j. When the input value is INTMAX_MIN, the value is undefined. The imaxabs() function is similar to llabs() and labs(). The only difference being that the return value and the argument passed in are of type intmax_t.
Returned value
The imaxabs function returns the absolute value of j.
Example
#define _ISOC99_SOURCE
#include <inttypes.h>
#include <stdio.h>
int main(void)
{
intmax_t a = -1234;
intmax_t b = imaxabs(a);
printf("%jd \n", b );
}
Output:
1234
Related information
- inttypes.h
- labs()
- llabs()