code wiki / _hdl_build / nx_mathspec_atan.nx

nx_mathspec_atan.nx

buildroot/runtime/_hdl_build/nx_mathspec_atan.nx

5153 B160 linesdepth 6pulls 7 transitivereach 0 importersview sourcekind tooltopic mathspec
docsdependenciesstructsconstsfunctions

about

nx_mathspec_atan.nx -- SOVEREIGN SPEC EMITTER for the ATAN kernel: every constant computed on the 120-bit bigfloat (oracle organ nx_bigfloat120_atan), written to _pm_atan_spec.nx for the MATH_KERNEL/ATAN emitter. No python. Kernel scheme (accurate-table): anchors c_j = j/8, j = 0..20. For x < 41/16 the kernel takes j = nearest(8x), t = (x - c_j)/(1 + x*c_j) (|t| <= 1/16, x - c_j Sterbenz-exact), atan(x) = A_hi[j] + (A_lo[j] + P(t)) with P an 8-coeff odd Taylor poly (truncation < 2^-64 rel). For x >= 41/16 it folds atan(x) = pi/2 - atan(1/x); there 1/x < 0.4 so the fold target sits 2 binades below the result and the transferred error is damped 4x. Layout: c[0]=one c[1]=half c[2]=eight c[3]=pi2_hi c[4]=pi2_lo c[5]=cut(41/16) c[6..26] anchors j/8 (j=0..20) c[27..47] A_hi[j] = fl(atan(j/8)) c[48..68] A_lo[j] = fl(atan(j/8) - A_hi[j]) (signed) c[69..76] poly coeffs hi-first: -1/15 1/13 -1/11 1/9 -1/7 1/5 -1/3 1 NEGATIVE literals emitted in `0 - N` form (unary-minus literal landmine). license_tier: ORIGINAL

dependencies 6 imports · 0 importers

nx_syscalls.nx nx_pattern_emit.nx nx_bigfloat120.nx nx_bigfloat120_div.nx nx_bigfloat120_trig.nx nx_bigfloat120_atan.nx nx_mathspec_atan.nx

imports: nx_syscalls.nxnx_pattern_emit.nxnx_bigfloat120.nxnx_bigfloat120_div.nxnx_bigfloat120_trig.nxnx_bigfloat120_atan.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main sys_openat_wr sys_exit pe_w sys_write bf_new sys_mmap bf_set_int mat_emit_row pe_w ↻ pe_wn sys_mmap ↻ sys_write ↻ mat_wlit pe_w ↻ pe_wn ↻ bf_to_f64 bf_is_zero bf_copy bf_pi bf_new ↻ bf_atan_inv bf_new ↻ bf_set_int ↻ bf_div_small bf_is_zero ↻ bf_copy ↻ bf_norm bf_mul bf_is_zero ↻ bf_copy ↻ sys_mmap ↻ bf_copy ↻ bf_add bf_is_zero ↻ bf_copy ↻ sys_mmap ↻ bf_shr2 bf_norm ↻ bf_sub

structs

none

consts

25const K_MAGIC_999999: i64 = 999999
26const K_MAGIC_5625: i64 = 5625

functions

28func mat_wlit(fd: i64, v: i64) -> i64
called by 1: mat_emit_row calls 2: pe_wpe_wn
38func mat_emit_row(fd: i64, idx: i64, v: i64) -> i64
called by 2: mat_emit_hilomain calls 3: pe_wpe_wnmat_wlit
46func mat_atan_j8(out: *i64, j: i64) -> i64
69func mat_emit_hilo(fd: i64, idxhi: i64, idxlo: i64, a: *i64) -> i64
91func main() -> i64