code wiki / _hdl_build / nx_mathspec_pow.nx
nx_mathspec_pow.nx
buildroot/runtime/_hdl_build/nx_mathspec_pow.nx
about
nx_mathspec_pow.nx -- SOVEREIGN SPEC EMITTER for the POW kernel: every constant
computed on the 120-bit bigfloat; written to _pm_pow_spec.nx for the
MATH_KERNEL/POW emitter. No python, no minimax tables: the kernel's
correction polynomials use EXACT-RATIONAL Taylor families
L_j = 3/(2j+3) (log2 atanh-correction, |s| <= 0.101 -> 10 terms)
P_k = 2*B_{2k}/(2k)! (exp R(z)=z(e^z+1)/(e^z-1) Bernoulli form, 8 terms)
where B_2..B_16 = 1/6 -1/30 1/42 -1/30 5/66 -691/2730 7/6 -3617/510 (DLMF 24.2,
mathematical definitions like 1/k!). (2k)! division runs as a loop of small
divisors 2..2k (bf_div_small bound). The sqrt(3/2)/sqrt(3) anchor cuts come
from 53-step bigfloat binary search on sig^2 vs 3*2^103 / 3*2^104.
32-bit hi/lo splits (dp, cp, lg2) mask AFTER rounding; remainder via bf_sub.
Layout: c[0]=one c[1]=half c[2]=two c[3]=cut_sqrt15 c[4]=cut_sqrt3 c[5]=bp1
c[6]=dp_h c[7]=dp_l (log2(1.5) split) c[8]=cp_h c[9]=cp_l c[10]=cp(2/(3ln2))
c[11]=lg2 c[12]=lg2_h c[13]=lg2_l c[14..23]=L10..L1 (hi-first)
c[24..31]=P8..P1 (hi-first, signed) c[32]=three c[33]=1025.0 c[34]=1076.0
license_tier: ORIGINAL
dependencies 5 imports · 0 importers
imports: nx_syscalls.nxnx_pattern_emit.nxnx_bigfloat120.nxnx_bigfloat120_div.nxnx_bigfloat120_exp.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 23 | const K_MAGIC_2730: i64 = 2730 |
| 24 | const K_MAGIC_3617: i64 = 3617 |
| 25 | const K_MAGIC_1025: i64 = 1025 |
| 26 | const K_MAGIC_1076: i64 = 1076 |
functions
| 28 | func mpw_wlit(fd: i64, v: i64) -> i64 |
| 38 | func mpw_emit_row(fd: i64, idx: i64, v: i64) -> i64 |
| 47 | func mpw_emit_split(fd: i64, idxhi: i64, idxlo: i64, v: *i64) -> i64 |
| 60 | func mpw_sqrt_cut(small: i64, eshift: i64) -> i64 |
| 78 | func mpw_log2_15(out: *i64, ln2: *i64) -> i64 |
| 107 | func mpw_pk(out: *i64, bnum: i64, bden: i64, twok: i64) -> i64 |
| 121 | func main() -> i64 |