code wiki / (root) / nx_math.nx

nx_math.nx

buildroot/runtime/nx_math.nx

2161 B54 linesdepth 3pulls 4 transitivereach 51 importersview sourcekind librarytopic math
docsdependenciesstructsconstsfunctions

about

nx_math.nx -- canonical pure-integer math helpers. Single-source-of-truth for numeric utilities that were previously duplicated across nx_geom, nx_light, nx_pc, nx_theorems7, and likely many more. This is THE home of integer sqrt and friends. Consolidation principle (per CAPTAIN_MORONI + deduped-substrate doctrine): exactly one implementation per pure-math utility. All consumers import nx_math and call the canonical version. Equivalence verified via nx_func_compare: nx_geom_isqrt, nx_light_isqrt, nx_pc_isqrt, nx_th_isqrt all hashed to 5794444719011524842 (FNV-1a 64-bit, normalized). genealogy_id: newton_1669_general_method + heron_alexandria_70AD + bertrand_brent_iqsrt_handbook_1976 lineage_id: integer_newton_iteration + fixed_point_iteration axioms: NX_AX_ALG_DISTRIBUTIVITY (Newton step is rearrangement of (x + n/x)/2 = average of x and n/x, which converges monotonically to floor(sqrt(n)) by AM-GM inequality) + NX_AX_ORD_LEAST_UPPER_BOUND (the integer sqrt is the greatest integer y with y*y <= n -- well-defined by LUB on bounded sets of integers).

dependencies 2 imports · 4 importers

syscalls.nx nx_axioms.nx nx_math.nx nx_geom.nx nx_light.nx nx_pc.nx nx_qed_freek.nx

imports: syscalls.nxnx_axioms.nx

imported by: nx_geom.nxnx_light.nxnx_pc.nxnx_qed_freek.nx

structs

none

consts

none

functions

44func nx_math_isqrt(n: i64) -> i64