xref: /illumos-gate/usr/src/tools/smatch/src/validation/expand/builtin_fpclassify.c (revision 8a2b682e57a046b828f37bcde1776f131ef4629f)
1 enum { FP_NAN, FP_INF, FP_NOR, FP_SUB, FP_ZERO };
2 
3 #define	classify(X) __builtin_fpclassify(FP_NAN,FP_INF,FP_NOR,FP_SUB,FP_ZERO,X)
4 
5 int test(void)
6 {
7 	if (classify(__builtin_nan("0")) != FP_NAN)
8 		return 0;
9 	if (classify(__builtin_inf("0")) != FP_INF)
10 		return 0;
11 	if (classify(1.0) != FP_NOR)
12 		return 0;
13 	if (classify(0.0) != FP_ZERO)
14 		return 0;
15 
16 	return 1;
17 }
18 
19 /*
20  * check-name: builtin_fpclassify
21  * check-command: test-linearize -Wno-decl $file
22  * check-known-to-fail
23  *
24  * check-output-ignore
25  * check-output-contains: ret\\..*\\$1
26  */
27