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
omega-mv / seed / omc / tests / float / structs.om
| 1 | note a struct field may be f64 or f32 (an f32 field still uses an 8-byte cell); a view receives it. |
| 2 | struct S a f64 b f32 c f32 2 end |
| 3 | fn total s view S to f64 |
| 4 | ret add get s a f64 get s b |
| 5 | end |
| 6 | fn main to int |
| 7 | x = new S 1.5 2.5 0.5 |
| 8 | put x c 1 3.5 |
| 9 | if ne bitcast ulong get x a 4609434218613702656 |
| 10 | ret 1 |
| 11 | end |
| 12 | if ne bitcast uint get x b 1075838976 |
| 13 | ret 2 |
| 14 | end |
| 15 | if ne bitcast uint get x c 1 1080033280 |
| 16 | ret 3 |
| 17 | end |
| 18 | r = total x |
| 19 | if ne int mul r 2.0 8 |
| 20 | ret 4 |
| 21 | end |
| 22 | ret 0 |
| 23 | end |