rmuir commented on code in PR #12036:
URL: https://github.com/apache/lucene/pull/12036#discussion_r1056883193
##########
lucene/core/src/java/org/apache/lucene/geo/GeoUtils.java:
##########
@@ -205,13 +205,7 @@ static boolean within90LonDegrees(double lon, double
minLon, double maxLon) {
public static int orient(double ax, double ay, double bx, double by, double
cx, double cy) {
double v1 = (bx - ax) * (cy - ay);
double v2 = (cx - ax) * (by - ay);
- if (v1 > v2) {
- return 1;
- } else if (v1 < v2) {
- return -1;
- } else {
- return 0;
- }
+ return Double.compare(v1, v2);
Review Comment:
there's also a semantic difference in how we use them. e.g. we call
`orient(...) * orient(...) * orient(...)` which is not legal to do with the
return value of Double.compare, unless you truncate it with a Math.signum too.
Double.compare can return any negative/positive value including ones that, when
multiplied, would overflow to +/-Inf.
--
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]