diff --git a/src/interpolation_caches.jl b/src/interpolation_caches.jl index 6a5bcb58..22190f05 100644 --- a/src/interpolation_caches.jl +++ b/src/interpolation_caches.jl @@ -822,7 +822,7 @@ function BSplineInterpolation( p[end] = one(eltype(t)) for i in 2:n - s += √((t[i] - t[i - 1])^2 + (u[i] - u[i - 1])^2) + s += hypot(t[i] - t[i - 1], u[i] - u[i - 1]) l[i - 1] = s end if pVecType == :Uniform @@ -1059,7 +1059,7 @@ function BSplineApprox( p[end] = one(eltype(t)) for i in 2:n - s += √((t[i] - t[i - 1])^2 + (u[i] - u[i - 1])^2) + s += hypot(t[i] - t[i - 1], u[i] - u[i - 1]) l[i - 1] = s end if pVecType == :Uniform diff --git a/test/interpolation_tests.jl b/test/interpolation_tests.jl index 3677da4f..0c7d20d5 100644 --- a/test/interpolation_tests.jl +++ b/test/interpolation_tests.jl @@ -799,9 +799,9 @@ end A = @inferred(BSplineInterpolation(u, t, 2, :ArcLen, :Average)) - @test [A(25.0), A(80.0)] == [13.363814458968486, 10.685201117692609] - @test [A(190.0), A(225.0)] == [13.437481084762863, 11.367034741256463] - @test [A(t[1]), A(t[end])] == [u[1], u[end]] + @test [A(25.0), A(80.0)] ≈ [13.363814458968484, 10.685201117692609] + @test [A(190.0), A(225.0)] ≈ [13.437481084762863, 11.367034741256461] + @test [A(t[1]), A(t[end])] ≈ [u[1], u[end]] @test_throws ErrorException("BSplineInterpolation needs at least d + 1, i.e. 4 points.") BSplineInterpolation( u[1:3], t[1:3], 3, :Uniform, :Uniform)