Open
Description
Describe the bug 🐞
In previous versions of DataInterpolations (at least v6.0), I could do a LinearInterpolation where one node was at -Inf, and as long as I asked for the value at the other node, there was no problem. Now it throws an InexactError.
Expected behavior
It should give the value at the non-infinite node.
Minimal Reproducible Example 👇
x = [-Inf, 0.0]
y = [-1.0, 1.0]
itp = DataInterpolations.LinearInterpolation(y, x)
itp(0.0) # this gave 1.0 in v6.0.0
Error & Stacktrace
ERROR: InexactError: Int64(NaN)
Stacktrace:
[1] Int64
@ ./float.jl:994 [inlined]
[2] convert
@ ./number.jl:7 [inlined]
[3] _round_convert
@ ./rounding.jl:480 [inlined]
[4] round
@ ./rounding.jl:479 [inlined]
[5] round
@ ./rounding.jl:477 [inlined]
[6] Guesser
@ ~/.julia/packages/FindFirstFunctions/n3FjO/src/FindFirstFunctions.jl:250 [inlined]
[7] searchsortedlastcorrelated(v::Vector{Float64}, x::Float64, guess::FindFirstFunctions.Guesser{Vector{Float64}})
@ FindFirstFunctions ~/.julia/packages/FindFirstFunctions/n3FjO/src/FindFirstFunctions.jl:296
[8] #get_idx#56
@ ~/.julia/packages/DataInterpolations/C8cNn/src/interpolation_utils.jl:184 [inlined]
[9] get_idx
@ ~/.julia/packages/DataInterpolations/C8cNn/src/interpolation_utils.jl:179 [inlined]
[10] _interpolate(A::DataInterpolations.LinearInterpolation{…}, t::Float64, iguess::FindFirstFunctions.Guesser{…})
@ DataInterpolations ~/.julia/packages/DataInterpolations/C8cNn/src/interpolation_methods.jl:16
[11] _interpolate
@ ~/.julia/packages/DataInterpolations/C8cNn/src/interpolation_methods.jl:4 [inlined]
[12] (::DataInterpolations.LinearInterpolation{Vector{…}, Vector{…}, Vector{…}, Vector{…}, Float64, (1,)})(t::Float64)
@ DataInterpolations ~/.julia/packages/DataInterpolations/C8cNn/src/DataInterpolations.jl:24
[13] top-level scope
@ REPL[7]:1
Some type information was truncated. Use `show(err)` to see complete types.
Environment (please complete the following information):
- Output of
using Pkg; Pkg.status()
Status `/private/var/folders/2s/htzp96d529l9s2yxw3_wnhdc0000gq/T/jl_UTDLH1/Project.toml`
[82cc6244] DataInterpolations v6.6.0
- Output of
using Pkg; Pkg.status(; mode = PKGMODE_MANIFEST)
Status `/private/var/folders/2s/htzp96d529l9s2yxw3_wnhdc0000gq/T/jl_UTDLH1/Manifest.toml`
[bbf7d656] CommonSubexpressions v0.3.1
[a8cc5b0e] Crayons v4.1.1
[9a962f9c] DataAPI v1.16.0
[82cc6244] DataInterpolations v6.6.0
[e2d170a0] DataValueInterfaces v1.0.0
[163ba53b] DiffResults v1.1.0
[b552c78f] DiffRules v1.15.1
[ffbed154] DocStringExtensions v0.9.3
[64ca27bc] FindFirstFunctions v1.4.1
[f6369f11] ForwardDiff v0.10.38
[92d709cd] IrrationalConstants v0.2.2
[82899510] IteratorInterfaceExtensions v1.0.0
[692b3bcd] JLLWrappers v1.6.1
[b964fa9f] LaTeXStrings v1.4.0
[2ab3a3ac] LogExpFunctions v0.3.28
[1914dd2f] MacroTools v0.5.13
[77ba4419] NaNMath v1.0.2
[bac558e1] OrderedCollections v1.6.3
[aea7be01] PrecompileTools v1.2.1
[21216c6a] Preferences v1.4.3
[08abe8d2] PrettyTables v2.4.0
[3cdcf5f2] RecipesBase v1.3.4
[189a3867] Reexport v1.2.2
[276daf66] SpecialFunctions v2.4.0
[1e83bf80] StaticArraysCore v1.4.3
[892a3eda] StringManipulation v0.4.0
[3783bdb8] TableTraits v1.0.1
[bd369af6] Tables v1.12.0
[efe28fd5] OpenSpecFun_jll v0.5.5+0
[0dad84c5] ArgTools v1.1.2
[56f22d72] Artifacts v1.11.0
[2a0f44e3] Base64 v1.11.0
[ade2ca70] Dates v1.11.0
[f43a241f] Downloads v1.6.0
[7b1f6079] FileWatching v1.11.0
[b27032c2] LibCURL v0.6.4
[76f85450] LibGit2 v1.11.0
[8f399da3] Libdl v1.11.0
[37e2e46d] LinearAlgebra v1.11.0
[56ddb016] Logging v1.11.0
[d6f4376e] Markdown v1.11.0
[ca575930] NetworkOptions v1.2.0
[44cfe95a] Pkg v1.11.0
[de0858da] Printf v1.11.0
[9a3f8284] Random v1.11.0
[ea8e919c] SHA v0.7.0
[fa267f1f] TOML v1.0.3
[a4e569a6] Tar v1.10.0
[cf7118a7] UUIDs v1.11.0
[4ec0a83e] Unicode v1.11.0
[e66e0078] CompilerSupportLibraries_jll v1.1.1+0
[deac9b47] LibCURL_jll v8.6.0+0
[e37daf67] LibGit2_jll v1.7.2+0
[29816b5a] LibSSH2_jll v1.11.0+1
[c8ffd9c3] MbedTLS_jll v2.28.6+0
[14a3606d] MozillaCACerts_jll v2023.12.12
[4536629a] OpenBLAS_jll v0.3.27+1
[05823500] OpenLibm_jll v0.8.1+2
[83775a58] Zlib_jll v1.2.13+1
[8e850b90] libblastrampoline_jll v5.11.0+0
[8e850ede] nghttp2_jll v1.59.0+0
[3f19e933] p7zip_jll v17.4.0+2
- Output of
versioninfo()
Julia Version 1.11.1
Commit 8f5b7ca12ad (2024-10-16 10:53 UTC)
Build Info:
Official https://julialang.org/ release
Platform Info:
OS: macOS (x86_64-apple-darwin22.4.0)
CPU: 8 × Intel(R) Core(TM) i7-1068NG7 CPU @ 2.30GHz
WORD_SIZE: 64
LLVM: libLLVM-16.0.6 (ORCJIT, icelake-client)
Threads: 8 default, 0 interactive, 4 GC (on 8 virtual cores)
Environment:
JULIA_EDITOR = code
JULIA_NUM_THREADS = 8
Additional context
Making @orso82 aware