Skip to content

Commit 5b62efe

Browse files
committed
Allow input vectors of different type
1 parent c4bc740 commit 5b62efe

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/haversine.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ end
1212

1313
const VecOrLengthTwoTuple{T} = Union{AbstractVector{T}, NTuple{2, T}}
1414

15-
function evaluate(dist::Haversine, x::VecOrLengthTwoTuple{T}, y::VecOrLengthTwoTuple{T}) where {T}
15+
function evaluate(dist::Haversine, x::VecOrLengthTwoTuple, y::VecOrLengthTwoTuple)
1616
length(x) == length(y) == 2 || haversine_error()
1717

1818
@inbounds begin
@@ -30,7 +30,7 @@ function evaluate(dist::Haversine, x::VecOrLengthTwoTuple{T}, y::VecOrLengthTwoT
3030
a = sin(Δφ/2)^2 + cos(φ₁)*cos(φ₂)*sin(Δλ/2)^2
3131

3232
# take care of floating point errors
33-
a = min(a, one(T))
33+
a = min(a, one(a))
3434

3535
# distance on the sphere
3636
2*dist.radius*atan2(a, (1-a))

0 commit comments

Comments
 (0)