This source file includes following definitions.
- main
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 #include <config.h>
20
21 #include <math.h>
22
23 #include "signature.h"
24 SIGNATURE_CHECK (rintf, float, (float));
25
26 #include <float.h>
27 #include <stdio.h>
28
29 #include "isnanf-nolibm.h"
30 #include "minus-zero.h"
31 #include "infinity.h"
32 #include "nan.h"
33 #include "macros.h"
34
35 #undef INFINITY
36 #undef NAN
37
38 #define DOUBLE float
39 #define ISNAN isnanf
40 #define INFINITY Infinityf ()
41 #define NAN NaNf ()
42 #define L_(literal) literal##f
43 #define RINT rintf
44 #define RANDOM randomf
45 #include "test-rint.h"
46
47 int
48 main ()
49 {
50
51
52 if (FLT_ROUNDS == 1)
53 {
54
55
56
57
58 ASSERT (rintf (0.0f) == 0.0f);
59 ASSERT (rintf (minus_zerof) == 0.0f);
60
61 ASSERT (rintf (0.3f) == 0.0f);
62 ASSERT (rintf (0.5f) == 0.0f);
63 ASSERT (rintf (0.7f) == 1.0f);
64 ASSERT (rintf (1.0f) == 1.0f);
65 ASSERT (rintf (1.5f) == 2.0f);
66 ASSERT (rintf (1.999f) == 2.0f);
67 ASSERT (rintf (2.0f) == 2.0f);
68 ASSERT (rintf (2.1f) == 2.0f);
69 ASSERT (rintf (2.5f) == 2.0f);
70 ASSERT (rintf (2.7f) == 3.0f);
71 ASSERT (rintf (65535.99f) == 65536.0f);
72 ASSERT (rintf (65536.0f) == 65536.0f);
73 ASSERT (rintf (65536.01f) == 65536.0f);
74 ASSERT (rintf (2.341e31f) == 2.341e31f);
75
76 ASSERT (rintf (-0.3f) == 0.0f);
77 ASSERT (rintf (-0.5f) == 0.0f);
78 ASSERT (rintf (-0.7f) == -1.0f);
79 ASSERT (rintf (-1.0f) == -1.0f);
80 ASSERT (rintf (-1.5f) == -2.0f);
81 ASSERT (rintf (-1.999f) == -2.0f);
82 ASSERT (rintf (-2.0f) == -2.0f);
83 ASSERT (rintf (-2.1f) == -2.0f);
84 ASSERT (rintf (-2.5f) == -2.0f);
85 ASSERT (rintf (-2.7f) == -3.0f);
86 ASSERT (rintf (-65535.99f) == -65536.0f);
87 ASSERT (rintf (-65536.0f) == -65536.0f);
88 ASSERT (rintf (-65536.01f) == -65536.0f);
89 ASSERT (rintf (-2.341e31f) == -2.341e31f);
90
91 test_function ();
92
93 return 0;
94 }
95 else
96 {
97 fputs ("Skipping test: non-standard rounding mode\n", stderr);
98 return 77;
99 }
100 }