code wiki / _hdl_build / nx_mathspec_tan.nx
nx_mathspec_tan.nx
buildroot/runtime/_hdl_build/nx_mathspec_tan.nx
about
nx_mathspec_tan.nx -- SOVEREIGN SPEC EMITTER for the TAN kernel: every
constant from the 120-bit bigfloat (trig + tan oracle organs). No python,
no minimax: the small-residual polynomial uses the EXACT tangent-number
Taylor family tan d = d + sum_{n>=2} T_n d^(2n-1)/(2n-1)! with the integer
tangent numbers T_2..T_8 = 2 16 272 7936 353792 22368256 1903757312
(OEIS A000182, mathematical integers like k!); each coefficient divides by
2..(2n-1) one factor at a time (bf_div_small bound). |d| <= 1/16 -> 7
correction terms truncate below 2^-57 relative.
Kernel scheme (accurate-table + dd): pi/2 Cody-Waite 3-part reduce (same
21-zeroed HI/MID construction as the sincos spec) -> r dd; anchors a_j = j/8
(j = 0..6 covers [0, pi/4]); tan(a+d) = T + t*sec2(a)/(1 - T*t) with T and
sec2 carried hi/lo from this spec and the quotient refined in dd; odd
quadrants reconstruct -1/tan via a dd reciprocal.
Layout: c[0]=one c[1]=half c[2]=2/pi c[3]=HI c[4]=MID c[5]=LO c[6]=eight
c[7..13] anchors j/8 c[14..20] T_hi[j] = fl(tan(j/8))
c[21..27] T_lo[j] (signed) c[28..34] S_hi[j] = fl(1+tan^2(j/8))
c[35..41] S_lo[j] (signed) c[42..48] Q coeffs hi-first (T_8.. down to T_2)
license_tier: ORIGINAL
dependencies 5 imports · 0 importers
imports: nx_syscalls.nxnx_pattern_emit.nxnx_bigfloat120.nxnx_bigfloat120_div.nxnx_bigfloat120_trig.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
| 26 | const K_MAGIC_7936: i64 = 7936 |
| 27 | const K_MAGIC_353792: i64 = 353792 |
| 28 | const K_MAGIC_22368256: i64 = 22368256 |
| 29 | const K_MAGIC_1903757312: i64 = 1903757312 |
functions
| 31 | func mtn_wlit(fd: i64, v: i64) -> i64 |
| 41 | func mtn_emit_row(fd: i64, idx: i64, v: i64) -> i64 |
| 49 | func mtn_emit_hilo(fd: i64, idxhi: i64, idxlo: i64, a: *i64) -> i64 |
| 71 | func main() -> i64 |