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

Go to the source code of this file.

Functions

long labs (long j)
 Computes the absolute value of an long number. More...
 

Function Documentation

◆ labs()

long labs ( long  n)

Computes the absolute value of an long number.

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

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

Definition at line 32 of file labs.c.

33 {
34  return (j < 0 ? -j : j);
35 }