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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
package test_internal
import "core:testing"
@(test)
compare_constant_nans_f32 :: proc(t: ^testing.T) {
NaN :: f32(0h7fc0_0000)
NaN2 :: f32(0h7fc0_0001)
Inf :: f32(0h7F80_0000)
Neg_Inf :: f32(0hFF80_0000)
testing.expect_value(t, NaN == NaN, false)
testing.expect_value(t, NaN == NaN2, false)
testing.expect_value(t, NaN != 0, true)
testing.expect_value(t, NaN != 5, true)
testing.expect_value(t, NaN != -5, true)
testing.expect_value(t, NaN != NaN, true)
testing.expect_value(t, NaN != NaN2, true)
testing.expect_value(t, NaN != Inf, true)
testing.expect_value(t, NaN != Neg_Inf, true)
testing.expect_value(t, NaN < NaN, false)
testing.expect_value(t, NaN <= NaN, false)
testing.expect_value(t, NaN > NaN, false)
testing.expect_value(t, NaN >= NaN, false)
}
@(test)
compare_constant_nans_f64 :: proc(t: ^testing.T) {
NaN :: f64(0h7fff_0000_0000_0000)
NaN2 :: f64(0h7fff_0000_0000_0001)
Inf :: f64(0h7FF0_0000_0000_0000)
Neg_Inf :: f64(0hFFF0_0000_0000_0000)
testing.expect_value(t, NaN == NaN, false)
testing.expect_value(t, NaN == NaN2, false)
testing.expect_value(t, NaN != 0, true)
testing.expect_value(t, NaN != 5, true)
testing.expect_value(t, NaN != -5, true)
testing.expect_value(t, NaN != NaN, true)
testing.expect_value(t, NaN != NaN2, true)
testing.expect_value(t, NaN != Inf, true)
testing.expect_value(t, NaN != Neg_Inf, true)
testing.expect_value(t, NaN < NaN, false)
testing.expect_value(t, NaN <= NaN, false)
testing.expect_value(t, NaN > NaN, false)
testing.expect_value(t, NaN >= NaN, false)
}
@(test)
compare_variable_nans_f32 :: proc(t: ^testing.T) {
NaN := f32(0h7fc0_0000)
NaN2 := f32(0h7fc0_0001)
Inf := f32(0h7F80_0000)
Neg_Inf := f32(0hFF80_0000)
testing.expect_value(t, NaN == NaN, false)
testing.expect_value(t, NaN == NaN2, false)
testing.expect_value(t, NaN != 0, true)
testing.expect_value(t, NaN != 5, true)
testing.expect_value(t, NaN != -5, true)
testing.expect_value(t, NaN != NaN, true)
testing.expect_value(t, NaN != NaN2, true)
testing.expect_value(t, NaN != Inf, true)
testing.expect_value(t, NaN != Neg_Inf, true)
testing.expect_value(t, NaN < NaN, false)
testing.expect_value(t, NaN <= NaN, false)
testing.expect_value(t, NaN > NaN, false)
testing.expect_value(t, NaN >= NaN, false)
}
@(test)
compare_variable_nans_f64 :: proc(t: ^testing.T) {
NaN := f64(0h7fff_0000_0000_0000)
NaN2 := f64(0h7fff_0000_0000_0001)
Inf := f64(0h7FF0_0000_0000_0000)
Neg_Inf := f64(0hFFF0_0000_0000_0000)
testing.expect_value(t, NaN == NaN, false)
testing.expect_value(t, NaN == NaN2, false)
testing.expect_value(t, NaN != 0, true)
testing.expect_value(t, NaN != 5, true)
testing.expect_value(t, NaN != -5, true)
testing.expect_value(t, NaN != NaN, true)
testing.expect_value(t, NaN != NaN2, true)
testing.expect_value(t, NaN != Inf, true)
testing.expect_value(t, NaN != Neg_Inf, true)
testing.expect_value(t, NaN < NaN, false)
testing.expect_value(t, NaN <= NaN, false)
testing.expect_value(t, NaN > NaN, false)
testing.expect_value(t, NaN >= NaN, false)
}
|