aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/12-flt.c
blob: 295e40fe73f47504e17c2d376f17a8c597f30f7e (plain) (blame)
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/* EXPECT:
ok
*/
typedef unsigned u32;
typedef signed s32;
typedef float f32;
typedef double f64;
typedef unsigned long long u64;
typedef signed long long s64;

f32 s32_to_f32(s32 x) { return x; }
f32 u32_to_f32(u32 x) { return x; }
f64 s32_to_f64(s32 x) { return x; }
f64 u32_to_f64(u32 x) { return x; }
f32 s64_to_f32(s64 x) { return x; }
f32 u64_to_f32(u64 x) { return x; }
f64 s64_to_f64(s64 x) { return x; }
f64 u64_to_f64(u64 x) { return x; }
s32 f32_to_s32(f32 x) { return x; }
u32 f32_to_u32(f32 x) { return x; }
s32 f64_to_s32(f64 x) { return x; }
u32 f64_to_u32(f64 x) { return x; }
s64 f32_to_s64(f32 x) { return x; }
u64 f32_to_u64(f32 x) { return x; }
s64 f64_to_s64(f64 x) { return x; }
u64 f64_to_u64(f64 x) { return x; }
f32 f64_to_f32(f64 x) { return x; }
f64 f32_to_f64(f32 x) { return x; }

#include <stdio.h>
#include <assert.h>

double NAN = 0.0;
double _(double x) { return x; }

int main() {
   NAN/=0.0;
   assert(_(1.0) < _(2.0));
   assert(_(1.0) >= _(1.0));
   assert(_(1.0) >= _(-1.0));
   assert(_(1.0) != _(2.0));
   assert(_(1.0) - 1.0 == 0.0);
   assert(-_(0.0) == 0.0);
   assert(!(NAN < 2.0));
   assert(!(NAN > NAN));
   assert(!(NAN >= NAN));
   assert(!(NAN <= NAN));
   assert(!(NAN < NAN));
   assert(!(NAN == NAN));
   assert(NAN != NAN);
   assert(NAN != 0.0);
   printf("ok\n");
}