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 / convert.om
| 1 | note int<->float, f32<->f64: truncate, saturate, NaN to 0, round to nearest even. |
| 2 | fn main to int |
| 3 | if ne int f64 -3.7 -3 |
| 4 | ret 1 |
| 5 | end |
| 6 | if ne int f64 3.9 3 |
| 7 | ret 2 |
| 8 | end |
| 9 | if ne int f64 3e9 2147483647 |
| 10 | ret 3 |
| 11 | end |
| 12 | n = div 0.0f64 0.0f64 |
| 13 | if ne int n 0 |
| 14 | ret 4 |
| 15 | end |
| 16 | if ne int f64 1.5 1 |
| 17 | ret 5 |
| 18 | end |
| 19 | x = f32 0.1 |
| 20 | y = f64 x |
| 21 | if ne int mul y 10.0f64 1 |
| 22 | ret 6 |
| 23 | end |
| 24 | z = f64 0.1 |
| 25 | w = f32 z |
| 26 | if ne bitcast uint w 1036831949 |
| 27 | ret 7 |
| 28 | end |
| 29 | ret 0 |
| 30 | end |