mirror of
https://github.com/duke-git/lancet.git
synced 2026-11-16 05:12:11 +08:00
fix(mathutil): preserve distances at extreme scales (#360)
This commit is contained in:
1 parent
ec11fdf345
commit
9b0a0caa75
2 files changed
+10
-5
No files matched your search
@@ -334,6 +334,15 @@ func TestRadianToAngle(t *testing.T) {
|
||||
assert.Equal(float64(45), result3)
|
||||
}
|
||||
|
||||
func TestPointDistanceExtremeScales(t *testing.T) {
|
||||
for _, scale := range []float64{1e200, 1e-200} {
|
||||
got := PointDistance(0, 0, 3*scale, 4*scale)
|
||||
if math.Abs(got/(5*scale)-1) > 1e-15 {
|
||||
t.Errorf("scale %g: got %g, want %g", scale, got, 5*scale)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestPointDistance(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
||||
Reference in new issue
Block a user