nx_intlog.nx
buildroot/runtime/nx_intlog.nx
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
imports: nx_syscalls.nx
imported by: nx_docportal_search_seg.nxnx_intlog_gate.nxnx_web_relevance_bench.nx
structs
| none |
consts
| none |
functions
| 8 | func ilog2_1024(x0: i64) -> i64 |
| 33 | func idf_q10(bign: i64, nt: i64) -> i64 |
| 41 | func tfsat_q10(tf: i64) -> i64 called by 1: main |
| 49 | func tfnorm_q10(tf: i64, normq10: i64) -> i64 |