code wiki / (root) / nx_intlog.nx

nx_intlog.nx

buildroot/runtime/nx_intlog.nx

2655 B56 linesdepth 2pulls 2 transitivereach 60 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_intlog.nx -- INTEGER fixed-point base-2 logarithm (no floats anywhere -- the ecosystem's no-float doctrine). ilog2_1024(x) returns round(1024 * log2(x)) for x >= 1 via msb + 10 mantissa-squaring refinement steps (each step decides one fractional bit; y stays < 2^17 so y*y < 2^34 -- no overflow). The BM25/IDF ranking rung composes this: idf_q10(N, n_t) = ilog2_1024(N+1) - ilog2_1024(n_t) >= 0-ish, clamped at 0 (a term in every doc carries ~no signal -- correct BM25 behavior). license_tier: ORIGINAL

dependencies 1 imports · 3 importers

nx_syscalls.nx nx_intlog.nx nx_docportal_search_seg.nx nx_intlog_gate.nx nx_web_relevance_bench.nx

imports: nx_syscalls.nx

imported by: nx_docportal_search_seg.nxnx_intlog_gate.nxnx_web_relevance_bench.nx

structs

none

consts

none

functions

8func ilog2_1024(x0: i64) -> i64
33func idf_q10(bign: i64, nt: i64) -> i64
called by 2: dss_search_off_divmain calls 1: ilog2_1024
41func tfsat_q10(tf: i64) -> i64
called by 1: main
49func tfnorm_q10(tf: i64, normq10: i64) -> i64