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

23 lines · 451 bytes Raw Blame History
1note a struct field may be f64 or f32 (an f32 field still uses an 8-byte cell); a view receives it.
2struct S a f64 b f32 c f32 2 end
3fn total s view S to f64
4ret add get s a f64 get s b
5end
6fn main to int
7x = new S 1.5 2.5 0.5
8put x c 1 3.5
9if ne bitcast ulong get x a 4609434218613702656
10ret 1
11end
12if ne bitcast uint get x b 1075838976
13ret 2
14end
15if ne bitcast uint get x c 1 1080033280
16ret 3
17end
18r = total x
19if ne int mul r 2.0 8
20ret 4
21end
22ret 0
23end