Embedded Artistry libc
C Standard Library Support for Bare-metal Systems
imaxabs.c File Reference
#include <stdlib.h>
Include dependency graph for imaxabs.c:

Go to the source code of this file.

Functions

intmax_t imaxabs (intmax_t j)
 Computes the absolute value of an intmax_t number. More...
 

Function Documentation

◆ imaxabs()

intmax_t imaxabs ( intmax_t  j)

Computes the absolute value of an intmax_t number.

Computes the absolute value of an intmax_t number. The behavior is undefined if the result cannot be represented by the return type.

Parameters
jvalue
Returns
The absolute value of n (i.e. |n|), if it is representable.

Definition at line 29 of file imaxabs.c.

30 {
31  return (j < 0 ? -j : j);
32 }