code wiki / (root) / nx_f64.nx

nx_f64.nx

buildroot/runtime/nx_f64.nx

14500 B436 linesdepth 2pulls 2 transitivereach 225 importersview sourcekind librarytopic f64
docsdependenciesstructsconstsfunctions

about

nx_f64.nx -- IEEE 754 binary64 (double-precision float) bits-up. L5 of the bits-up numeric tower (docs/NISHI_BITS_UP_NUMERIC_TOWER_ROADMAP.md) and ME0 keystone of the math-engine-exceed ladder (DLMF/GAMS-class special functions all sit on binary64 or better). Pure i64 substrate: no libm, no soft-float stubs, no compiler builtins. Bit layout (IEEE 754-2019 binary64): bit 63: sign bits 62..52: exponent (biased 1023; 0 = subnormal/zero; 2047 = inf/NaN) bits 51..0: mantissa (52 bits; implicit leading 1 for normals) Storage: an f64 value IS the i64 holding its bit pattern (full width -- unlike f32-in-low-32-bits, raw f64 i64s go negative when sign=1; all field extraction masks after shifting, so arithmetic-shift fill is harmless). The 53x53-bit significand product (106 bits) exceeds i64. We split each significand 26/27 bits so every partial product and partial sum stays under 2^63 (verified at runtime by _f64_probe before this file was authored). CORRECTNESS BAR (above the f32 v1 family): subnormal inputs are pre-normalized, subnormal outputs are denormalized BEFORE rounding (no double-rounding), so add/sub/mul here are correctly rounded round-to- nearest-even across the whole domain. Gate: _f64_gate_authored KATs vs hardware-IEEE oracle bit patterns. File layout note: division lives in nx_f64_div.nx and sqrt in nx_f64_sqrt.nx, mirroring the f32 family split that sidesteps the nxc2 same-file mul+div codegen quirk (see nx_f32_div.nx header). genealogy_id: ieee754_2019_binary64 + goldberg_1991_csur + muller_handbook_fp_2018 (referenced, not copied) license_tier: ORIGINAL

dependencies 2 imports · 49 importers

nx_syscalls.nx nx_tier.nx nx_f64.nx _ab_mk_erf.nx _bf_gamma_gate_authored.nx _bf_pow_gate_authored.nx _bf_sinhcosh_gate_authored.nx _bf_tan_gate_authored.nx _f64_atan_gate_authored.nx _f64_atan_gate_emitted.nx _f64_exp_gate_authored.nx _f64_gate_authored.nx _f64_log_gate_authored.nx

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

imports: nx_syscalls.nxnx_tier.nx

imported by: _ab_mk_erf.nx_bf_gamma_gate_authored.nx_bf_pow_gate_authored.nx_bf_sinhcosh_gate_authored.nx_bf_tan_gate_authored.nx_f64_atan_gate_authored.nx_f64_atan_gate_emitted.nx_f64_exp_gate_authored.nx_f64_gate_authored.nx_f64_log_gate_authored.nx_f64_pow_gate_authored.nx_f64_quad_gate.nx_f64_rootfind_gate.nx_f64_sincos_gate_authored.nx_f64_sinhcosh_gate_authored.nx_f64_soak_gate_authored.nx_f64_tan_gate_authored.nx_gamma_dd_probe.nx_gamma_gate_authored.nx_gamma_probe.nx_pe_f64atan.nx_pe_f64erf.nx_pe_f64erf_full.nx_pe_f64erfc.nx_pe_f64gamma.nx_pe_f64gamma_refl.nx_pe_f64igammaq.nx_pe_f64log.nx_pe_f64pow.nx_pe_f64sincos.nx_pe_f64sinhcosh.nx_pe_f64tan.nx_pw_probe.nx_rational_gate.nx_wb_mathk.nxnx_bd_calc.nxnx_dd_verify.nxnx_f64_cvt.nxnx_f64_div.nxnx_f64_exp.nxnx_f64_log2.nxnx_f64_quad.nxnx_f64_rootfind.nxnx_f64_sqrt.nxnx_f64_v8kat_gate.nxnx_hyp_audio.nxnx_js_f64.nxnx_uiq_color.nxnx_vcodec_msu_ours13.nx

structs

none

consts

38const NX_F64_CLS_ZERO: nx_int = 0
39const NX_F64_CLS_NORMAL: nx_int = 1
40const NX_F64_CLS_SUBNORMAL: nx_int = 2
41const NX_F64_CLS_INF: nx_int = 3
42const NX_F64_CLS_NAN: nx_int = 4
44const NX_F64_EXP_SHIFT: i64 = 52
45const NX_F64_EXP_BIAS: i64 = 1023
46const NX_F64_EXP_MAXF: i64 = 2047 // exponent field all-ones
47const NX_F64_MANT_MASK: i64 = 0x000FFFFFFFFFFFFF // low 52 bits
48const NX_F64_IMPLICIT_1: i64 = 0x0010000000000000 // 1 << 52
49const NX_F64_SIG_TOP: i64 = 0x0020000000000000 // 1 << 53
50const NX_F64_INF_RAW: i64 = 0x7FF0000000000000
51const NX_F64_NAN_RAW: i64 = 0x7FF8000000000000 // canonical quiet NaN
52const NX_F64_ABS_MASK: i64 = 0x7FFFFFFFFFFFFFFF

functions

57func nx_f64_sign(raw: i64) -> i64
61func nx_f64_exp_field(raw: i64) -> i64
65func nx_f64_mant_field(raw: i64) -> i64
69func nx_f64_classify(raw: i64) -> nx_int
83func nx_f64_is_nan(raw: i64) -> nx_int
88func nx_f64_is_inf(raw: i64) -> nx_int
calls 1: nx_f64_classify
93func nx_f64_is_zero(raw: i64) -> nx_int
98func nx_f64_neg(raw: i64) -> i64
102func nx_f64_abs(raw: i64) -> i64
called by 1: jf64_to_str
108func nx_f64_eq(a: i64, b: i64) -> nx_int
120func nx_f64_lt(a: i64, b: i64) -> nx_int
151func nx_f64_gt(a: i64, b: i64) -> nx_int
called by 2: ev_binop_f64bi_sort_cmp calls 1: nx_f64_lt
163func _f64_round_pack(sign: i64, eo_in: i64, mant_in: i64, guard_in: i64, sticky_in: i64) -> i64
226func nx_f64_mul(a: i64, b: i64) -> i64
313func nx_f64_add(a: i64, b: i64) -> i64
434func nx_f64_sub(a: i64, b: i64) -> i64