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