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 / pools / g8b.om
| 1 | note gate-pools 8: n times the element size at or past 2^63 is -22 with nothing changed; just below it the |
| 2 | note host refuses (-12). |
| 3 | global P ulong * |
| 4 | global U uchar * |
| 5 | global ob uchar 24 |
| 6 | fn pnum v ulong to void |
| 7 | put ob 23 10 |
| 8 | i = ulong 23 |
| 9 | x = v |
| 10 | go = true |
| 11 | while go bound 21 |
| 12 | i = sub i 1 |
| 13 | put ob i uchar add rem x 10 48 |
| 14 | x = div x 10 |
| 15 | go = ne x 0 |
| 16 | end |
| 17 | k = write 1 ob i sub 24 i |
| 18 | end |
| 19 | fn plong v long to void |
| 20 | if lt v 0 |
| 21 | put ob 0 uchar 45 |
| 22 | k = write 1 ob 0 1 |
| 23 | pnum ulong neg v |
| 24 | else |
| 25 | pnum ulong v |
| 26 | end |
| 27 | end |
| 28 | fn main to int |
| 29 | r = enlarge P ulong 1152921504606846976 |
| 30 | plong r |
| 31 | pnum len P |
| 32 | r = enlarge P ulong 18446744073709551615 |
| 33 | plong r |
| 34 | r = enlarge P ulong 1152921504606846975 |
| 35 | plong r |
| 36 | pnum len P |
| 37 | r = enlarge U ulong 9223372036854775808 |
| 38 | plong r |
| 39 | r = enlarge U ulong 9223372036854775807 |
| 40 | plong r |
| 41 | pnum len U |
| 42 | r = enlarge P ulong 3 |
| 43 | plong r |
| 44 | put P 2 11 |
| 45 | r = enlarge P ulong 2305843009213693952 |
| 46 | plong r |
| 47 | pnum len P |
| 48 | pnum get P 2 |
| 49 | ret 5 |
| 50 | end |