aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation/expand/builtin_fpclassify.c
blob: 506927dd36a1040641020e78546ad90f91a3205b (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
enum { FP_NAN, FP_INF, FP_NOR, FP_SUB, FP_ZERO };

#define	classify(X) __builtin_fpclassify(FP_NAN,FP_INF,FP_NOR,FP_SUB,FP_ZERO,X)

int test(void)
{
	if (classify(__builtin_nan("0")) != FP_NAN)
		return 0;
	if (classify(__builtin_inf("0")) != FP_INF)
		return 0;
	if (classify(1.0) != FP_NOR)
		return 0;
	if (classify(0.0) != FP_ZERO)
		return 0;

	return 1;
}

/*
 * check-name: builtin_fpclassify
 * check-command: test-linearize -Wno-decl $file
 * check-known-to-fail
 *
 * check-output-ignore
 * check-output-contains: ret\\..*\\$1
 */