-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve Float32
support
#415
Comments
Couldn't tests be written to enforce a Float32 (and a Float8 and Float16 "just in case") support? IntervalArithmetic.jl/test/interval_tests/bisect.jl Lines 1 to 32 in a1cbb81
would became using IntervalArithmetic
using Test
@testset "`bisect` function" begin
FloatTypes = [Float8, Float16, Float32, Float64]
for T in FloatTypes
X = 0..1
@test bisect(X, T(0.5)) == (T(0)..T(0.5), T(0.5)..T(1))
@test bisect(X, T(0.25)) == (T(0)..T(0.25), T(0.25)..T(1))
@test bisect(X) == (interval(T(0.0), T(0.49609375)), interval(T(0.49609375), T(1.0)))
# [...]
end
end |
Yes that's a great idea. (Note that |
With julia 1.6.7 julia> interval(Float16(1))/interval(Float16(0.1))
ERROR: MethodError: no method matching rounding_raw(::Type{Float16})
Closest candidates are:
rounding_raw(::Type{BigFloat}) at mpfr.jl:121
rounding_raw(::Type{var"#s77"} where var"#s77"<:Union{Float32, Float64}) at rounding.jl:155
Stacktrace:
[1] setrounding(f::IntervalArithmetic.var"#29#30"{Float16, Float16}, #unused#::Type{Float16}, rounding::RoundingMode{:Down})
@ Base.Rounding ./rounding.jl:173
[2] /(#unused#::IntervalArithmetic.IntervalRounding{:tight}, a::Float16, b::Float16, #unused#::RoundingMode{:Down})
@ IntervalArithmetic ~/.julia/packages/IntervalArithmetic/EquAX/src/intervals/rounding.jl:177
[3] /(a::Float16, b::Float16, r::RoundingMode{:Down})
@ IntervalArithmetic ~/.julia/packages/IntervalArithmetic/EquAX/src/intervals/rounding.jl:278
[4] /(a::Interval{Float16}, b::Interval{Float16})
@ IntervalArithmetic ~/.julia/packages/IntervalArithmetic/EquAX/src/intervals/arithmetic.jl:183
[5] top-level scope
@ REPL[16]:1 Works with julia 1.10.2 |
What version of IntervalArithmetic are you using? (I guess it is not v0.22.11, since it restricts to using Julia 1.9 or above) |
[d1acc4aa] IntervalArithmetic v0.20.9 With julia LTS (1.6.7), this package cannot be updated. |
As mentioned, to use more recent versions (which I believe solved the problem reported) you need at least Julia v1.9; I suggest to upgrade to Julia 1.10... |
Yeah, I saw that with julia 1.10.2 and IntervalArithmetic v0.22.11 it works. Just giving some more info on this issue. |
Interval{Float32}
support is very patchy, c.f. e.g. #414Float16
is less useful since arithmetic operations onFloat16
just promote toFloat32
anyway.The text was updated successfully, but these errors were encountered: