You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by kw...@apache.org on 2016/06/22 14:16:36 UTC

[2/2] lucene-solr:branch_6x: LUCENE-7194: Ban Math.toRadians, Math.toDegrees

LUCENE-7194: Ban Math.toRadians, Math.toDegrees


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/388d388c
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/388d388c
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/388d388c

Branch: refs/heads/branch_6x
Commit: 388d388c990c8d9e05ec9ba9bc881fdc921e734b
Parents: 40ca6f1
Author: Karl Wright <Da...@gmail.com>
Authored: Wed Jun 22 10:16:22 2016 -0400
Committer: Karl Wright <Da...@gmail.com>
Committed: Wed Jun 22 10:16:22 2016 -0400

----------------------------------------------------------------------
 .../apache/lucene/spatial/geopoint/search/GeoPointTestUtil.java | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/388d388c/lucene/spatial/src/test/org/apache/lucene/spatial/geopoint/search/GeoPointTestUtil.java
----------------------------------------------------------------------
diff --git a/lucene/spatial/src/test/org/apache/lucene/spatial/geopoint/search/GeoPointTestUtil.java b/lucene/spatial/src/test/org/apache/lucene/spatial/geopoint/search/GeoPointTestUtil.java
index a8c4271..029c464 100644
--- a/lucene/spatial/src/test/org/apache/lucene/spatial/geopoint/search/GeoPointTestUtil.java
+++ b/lucene/spatial/src/test/org/apache/lucene/spatial/geopoint/search/GeoPointTestUtil.java
@@ -22,6 +22,7 @@ import java.util.Random;
 import org.apache.lucene.geo.GeoUtils;
 import org.apache.lucene.geo.Polygon;
 import org.apache.lucene.geo.Rectangle;
+import org.apache.lucene.util.SloppyMath;
 
 import com.carrotsearch.randomizedtesting.RandomizedContext;
 
@@ -212,8 +213,8 @@ final class GeoPointTestUtil {
         }
         double len = radius * (1.0 - radiusDelta + radiusDelta * random().nextDouble());
         //System.out.println("    len=" + len);
-        double lat = centerLat + len * Math.cos(Math.toRadians(angle));
-        double lon = centerLon + len * Math.sin(Math.toRadians(angle));
+        double lat = centerLat + len * Math.cos(SloppyMath.toRadians(angle));
+        double lon = centerLon + len * Math.sin(SloppyMath.toRadians(angle));
         if (lon <= GeoUtils.MIN_LON_INCL || lon >= GeoUtils.MAX_LON_INCL) {
           // cannot cross dateline: try again!
           continue newPoly;