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 / f64_bits.om

48 lines · 863 bytes Raw Blame History
1note literals convert exactly: every constant here was computed outside this compiler (IEEE-754 bits).
2fn main to int
3a = bitcast ulong f64 1.5
4if ne a 4609434218613702656
5ret 1
6end
7b = bitcast ulong f64 0.1
8if ne b 4591870180066957722
9ret 2
10end
11c = bitcast ulong f64 3.141592653589793
12if ne c 4614256656552045848
13ret 3
14end
15d = bitcast ulong f64 1e-3
16if ne d 4562254508917369340
17ret 4
18end
19e = bitcast ulong f64 -0.0
20if ne e 9223372036854775808
21ret 5
22end
23f = bitcast ulong f64 6.02214076e23
24if ne f 4962933279127225623
25ret 6
26end
27g = bitcast ulong f64 1.602176634e-19
28if ne g 4325607224011134547
29ret 7
30end
31h = bitcast ulong f64 1e308
32if ne h 9214871658872686752
33ret 8
34end
35i = bitcast ulong f64 5e-324
36if ne i 1
37ret 9
38end
39j = bitcast ulong f64 1e-324
40if ne j 0
41ret 10
42end
43k = bitcast ulong f64 1.7976931348623158e308
44if ne k 9218868437227405311
45ret 11
46end
47ret 0
48end