Rewriting Lucene in C++ (Part 2): Bit-Exact Scoring — The Floating-Point Traps of BM25
The previous post covered format compatibility: an index Java can read and verify. This one covers the harder part — scores must be bit-exact. Why so strict? Because verification is reconciliation: the same queries must return the same Top-N documents and the same score bits. If a score differs by one ULP (unit in the last place), documents can swap places at the boundary, the reconciliation never lines up, and you lose your only source of truth. ...