leerho opened a new pull request, #816:
URL: https://github.com/apache/datasketches-java/pull/816

   `Util.invPow2(exp)` builds 2^(-exp) from its IEEE 754 bits: 
`Double.longBitsToDouble((1023L - exp) << 52)`. That is exact for exp 0..1022. 
At exp = 1023 the exponent field becomes 0 and the result is 0.0, not 
2^(-1023), which is a subnormal and can't be built this way. The javadoc and 
the range check allowed 1023.
   
   **Change:**
   - the range check now rejects exp > 1022 (`(exp | (1022 - exp)) < 0`), with 
the message updated;
   - the javadoc gives the range 0..1022, says why, and adds `@throws`.
   
   **Callers:** HLL, HllMap and CPC all pass exp below 64, so their behavior is 
unchanged.
   
   **Tests (`UtilTest`):**
   - 1023 and `Integer.MAX_VALUE` are rejected;
   - `invPow2(1022)` equals `Double.MIN_NORMAL`;
   - every exp from 0 to 1022 matches `Math.scalb(1.0, -exp)` bit for bit.
   
   The full suite passes (2,449). `javac -Xlint:all -Xdoclint:all,-missing` 
adds no warnings to `Util.java`.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to