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 / seed / ng / a64 / tests / ref / tsum.om

13 lines · 461 bytes Raw Blame History
1note tsum: ts(n) = ts(n - 1) + n, ts(0) = 0, on ulong (Omega wraps unsigned values: no check). ts(1000000) is
2note 500000500000 (Wolfram), more than 2^31 - 1, so main takes its low byte before `int` (whose check, chk.conv
3note trap 5, would otherwise fail): status 32. Under omc the recursion is a million calls deep and traps 6 (exit 106).
4fn ts n ulong to ulong
5if lt n 1
6ret n
7end
8r = ts sub n 1
9ret add r n
10end
11fn main to int
12ret int and ts 1000000 255
13end