1 /* Tests for _FloatN / _FloatNx types: compile and execution tests for
2    NaNs, SNAN macros in <float.h>.  Before including this file, define
3    WIDTH as the value N; define EXT to 1 for _FloatNx and 0 for
4    _FloatN.  */
5 
6 #define CONCATX(X, Y) X ## Y
7 #define CONCAT(X, Y) CONCATX (X, Y)
8 #define CONCAT3(X, Y, Z) CONCAT (CONCAT (X, Y), Z)
9 #define CONCAT4(W, X, Y, Z) CONCAT (CONCAT (CONCAT (W, X), Y), Z)
10 
11 #if EXT
12 # define TYPE CONCAT3 (_Float, WIDTH, x)
13 # define SNAN CONCAT3 (FLT, WIDTH, X_SNAN)
14 #else
15 # define TYPE CONCAT (_Float, WIDTH)
16 # define SNAN CONCAT3 (FLT, WIDTH, _SNAN)
17 #endif
18 
19 #define __STDC_WANT_IEC_60559_TYPES_EXT__
20 #include <fenv.h>
21 #include <float.h>
22 
23 extern void exit (int);
24 extern void abort (void);
25 
26 volatile TYPE nans_cst = SNAN;
27 
28 int
main(void)29 main (void)
30 {
31   volatile TYPE r;
32   r = nans_cst + nans_cst;
33   if (!fetestexcept (FE_INVALID))
34     abort ();
35   exit (0);
36 }
37