code wiki / _hdl_build / _gamma_dd_probe.nx
_gamma_dd_probe.nx
buildroot/runtime/_hdl_build/_gamma_dd_probe.nx
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
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
structs
| none |
consts
| none |
functions
| 21 | func 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 } |
| 22 | func 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 } |
| 23 | func 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 } |
| 27 | func gd_expf(v: i64) -> i64 { return nx_f64_add(nx_f64_cosh(v), nx_f64_sinh(v)) } |
| 29 | func gd_lndd(w: i64, out: *i64) -> i64 |
| 38 | func gd_gamma(x: i64, c: *i64) -> i64 |
| 89 | func gd_ulp(a: i64, b: i64) -> i64 { if a >= b { return a - b } return b - a } called by 1: main |
| 90 | func main() -> i64 |