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 / ng / front / runs / fconv-int-f64-below.om
| 1 | note Float conversion parity: preserve the complete converted integer as eight output bytes. |
| 2 | fn convert x f64 to int |
| 3 | ret int x |
| 4 | end |
| 5 | fn main to int |
| 6 | a = new uchar 8 0 |
| 7 | x = convert -2.147483649e9f64 |
| 8 | bits = ulong bitcast uint x |
| 9 | for i ulong len a |
| 10 | put a i uchar and shr bits mul i 8 255 |
| 11 | end |
| 12 | k = write 1 a 0 len a |
| 13 | if ne k long len a |
| 14 | ret 1 |
| 15 | end |
| 16 | ret 0 |
| 17 | end |