code wiki / (root) / nx_bigfloat120_trig.nx

nx_bigfloat120_trig.nx

buildroot/runtime/nx_bigfloat120_trig.nx

7556 B218 linesdepth 4pulls 4 transitivereach 31 importersview sourcekind librarytopic bigfloat120
docsdependenciesstructsconstsfunctions

about

nx_bigfloat120_trig.nx -- SOVEREIGN trig oracle on the 120-bit bigfloat: pi by Machin's formula, sin/cos by pi/2 reduction + Taylor. No imported constants: pi = 16*atan(1/5) - 4*atan(1/239) (Machin 1706; series self-computed) Alternating series run on TWO positive accumulators (core is positive-only), subtracted once at the end -- no catastrophic cancellation (neg/pos ratio is bounded well below 1 for 1/n arguments and r <= pi/4). Self-anchor: the trig gate's phase 0 checks sin^2 + cos^2 = 1 to < 2^-110 at random points -- an internal-consistency proof that needs no external oracle. v1 domain: |x| < 2^20 (the f64 kernel's 3-part Cody-Waite validity range); huge-argument reduction (Payne-Hanek class) is a named follow-on rung. license_tier: ORIGINAL

dependencies 4 imports · 25 importers

nx_syscalls.nx nx_tier.nx nx_bigfloat120.nx nx_bigfloat120_div.nx nx_bigfloat120_trig.nx _bf_atan_gate_authored.nx _bf_erf_gate_authored.nx _bf_erfc_oracle_gate.nx _bf_gamma_gate_authored.nx _bf_tan_gate_authored.nx _bf_trig_gate_authored.nx _f64_atan_gate_authored.nx _f64_atan_gate_emitted.nx _f64_erf_full_gate.nx _f64_erf_gate_authored.nx

diagram shows first 10 each side; +0 more imports, +15 more importers in the complete lists below.

imports: nx_syscalls.nxnx_tier.nxnx_bigfloat120.nxnx_bigfloat120_div.nx

imported by: _bf_atan_gate_authored.nx_bf_erf_gate_authored.nx_bf_erfc_oracle_gate.nx_bf_gamma_gate_authored.nx_bf_tan_gate_authored.nx_bf_trig_gate_authored.nx_f64_atan_gate_authored.nx_f64_atan_gate_emitted.nx_f64_erf_full_gate.nx_f64_erf_gate_authored.nx_f64_erfc_gate.nx_f64_sincos_gate_authored.nx_f64_tan_gate_authored.nx_gprobe.nx_tn_probe.nxnx_bigfloat120_atan.nxnx_bigfloat120_erfc.nxnx_bigfloat120_gamma.nxnx_bigfloat120_tan.nxnx_mathspec_atan.nxnx_mathspec_erf.nxnx_mathspec_erfc.nxnx_mathspec_gamma.nxnx_mathspec_sincos.nxnx_mathspec_tan.nx

structs

none

consts

19const K_MAGIC_57121: i64 = 57121
20const K_MAGIC_2047: i64 = 2047
21const K_MAGIC_1043: i64 = 1043

functions

25func bf_atan_inv(out: *i64, n: i64, terms: i64) -> i64
58func bf_pi(out: *i64) -> i64
69func bf_sin_r(out: *i64, r: *i64) -> i64
99func bf_cos_r(out: *i64, r: *i64) -> i64
134func _bf_trig_reduce(r: *i64, kq: *i64, xabs: *i64) -> i64
158func bf_sin_f64(x: i64) -> i64
191func bf_cos_f64(x: i64) -> i64