diff --git a/Project.toml b/Project.toml index 05aa6b7..3cd234e 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "PiecewiseLinearApprox" uuid = "fcfa6960-8e2e-11e9-2cde-29dd09221fb3" authors = ["Richard Dennis "] -version = "0.1.6" +version = "0.1.7" [compat] julia = "^1.1" diff --git a/src/piecewise_linear.jl b/src/piecewise_linear.jl index 72c7c74..26408ad 100644 --- a/src/piecewise_linear.jl +++ b/src/piecewise_linear.jl @@ -46,14 +46,14 @@ const linear_nodes = piecewise_linear_nodes function bracket_nodes(x::Array{T,1},point::R) where {T <: AbstractFloat,R<:Number} - if point <= x[1] + if real(point) <= x[1] # Real is used because complex numbers are occasionally used in NLboxsolve.jl return (1,2) - elseif point >= x[end] + elseif real(point) >= x[end] return (length(x) - 1, length(x)) else y = 0 for i in x - if i < point + if i < real(point) y += 1 else break