interplane.Get Omega
Read in your language

aien-train

AIEN training programme: language-model history, GB10 constraints and the route to training on the project engine. Plans and runnable checks are distinguished.

Brought by drakestapleton

branch main Branches Tags History

aien-train / evidence / ECOSYSTEM6 / ref32-review / source / native / ref32 / add32.om

103 lines · 1567 bytes Raw Blame History
1note SPDX-License-Identifier: AGPL-3.0-only
2note Native IEEE binary32 addition over bit patterns, RNE and gradual underflow.
3note Canonical positive quiet NaN; no foreign floating runtime or compiler f32 type.
4fn ajam x ulong n ulong to ulong
5if eq n 0
6ret x
7end
8if ge n 64
9if ne x 0
10ret 1
11end
12ret 0
13end
14q = shr x n
15mask = sub shl 1 n 1
16if ne and x mask 0
17q = or q 1
18end
19ret q
20end
21fn add32 aa ulong bb ulong to ulong
22a = and aa 4294967295
23b = and bb 4294967295
24if or gt and a 2147483647 2139095040 gt and b 2147483647 2139095040
25ret 2143289344
26end
27if lt and a 2147483647 and b 2147483647
28t = a
29a = b
30b = t
31end
32if eq and a 2147483647 2139095040
33if and eq and b 2147483647 2139095040 ne and xor a b 2147483648 0
34ret 2143289344
35end
36ret a
37end
38if eq and b 2147483647 0
39if eq and a 2147483647 0
40ret and and a b 2147483648
41end
42ret a
43end
44sign = and a 2147483648
45ea = and shr a 23 255
46eb = and shr b 23 255
47ma = and a 8388607
48mb = and b 8388607
49if eq ea 0
50ea = 1
51else
52ma = or ma 8388608
53end
54if eq eb 0
55eb = 1
56else
57mb = or mb 8388608
58end
59ma = shl ma 3
60mb = shl mb 3
61mb = ajam mb sub ea eb
62if eq and xor a b 2147483648 0
63ma = add ma mb
64if ge ma 134217728
65ma = ajam ma 1
66ea = add ea 1
67end
68else
69ma = sub ma mb
70if eq ma 0
71ret 0
72end
73while and lt ma 67108864 gt ea 1
74ma = shl ma 1
75ea = sub ea 1
76end
77end
78q = shr ma 3
79r = and ma 7
80if gt r 4
81q = add q 1
82else
83if eq r 4
84if ne and q 1 0
85q = add q 1
86end
87end
88end
89if ge q 16777216
90q = shr q 1
91ea = add ea 1
92end
93if ge ea 255
94ret or sign 2139095040
95end
96if lt q 8388608
97ea = 0
98end
99q = and q 8388607
100ea = shl ea 23
101q = or q ea
102ret or sign q
103end