interplane.Get Omega
Read in your language

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

branch main Branches Tags History

omega-mv / bench / inference_cost / tasks / task05 / reference.om

23 lines · 275 bytes Raw Blame History
1fn isqrt_u32 x uint to uint
2if eq x 0
3ret 0
4end
5lx = ulong x
6lo = ulong 1
7hi = ulong x
8if gt hi 65536
9hi = ulong 65536
10end
11ans = ulong 1
12while le lo hi
13mid = div (add lo hi) 2
14sq = mul mid mid
15if le sq lx
16ans = mid
17lo = add mid 1
18else
19hi = sub mid 1
20end
21end
22ret uint ans
23end