-
Notifications
You must be signed in to change notification settings - Fork 70
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
[WIP / RFC] Configuration mechanism for directed rounding and fast powers #388
Changes from 1 commit
fa7aab4
ce61769
4f1a4b0
0a5e2ac
089a7e6
c6feb3f
81134b9
cfddaef
044c947
524cd4c
de103ee
b2fb8ec
7a8838c
c3a07c6
6e9ed32
1e714b5
42f6c74
8989bb3
d3aa7c0
73fc001
d585a4d
997e32c
3c00c99
d35b415
5751634
b669b09
57f401f
d40067e
9e36c14
afdd6b6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,10 +19,9 @@ struct Interval{T<:Real} <: AbstractInterval{T} | |
|
||
function Interval{T}(a::Real, b::Real) where T<:Real | ||
|
||
if isinf(a) && a == b | ||
return emptyinterval(T) | ||
end | ||
|
||
a = _normalisezero(a) | ||
b = _normalisezero(b) | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this file changing with respect to master? It shouldn't, right? |
||
if validity_check | ||
|
||
if is_valid_interval(a, b) | ||
|
@@ -88,17 +87,7 @@ function is_valid_interval(a::Real, b::Real) | |
return false | ||
end | ||
|
||
if isinf(a) && a == b | ||
return true | ||
end | ||
|
||
if a > b | ||
if isinf(a) && isinf(b) | ||
return true # empty interval = [∞,-∞] | ||
else | ||
return false | ||
end | ||
end | ||
a > b && return false | ||
|
||
if a == Inf || b == -Inf | ||
return false | ||
|
@@ -112,9 +101,7 @@ end | |
|
||
`interval(a, b)` checks whether [a, b] is a valid `Interval`, using the (non-exported) `is_valid_interval` function. If so, then an `Interval(a, b)` object is returned; if not, a warning is printed and the empty interval is returned. | ||
""" | ||
function interval(a::Real, b::Real) | ||
|
||
|
||
function interval(a::T, b::S) where {T<:Real, S<:Real} | ||
if !is_valid_interval(a, b) | ||
@warn "Invalid input, empty interval is returned" | ||
return emptyinterval(promote_type(T, S)) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,8 @@ struct PowerType{T} end | |
# Write explicitly like this to avoid ambiguity warnings: | ||
|
||
for T in (:Integer, :Float64, :BigFloat, :Interval) | ||
@eval ^(::PowerType{:tight}, a::Interval{Float64}, x::$T) = atomic(Interval{Float64}, big53(a)^x) | ||
@eval ^(::PowerType{:tight}, a::Interval{Float64}, x::$T) = atomic(Interval{Float64}, bigequiv(a)^x) | ||
@eval ^(::PowerType{:tight}, a::Interval{Float32}, x::$T) = atomic(Interval{Float64}, bigequiv(a)^x) | ||
Comment on lines
+15
to
+16
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we impose that |
||
end | ||
|
||
|
||
|
@@ -24,9 +25,6 @@ end | |
Base.literal_pow(::typeof(^), x::Interval{T}, ::Val{p}) where {T,p} = x^p | ||
|
||
|
||
Base.eltype(x::Interval{T}) where {T<:Real} = T | ||
|
||
|
||
|
||
function ^(::PowerType{:tight}, a::Interval{BigFloat}, n::Integer) | ||
isempty(a) && return a | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,6 @@ include("linear_algebra.jl") | |
include("loops.jl") | ||
include("parsing.jl") | ||
# include("rounding_macros.jl") | ||
include("rounding.jl") | ||
#include("rounding.jl") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't we adapt the tests to the changes implemented here? |
||
include("bisect.jl") | ||
include("complex.jl") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cbrt
is obtained throughCRlibm
, right? That's the reason to delete it here, isn't it?