code wiki / _hdl_build / nx_bigfloat_register.nx

nx_bigfloat_register.nx source

↩ module page · 40 lines · 2935 B

1// nx_bigfloat_register.nx -- registers ME3 rung 1 (sovereign bigfloat oracle) via the 2// Librarian. ENGINEER evidence = the regen gate re-run here (203/203 + 196/196). 3// license_tier: ORIGINAL 4import "nx_cap_register.nx" 5import "nx_capreg_librarian.nx" 6import "nx_syscalls.nx" 7 8func bfreg_run(path: *u8) -> i64 { 9 let pid: i64 = sys_fork() 10 if pid == 0 { 11 let dn: i64 = sys_openat_wr("/dev/null" as *u8, 0x1a4) 12 if dn >= 0 { sys_dup3(dn, 1, 0); sys_dup3(dn, 2, 0) } 13 let argv: *i64 = sys_mmap(32) as *i64; argv[0] = path as i64; argv[1] = 0 14 let envp: *i64 = sys_mmap(16) as *i64; envp[0] = 0 15 sys_execve(path, argv, envp); sys_exit(127) 16 } 17 let st: *i64 = sys_mmap(16) as *i64 18 sys_wait4(pid, st, 0) 19 return st[0] 20} 21 22func main() -> i64 { 23 var allok: i64 = 1 24 if bfreg_run("/tmp/_bf_regen_gate_authored.sov.elf" as *u8) != 0 { allok = 0 } 25 if bfreg_run("/tmp/_f64_exp_gate_authored.sov.elf" as *u8) != 0 { allok = 0 } 26 cr_w(1, "ENGINEER: bigfloat regen (399 vectors) + exp ULP re-gate pass=" as *u8); cr_wn(1, allok); cr_w(1, "\n" as *u8) 27 let eng: i64 = ig_engineer(1, 1, 1, allok) 28 let dec: i64 = ig_decision(eng, ig_council(eng, 1, 1, 2), 1) 29 if dec != IG_INGEST { cr_w(1, "HELD\n" as *u8); sys_exit(1) } 30 if cr_can_register(5, 2, 6, dec) != 1 { cr_w(1, "REFUSED\n" as *u8); sys_exit(1) } 31 let lp: *u8 = "/tmp/nishi_cap_registry.log" as *u8 32 let jp: *u8 = "knowledge/status/cap_registry_durable.log" as *u8 33 let idx: i64 = cl_next_idx(lp, jp) 34 let ok: i64 = cl_register_dual(lp, jp, idx, 5, 35 2, "GEN BIGFLOAT120-SOVEREIGN-ORACLE (ME3 rung 1; LAST math-arc py debt CLOSED; operator no-py law) -- nx_bigfloat120 (+_div/_exp/_ln): fixed-120-bit positive-significand float on pure i64 two-word arithmetic (30-bit-limb 240-bit mul, bit-serial 121-bit div, small-int mul/div w/ extension digit); EVERY CONSTANT SELF-COMPUTED (ln2=2*atanh(1/3) 39 odd terms; sqrt2 split = digit-pair isqrt of 2^105); exp via bigfloat range-reduce + 30-term Taylor + reciprocal trick (positive-terms-only core); ln via exact-sign atanh(s)+k*ln2. GATE _bf_regen_gate_authored: reproduces ALL mpmath-born vectors 203/203 exp + 196/196 log = anchor transferred, vector regeneration nishi-only. EXCEED: the sovereign rung CAUGHT mpmath float() double-rounding a subnormal (exp i=164, true frac .6399@200dps; stored 68C wrong, bigfloat 68D right) -- the replacement is MORE correct than the borrowed lane; vector corrected, nx_f64_exp re-gated max-ulp=1 vs corrected truth. Unlocks: MATH_KERNEL emitter specs (sin/cos/atan/gamma/erf) with nishi-only oracles; ME3 rung 2 = arbitrary limbs on bigint. Composes CAPREG265/276/278" as *u8) 36 if ok != 1 { cr_w(1, "DUAL-WRITE FAILED\n" as *u8); sys_exit(1) } 37 cr_w(1, "CAPREG idx=" as *u8); cr_wn(1, idx); cr_w(1, " REGISTERED (sovereign bigfloat oracle, py lane retired)\n" as *u8) 38 sys_exit(0) 39 return 0 40}