code wiki / _hdl_build / _gamma_dd_probe.nx

_gamma_dd_probe.nx

buildroot/runtime/_hdl_build/_gamma_dd_probe.nx

5991 B127 linesdepth 8pulls 15 transitivereach 0 importersview sourcekind probetopic gamma
docsdependenciesstructsconstsfunctions

about

_gamma_dd_probe.nx -- the DD-precision gamma probe (ME2-GAMMA-DD). The plain-f64 probe found 13 ulp; the named requirement was double-double lnGamma. This composes the authored kernels' dd primitives (_sh_expdd/_sh_mul2/_sh_2sum/_sh_scale from the sinhcosh module + nx_f64_log) into a dd lnGamma, and re-tests vs bf_gamma_f64. If max_ulp <= 4 the GAMMA_STIRLING template is safe to author at dd; else the gap is refined further. No emitter built on an unvalidated approach (design-intelligence). ln_dd(w) : hi = nx_f64_log(w); lo = (w - exp_dd(hi))/w (Newton correction) lnGamma_dd : (w-0.5)*ln_dd(w) [dd product] - w + 0.5ln2pi + series, kept dd Gamma : exp(lnGamma_hi)*(1+lnGamma_lo) / pull-up-product license_tier: ORIGINAL

dependencies 10 imports · 0 importers

nx_syscalls.nx nx_f64.nx nx_f64_div.nx nx_f64_cvt.nx nx_bigfloat120.nx nx_bigfloat120_div.nx nx_bigfloat120_gamma.nx _pm_gamma_spec.nx _pe_f64log.nx _pe_f64sinhcosh.nx _gamma_dd_probe.nx

imports: nx_syscalls.nxnx_f64.nxnx_f64_div.nxnx_f64_cvt.nxnx_bigfloat120.nxnx_bigfloat120_div.nxnx_bigfloat120_gamma.nx_pm_gamma_spec.nx_pe_f64log.nx_pe_f64sinhcosh.nx

imported by: nobody (leaf or entry point)

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

main gd_p sys_write sys_mmap pm_gamma_spec_fill bf_gamma_f64 bf_new sys_mmap ↻ bf_set_f64 bfg_gamma_pos bf_new ↻ bf_set_int bf_copy bf_cmp bf_is_zero bf_mul bf_is_zero ↻ bf_copy ↻ sys_mmap ↻ bf_add bf_is_zero ↻ bf_copy ↻ sys_mmap ↻ bf_shr2 bf_norm bfg_lngamma_big bf_new ↻ bf_set_int ↻ bf_copy ↻ bf_sub bf_is_zero ↻ bf_copy ↻ sys_mmap ↻ bf_shr2 ↻ bf_norm ↻ bfg_ln_big bf_new ↻ bf_copy ↻ bf_set_int ↻ bf_cmp ↻

structs

none

consts

none

functions

21func gd_p(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
called by 1: main calls 1: sys_write
22func gd_f(fd: i64, s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(fd,s,n); return 0 }
called by 1: main calls 1: sys_write
23func gd_n(fd: i64, v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m; sys_write(fd,"-" as *u8,1)}; let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48 as u8;k=1}; while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1}; var i: i64=0; while i<k{bb[i]=t[k-1-i];i=i+1}; sys_write(fd,bb,k); return 0 }
called by 1: main calls 2: sys_mmapsys_write
27func gd_expf(v: i64) -> i64 { return nx_f64_add(nx_f64_cosh(v), nx_f64_sinh(v)) }
29func gd_lndd(w: i64, out: *i64) -> i64
38func gd_gamma(x: i64, c: *i64) -> i64
89func gd_ulp(a: i64, b: i64) -> i64 { if a >= b { return a - b } return b - a }
called by 1: main
90func main() -> i64