code wiki / _hdl_build / nx_mathspec_atan.nx
nx_mathspec_atan.nx
buildroot/runtime/_hdl_build/nx_mathspec_atan.nx
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
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
structs
| none |
consts
| 25 | const K_MAGIC_999999: i64 = 999999 |
| 26 | const K_MAGIC_5625: i64 = 5625 |
functions
| 28 | func mat_wlit(fd: i64, v: i64) -> i64 |
| 38 | func mat_emit_row(fd: i64, idx: i64, v: i64) -> i64 |
| 46 | func mat_atan_j8(out: *i64, j: i64) -> i64 |
| 69 | func mat_emit_hilo(fd: i64, idxhi: i64, idxlo: i64, a: *i64) -> i64 |
| 91 | func main() -> i64 |