Skip to content

Commit

Permalink
Update src/haversine.jl
Browse files Browse the repository at this point in the history
Co-authored-by: Milan Bouchet-Valat <nalimilan@club.fr>
  • Loading branch information
mkborregaard and nalimilan authored Dec 12, 2020
1 parent 74cfa17 commit 05acb7f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/haversine.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ function (dist::Haversine)(x::VecOrLengthTwoTuple, y::VecOrLengthTwoTuple)
2 * dist.radius * asin( min(a, one(a)) ) # take care of floating point errors
end

haversine(x::VecOrLengthTwoTuple, y::VecOrLengthTwoTuple, radius::Real = 6378137.0) = Haversine(radius)(x, y)
haversine(x::VecOrLengthTwoTuple, y::VecOrLengthTwoTuple, radius::Real=6378137.0) =
Haversine(radius)(x, y)

@noinline haversine_error() = throw(ArgumentError("expected both inputs to have length 2 in Haversine distance"))

0 comments on commit 05acb7f

Please sign in to comment.