rmuir opened a new pull request, #12010:
URL: https://github.com/apache/lucene/pull/12010

   See https://errorprone.info/bugpattern/LongDoubleConversion
   
   After seeing #12008 (Calling isNaN on long arguments), looked into this 
check and it finds a few other things.
   
   In general, we don't have many long-double conversions so the check is not 
particularly annoying or noisy, and as a library it is better not to play it 
fast and loose with floating point, even though java allows implicit cast of 
`long` to a `double`
   
   It finds two bugs:
   * BooleanPerceptron classifier was missing a call to `signum`, it passed the 
result of `Boolean.compareTo` directly to a scoring function, but the exact 
return values here are not guaranteed (only 0, negative, positive)
   * TestBytesWritesTrackingDirectoryWrapper was inadvertently using 
`assertEquals(double, double, double)` to compare two long values: no need to 
bring floating point into this test. If it fails it will be a lot less 
confusing.
   
   Otherwise I added explicit casts, with the exception of that pesky 
TestLucenePointsFormat.testEstimatePointCount which needs help around its math 
in general (I added TODOs, since it ends out getting duplicated about 6 times 
in the codebase right now due to backwards codecs) 
   
   Closes #12009
   


-- 
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: issues-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to