-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnumer_types.jai
More file actions
53 lines (36 loc) · 1.07 KB
/
Copy pathnumer_types.jai
File metadata and controls
53 lines (36 loc) · 1.07 KB
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
#import "Basic";
main :: () {
a: u8 = 10;
b: u16 = 50;
c: u32 = 0x78f;
d: u64 = 0xfade_deaf_cafe_babe;
e: s8 = -7;
f: s16 = 0b101101101;
g: s32 = -5_069_105;
h: s64 = 987654321;
//i : s16 = 80000;
//j : u32 = -1;
k := 7;
print("k is %; type_of(k) is %.\n", k, type_of(k));
a = cast,no_check(u8) c;
print("c is %; after casting this to u8, a is now %.\n", c, a);
my_int : int = 7;
int_matching := type_of(my_int) == type_of(h);
print("int_matching: %\n", int_matching);
l: float32 = 123.005;
m: float64 = 500.321;
print("l is of type %, % bytes large.\n", type_of(l), size_of(type_of(l)));
print("m is of type %, % bytes large.\n", type_of(m), size_of(type_of(m)));
n:= 1.111;
o:= 1.11111111111111111;
print("n is %, of type %.\n", n, type_of(n));
print("o is %, of type %.\n", o, type_of(o));
nan32 := 0h7fbf_ffff;
weird64 := 0h8000_0000_0000_0000;
print("nan32 is: %\n", nan32);
print("weird64 is: %\n", weird64);
x: float32 = 111.0;
y: float = x;
float_matching := type_of(x) == type_of(y);
print("float_matchingL %\n", float_matching);
}