This commit is contained in:
Looly 2024-08-09 12:37:16 +08:00
parent cfd60e564e
commit 82e16b52b8

View File

@ -36,8 +36,10 @@ public class CoordinateUtilTest {
public void wgs84toBd09Test2() {
// https://tool.lu/coordinate/
final CoordinateUtil.Coordinate coordinate = CoordinateUtil.wgs84ToBd09(122.99395597D, 44.99804071D);
Assert.assertEquals(123.00636516028885D, coordinate.getLng(), 0);
Assert.assertEquals(45.0063690918959D, coordinate.getLat(), 0);
Assert.assertEquals(123.00636516028885D, coordinate.getLng(), 0.00000000000001D);
// 不同jdk版本不同架构jdk, 精度有差异数值不完全相等这里增加精度控制delta
// 参考从Java Math底层实现看Arm与x86的差异https://yikun.github.io/2020/04/10/%E4%BB%8EJava-Math%E5%BA%95%E5%B1%82%E5%AE%9E%E7%8E%B0%E7%9C%8BArm%E4%B8%8Ex86%E7%9A%84%E5%B7%AE%E5%BC%82/
Assert.assertEquals(45.00636909189589D, coordinate.getLat(), 0.00000000000001D);
}
@Test