Cygwin: mmap: allow remapping part of an existing anonymous mapping
[newlib-cygwin.git] / newlib / libc / stdlib / labs.c
blobf6761d0cc4f814be4818b60557abae359bca9db9
1 /*
2 FUNCTION
3 <<labs>>---long integer absolute value
5 INDEX
6 labs
8 SYNOPSIS
9 #include <stdlib.h>
10 long labs(long <[i]>);
12 DESCRIPTION
13 <<labs>> returns
14 @tex
15 $|x|$,
16 @end tex
17 the absolute value of <[i]> (also called the magnitude
18 of <[i]>). That is, if <[i]> is negative, the result is the opposite
19 of <[i]>, but if <[i]> is nonnegative the result is <[i]>.
21 The similar function <<abs>> uses and returns <<int>> rather than
22 <<long>> values.
24 RETURNS
25 The result is a nonnegative long integer.
27 PORTABILITY
28 <<labs>> is ANSI.
30 No supporting OS subroutine calls are required.
33 #include <stdlib.h>
35 long
36 labs (long x)
38 if (x < 0)
40 x = -x;
42 return x;