interplane.Get Omega
Read in your language

omega-mv

Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.

Brought by drakestapleton

branch main Branches Tags History

omega-mv / seed / omc / tests / float / f32_bits.om

40 lines · 626 bytes Raw Blame History
1note f32 literals are rounded once, to binary32: expected bits computed outside this compiler.
2fn main to int
3a = bitcast uint f32 1.5
4if ne a 1069547520
5ret 1
6end
7b = bitcast uint f32 0.1
8if ne b 1036831949
9ret 2
10end
11c = bitcast uint f32 3.14159265
12if ne c 1078530011
13ret 3
14end
15d = bitcast uint f32 1e-3
16if ne d 981668463
17ret 4
18end
19e = bitcast uint f32 3.4028235e38
20if ne e 2139095039
21ret 5
22end
23f = bitcast uint f32 1e-45
24if ne f 1
25ret 6
26end
27g = bitcast uint f32 1e-46
28if ne g 0
29ret 7
30end
31h = bitcast uint f32 6.02214076e23
32if ne h 1727990830
33ret 8
34end
35i = bitcast uint f32 1.17549435e-38
36if ne i 8388608
37ret 9
38end
39ret 0
40end