blob: 3cdd2762547cc2cbf4eede3a0dac5bed64008fc7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#include <stdlib.h>
#include <limits.h>
#include "_stdlib.h"
/** absolute value **/
int abs(int j)
{
SIGNAL_SAFE(0);
if (j == INT_MIN) {
UNDEFINED("In call to abs(): The absolute value of INT_MIN is not representable as an int");
return INT_MIN;
}
return j < 0 ? -j : j;
}
CHECK_1(int, 0, abs, int)
/***
computes the absolute value of ARGUMENT(j).
***/
/*
UNDEFINED(ABS(ARGUMENT(j)) cannot be represented)
RETURN_SUCCESS(ABS(j));
STDC(1)
*/
|