@@ -92,6 +92,13 @@ for (op, f) in ( (:+, :add), (:-, :sub), (:*, :mul), (:/, :div) )
9292 end
9393end
9494
95+ # inv and sqrt:
96+
97+ # inv(::IntervalRounding{:tight}, a::T, r::RoundingMode) where T<:Union{Float32, Float64} = inv_round(a, r)
98+ #
99+ # sqrt(::IntervalRounding{:tight}, a::T, r::RoundingMode) where T<:Union{Float32, Float64} = sqrt_round(a, r)
100+
101+
95102for T in (Float32, Float64)
96103 for mode in (:Down , :Up )
97104
@@ -103,7 +110,7 @@ for T in (Float32, Float64)
103110 @eval inv (:: IntervalRounding{:tight} ,
104111 a:: $T , $ mode1) = inv_round (a, $ mode2)
105112
106- @eval sqrt (:: IntervalRounding{:tight} ,
113+ @eval sqrt (:: IntervalRounding{:tight} ,
107114 a:: $T , $ mode1) = sqrt_round (a, $ mode2)
108115 end
109116end
@@ -175,13 +182,19 @@ for mode in (:Down, :Up)
175182 # functions not in CRlibm:
176183 for f in (:sqrt , :inv , :tanh , :asinh , :acosh , :atanh )
177184
185+
178186 @eval function $f (:: IntervalRounding{:slow} ,
179187 a:: T , $ mode1) where T<: AbstractFloat
180188 setrounding (T, $ mode2) do
181189 $ f (a)
182190 end
183191 end
184192
193+ @eval function $f (:: IntervalRounding{:tight} ,
194+ a:: T , $ mode1) where T<: AbstractFloat
195+ $ f (IntervalRounding {:slow} (), a, $ mode2)
196+ end
197+
185198
186199 @eval $ f (:: IntervalRounding{:accurate} ,
187200 a:: T , $ mode1) where {T<: AbstractFloat } = $ directed ($ f (a))
@@ -229,10 +242,18 @@ function _setrounding(::Type{Interval}, rounding_type::Symbol)
229242 @eval $ f (a:: T , b:: T , r:: RoundingMode ) where {T<: AbstractFloat } = $ f ($ roundtype, a, b, r)
230243 end
231244
245+ # unary functions:
246+
247+ for f in (:sqrt , :inv )
248+ @eval $ f (a:: T , r:: RoundingMode ) where {T<: AbstractFloat } = $ f ($ roundtype, a, r)
249+ end
250+
251+
232252 if rounding_type == :tight # for remaining functions, use CRlibm
233253 roundtype = IntervalRounding {:slow} ()
234254 end
235255
256+
236257 for f in (:^ , :atan )
237258
238259 @eval $ f (a:: T , b:: T , r:: RoundingMode ) where {T<: AbstractFloat } = $ f ($ roundtype, a, b, r)
@@ -242,7 +263,7 @@ function _setrounding(::Type{Interval}, rounding_type::Symbol)
242263
243264 # unary functions:
244265 for f in vcat (CRlibm. functions,
245- [ :sqrt , :inv , :tanh , :asinh , :acosh , :atanh ])
266+ [ :tanh , :asinh , :acosh , :atanh ])
246267
247268 @eval $ f (a:: T , r:: RoundingMode ) where {T<: AbstractFloat } = $ f ($ roundtype, a, r)
248269
0 commit comments