Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aien-train/blob/main/evidence/ECOSYSTEM6/ref32-review/source/native/ref32/add32.om # 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 Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aien-train / evidence / ECOSYSTEM6 / ref32-review / source / native / ref32 / add32.om` 103 lines ยท 1567 bytes Raw Blame History 1 note SPDX-License-Identifier: AGPL-3.0-only 2 note Native IEEE binary32 addition over bit patterns, RNE and gradual underflow. 3 note Canonical positive quiet NaN; no foreign floating runtime or compiler f32 type. 4 fn ajam x ulong n ulong to ulong 5 if eq n 0 6 ret x 7 end 8 if ge n 64 9 if ne x 0 10 ret 1 11 end 12 ret 0 13 end 14 q = shr x n 15 mask = sub shl 1 n 1 16 if ne and x mask 0 17 q = or q 1 18 end 19 ret q 20 end 21 fn add32 aa ulong bb ulong to ulong 22 a = and aa `4294967295` 23 b = and bb `4294967295` 24 if or gt and a `2147483647` `2139095040` gt and b `2147483647` `2139095040` 25 ret `2143289344` 26 end 27 if lt and a `2147483647` and b `2147483647` 28 t = a 29 a = b 30 b = t 31 end 32 if eq and a `2147483647` `2139095040` 33 if and eq and b `2147483647` `2139095040` ne and xor a b `2147483648` 0 34 ret `2143289344` 35 end 36 ret a 37 end 38 if eq and b `2147483647` 0 39 if eq and a `2147483647` 0 40 ret and and a b `2147483648` 41 end 42 ret a 43 end 44 sign = and a `2147483648` 45 ea = and shr a 23 255 46 eb = and shr b 23 255 47 ma = and a `8388607` 48 mb = and b `8388607` 49 if eq ea 0 50 ea = 1 51 else 52 ma = or ma `8388608` 53 end 54 if eq eb 0 55 eb = 1 56 else 57 mb = or mb `8388608` 58 end 59 ma = shl ma 3 60 mb = shl mb 3 61 mb = ajam mb sub ea eb 62 if eq and xor a b `2147483648` 0 63 ma = add ma mb 64 if ge ma `134217728` 65 ma = ajam ma 1 66 ea = add ea 1 67 end 68 else 69 ma = sub ma mb 70 if eq ma 0 71 ret 0 72 end 73 while and lt ma `67108864` gt ea 1 74 ma = shl ma 1 75 ea = sub ea 1 76 end 77 end 78 q = shr ma 3 79 r = and ma 7 80 if gt r 4 81 q = add q 1 82 else 83 if eq r 4 84 if ne and q 1 0 85 q = add q 1 86 end 87 end 88 end 89 if ge q `16777216` 90 q = shr q 1 91 ea = add ea 1 92 end 93 if ge ea 255 94 ret or sign `2139095040` 95 end 96 if lt q `8388608` 97 ea = 0 98 end 99 q = and q `8388607` 100 ea = shl ea 23 101 q = or q ea 102 ret or sign q 103 end