Skip to content

Commit 025165f

Browse files
committed
Issue #5. NaN cannot happen.
1 parent 99588ce commit 025165f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/main/java/com/mapcode/Point.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Copyright (C) 2014 Stichting Mapcode Foundation (http://www.mapcode.com)
3-
*
3+
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
@@ -170,8 +170,10 @@ public static Point fromUniformlyDistributedRandomPoints(@Nonnull final Random r
170170
final double lonRad = Math.atan2(y, x);
171171

172172
// Convert radians to degrees.
173-
final double lat = Double.isNaN(latRad) ? 90.0 : (latRad * (180.0 / Math.PI));
174-
final double lon = Double.isNaN(lonRad) ? 180.0 : (lonRad * (180.0 / Math.PI));
173+
assert !Double.isNaN(latRad);
174+
assert !Double.isNaN(lonRad);
175+
final double lat = latRad * (180.0 / Math.PI);
176+
final double lon = lonRad * (180.0 / Math.PI);
175177
return fromMicroDeg(degToMicroDeg(lat), degToMicroDeg(lon));
176178
}
177179

0 commit comments

Comments
 (0)