From 06f49c22ad2c4373f420fd044964ea094736c756 Mon Sep 17 00:00:00 2001 From: "Michael F. Herbst" Date: Sat, 7 May 2022 16:14:40 +0200 Subject: [PATCH] Dispatch for exponentiation on Float32 intervals (#482) * Dispatch for exponentiation on Float32 intervals * Update functions.jl * ups * add test Co-authored-by: lucaferranti <49938764+lucaferranti@users.noreply.github.com> --- src/intervals/functions.jl | 2 +- test/interval_tests/numeric.jl | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/intervals/functions.jl b/src/intervals/functions.jl index 53d5ec29b..110bb41ab 100644 --- a/src/intervals/functions.jl +++ b/src/intervals/functions.jl @@ -9,7 +9,7 @@ for T in (:Integer, :Float64, :BigFloat, :Interval) @eval ^(a::Interval{Float64}, x::$T) = atomic(Interval{Float64}, bigequiv(a)^x) end - +^(a::Interval{Float32}, x::Interval) = atomic(Interval{Float32}, bigequiv(a)^x) # Integer power: diff --git a/test/interval_tests/numeric.jl b/test/interval_tests/numeric.jl index da7fe2558..3f447a5d6 100644 --- a/test/interval_tests/numeric.jl +++ b/test/interval_tests/numeric.jl @@ -377,6 +377,7 @@ end a = Interval{Float32}(1e38) b = Interval{Float32}(1e2) @test a * b == Interval{Float32}(floatmax(Float32), Inf) + @test Interval(1.0f0) ^ Interval(1.0f0) == Interval(1.0f0) # test for PR #482 end