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/omega-mv/blob/main/om/runtime/rx_route_core.om # 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 Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / om / runtime / rx_route_core.om` 46 lines ยท 1093 bytes Raw Blame History 1 om2 2 note rx_route_core.om -- Cognitive compute routing confidence binning and 3 note 95% Wilson score interval in pure OM-2. 4 note Replaces conf_bin, wilson_lower, wilson_upper in src/runtime/rx_route.c. 5 6 const WILSON_Z f64 1.959964 7 8 fn wilson_lo k ulong n ulong to f64 9 if eq n 0 10 ret 0.0f64 11 end 12 nn = f64 n 13 p = div f64 k nn 14 z2 = mul WILSON_Z WILSON_Z 15 c = add p div z2 mul 2.0f64 nn 16 t1 = div mul p sub 1.0f64 p nn 17 t2 = div z2 mul 4.0f64 mul nn nn 18 r = mul WILSON_Z fsqrt add t1 t2 19 ret div sub c r add 1.0f64 div z2 nn 20 end 21 22 export fn rx_rt_conf_bin conf ulong conf_one ulong bins ulong to ulong 23 if eq bins 0 24 ret 0 25 end 26 if eq conf_one 0 27 ret 0 28 end 29 if ge conf conf_one 30 ret sub bins 1 31 end 32 ret div mul conf bins conf_one 33 end 34 35 note Compute 95% Wilson lower (dst[0]) and upper (dst[1]) bounds as bitcast ulong. 36 export fn rx_rt_wilson k ulong n ulong dst edit ulong 2 to void 37 lo = wilson_lo k n 38 hi = f64 1.0f64 39 if ne n 0 40 if le k n 41 hi = sub 1.0f64 wilson_lo sub n k n 42 end 43 end 44 put dst 0 bitcast ulong lo 45 put dst 1 bitcast ulong hi 46 end