-
Notifications
You must be signed in to change notification settings - Fork 17
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
Control rounding for many functions #56
Conversation
@@ -32,7 +32,3 @@ end | |||
macro biginterval(expr1, expr2...) | |||
make_interval(BigFloat, expr1, expr2) | |||
end | |||
|
|||
macro make_interval(T, expr1, expr2...) |
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.
Why did you remove this macro? It allows to specify the type of the interval desired.
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.
Was never used...
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.
True... But it seemed like it might be useful. Feel free to delete!
ea8fa99
to
058e8ce
Compare
lnea = @with_rounding($T, $expr1, RoundNearest) | ||
ldow = @with_rounding($T, $expr1, RoundDown) | ||
lup = @with_rounding($T, $expr1, RoundUp) | ||
lo = ifelse(lnea != ldow && lnea != lup, lnea, ldow) |
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.
What is this line doing?
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.
That's in the comment above :-) The idea is that the correct rounding should leave on of the roundings fixed to nearest, unless you really get the zero-distance for nearest rounding. It yields quite consistent things with respect to the IRF1788 tests.
I can't check the |
The simple idea is to get the tightest possible interval for The subtle thing, which we will need to discuss (but not now), is In my machine tests pass correctly... I'll check this tomorrow. |
058e8ce
to
f1b2683
Compare
Problems with travis; see #59 |
In ma machine, with v0.4, tests pass... |
New commit; now all tests in the ITF1788 suite pass, including all the currently defined trigonometric functions and (&^%$!@*) Something to be done is certainly related to #59 ... |
Great work!! This failure is JuliaLang/julia#13399 I don't know what we can do about it. |
I have added functions of the form This will enable us to go back and simplify the code again. But this will need a new tagged version of CRlibm etc. For the moment we can go ahead with your current version. |
It certainly would be nice if |
I am implementing other functions to get as much compliance with the standard as we can... |
👍 |
I think any actually new functions should go in a new PR. |
Ok. So I'll stop it here; I already have the hyperbolic functions ( So this is ready for reviewing, but merging it should wait until we deprecate support of version 0.3. |
And put the Julia requirement in |
There are real test failures on Travis. Are these the same kind of inconsistent rounding errors that I was seeing a couple of months ago? |
The tests pass on my machine. These things are really annoying. |
…tion Changes in make_interval and convert methods. Currently, the only subtle case is when make_interval(Interval{T},Interval) is invoked, in the sense that the resulting interval may become wider due to rounding.
ITF1788 tests of these functions pass
…56 precision for bigfloat intervals
function -{T<:Real}(a::Interval{T}, b::Interval{T}) | ||
(isempty(a) || isempty(b)) && return emptyinterval(T) | ||
a + (-b) # @round(a.lo - b.hi, a.hi - b.lo) |
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.
I think a + (-b)
will do the same thing, but no harm in being explicit.
Great work, thanks!! |
I'm ready to merge this once you've fixed my minor comments! |
And thanks a lot for the very careful review! |
Control rounding for many functions
This is some work to get tighter control of
Interval{Float64}
. It involves work inmake_interval
, in order to get as tight as possible intervals when@interval(a)
is used. It also includes some handling of@round
, and work to get the correct behavior of the arithmetic operations and the elementary function.