Skip to content
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

Various differences for extreme cases #6

Closed
dpsanders opened this issue Apr 23, 2017 · 12 comments
Closed

Various differences for extreme cases #6

dpsanders opened this issue Apr 23, 2017 · 12 comments

Comments

@dpsanders
Copy link
Contributor

Using FastRounding for IntervalArithmetic tests shows up various different behaviours from standard rounding mode changes for extreme cases:

https://travis-ci.org/JuliaIntervals/IntervalArithmetic.jl/jobs/224924934

Maybe these are known / expected.

@JeffreySarnoff
Copy link
Owner

JeffreySarnoff commented Apr 26, 2017

I made some changes in two of the three or all three pkgs. Caught a couple of subtle bugs. Please rerun those tests. At least some of the errors would be fixed by adding ifelse( extremal value , .. , ..) which is possible -- with some speed hit. Let's see if the current adjustments have helped or not.

@dpsanders
Copy link
Contributor Author

dpsanders commented Apr 27, 2017

There doesn't seem to be much difference -- the same tests are failing,
in particular, the division ones like

   Expression: Interval(-30.0, 0.0) / Interval(-Inf, -3.0) --> Interval(0.0, 10.0)
      Expected: [0, 10]
      Occurred: [4.940656458e-324, 10]

@dpsanders
Copy link
Contributor Author

You can run the tests locally via

Pkg.test("IntervalArithmetic")

with your packages checkouted to master.

@dpsanders
Copy link
Contributor Author

dpsanders commented Apr 27, 2017

Ah, that seems to be another ErrorfreeArithmetic issue:

julia> using ErrorfreeArithmetic

julia> divide_accurately(1., Inf)
(0.0, NaN)

which maybe requires a similar ifelse treatment to JeffreySarnoff/ErrorfreeArithmetic.jl#5

@dpsanders
Copy link
Contributor Author

Basically any NaN in the second argument should be replaced by 0.0?

@JeffreySarnoff
Copy link
Owner

JeffreySarnoff commented Apr 27, 2017 via email

@dpsanders
Copy link
Contributor Author

dpsanders commented Apr 28, 2017 via email

@JeffreySarnoff
Copy link
Owner

(rook takes queens pawn, bishop to kings bishop 3, knight to knightsbridge, bishop takes lunch)
As a finite IEEE754-2008 binary floating point value, zero(Float64) has 53 significant bits (one implict).

In all of the _errorfree arithmetic routines, wherever a result is such that hi==0.0, the lo is opaque. Any floating point value that may be occupying lo is not a part of the errorfree outcome -- in the same way that where hi==Inf, the lo is opaque. This manner of / approach to use has been with my errorfree work all along. The double-double code I wrote would see hi==zero and not palaver with lo. It turns out that results propogate accurately and arith-logic keeps on working when that is done throughout.

So, that is why it is so. Nonetheless, I am delighted to have these corner cases resolve as you expect. You know what you want things to do -- If you would make those behaviors do as you prefer by PRing some ErrorfreeArithmetic, then that would isolate the remaining corner cases, which I expect involve values similar to 1.0e-308. I know how rejigger those so they match nextfloat, prevfloat -- the reason they do not match now for some (actually very few, but always the tested ones) is I chose speed at each turn over matchy matchy behavior [as did the authors of those papers]. Splitting the implementation into two is reasonable.

@dpsanders
Copy link
Contributor Author

I need a drop-in replacement alternative for "changing the rounding-mode" operations, with exactly the same behaviour in all cases, but with the maximum attainable speed-up. (The speed-up could be non-uniform for extreme cases though.)

Surely this is too stringent a requirement for other uses, as you suggest.

Basically it seems like we need "FastestPossibleRounding" and "CorrectFastRounding", or at least two sets of corresponding functions.

@dpsanders
Copy link
Contributor Author

But the division issue, for example, just boils down to "don't round if you have already found an exact result". The problem is just detecting that the result is already exact.

@JeffreySarnoff
Copy link
Owner

JeffreySarnoff commented Apr 28, 2017 via email

@dpsanders
Copy link
Contributor Author

Most of these seem to have been fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants