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 / sites / found-s-else-2.om
| 1 | note sites: found by a one-token change of a tracked program; reaches the omc error site in s-else (code 15) |
| 2 | fn isqrt_u32 x uint to uint |
| 3 | if eq x 0 |
| 4 | ret 0 |
| 5 | end |
| 6 | lx = ulong x |
| 7 | lo = ulong 1 |
| 8 | hi = ulong x |
| 9 | if gt hi 65536 |
| 10 | hi = ulong 65536 |
| 11 | end |
| 12 | ans = ulong 1 |
| 13 | while le lo hi |
| 14 | mid = div (add lo hi) 2 |
| 15 | sq = mul mid mid |
| 16 | a le sq lx |
| 17 | ans = mid |
| 18 | lo = add mid 1 |
| 19 | else |
| 20 | hi = sub mid 1 |
| 21 | end |
| 22 | end |
| 23 | ret uint ans |
| 24 | end |