Open
Description
julia> Distances.evaluate(Euclidean(), Int16(-1360), Int16(-136))
ERROR: DomainError with -9152.0:
sqrt was called with a negative real argument but will only return a complex result if called with a complex argument. Try sqrt(Complex(x)).
Stacktrace:
[1] throw_complex_domainerror(f::Symbol, x::Float64)
@ Base.Math ./math.jl:33
[2] sqrt
@ ./math.jl:608 [inlined]
[3] sqrt
@ ./math.jl:1531 [inlined]
[4] eval_end
@ ~/.julia/packages/Distances/mlz7p/src/metrics.jl:336 [inlined]
[5] _evaluate
@ ~/.julia/packages/Distances/mlz7p/src/metrics.jl:314 [inlined]
[6] Euclidean
@ ~/.julia/packages/Distances/mlz7p/src/metrics.jl:331 [inlined]
[7] evaluate(dist::Euclidean, a::Int16, b::Int16)
@ Distances ~/.julia/packages/Distances/mlz7p/src/generic.jl:47
[8] top-level scope
@ REPL[32]:1
julia> Distances.eval_op(Euclidean(), Int16(-1360), Int16(-136))
-9152
Would be nice if instead of an error, the typemax is returned, ideally with a check whether the operations are incurring an overflow
Metadata
Metadata
Assignees
Labels
No labels