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

remove setrounding from functions #443

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

lucaferranti
Copy link
Member

@lucaferranti lucaferranti commented Mar 10, 2021

The functions using setrounding ¨do not seem to work properly with 1.6 on windows now work, but it was discussed to remove setrounding from the implementation. For what I can say, the functions using setrounding are

  • mig (and hence abs, which calls mig)
  • fma
  • sqrt

Related issues: #442

@coveralls
Copy link

coveralls commented Mar 10, 2021

Coverage Status

Coverage decreased (-0.006%) to 91.074% when pulling 03690da on lucaferranti:lferrant/1.6-on-windows into b70940d on JuliaIntervals:master.

@lucaferranti lucaferranti changed the title [WIP] compatibility with 1.6 on windows [WIP] remove setrounding from functions Mar 27, 2021
@lucaferranti lucaferranti linked an issue Apr 20, 2021 that may be closed by this pull request
@lucaferranti
Copy link
Member Author

@dpsanders @lbenet I think this could be merged at this point and investigate the sqrt thingy later in a separate issue / PR, what do you think?

@lucaferranti lucaferranti changed the title [WIP] remove setrounding from functions remove setrounding from functions Sep 30, 2021
Copy link
Member

@lbenet lbenet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for looking into this. I have added some comments to clarify the way in which you implemented fma and the helper functions; references or details are welcome! There is maybe only a comment, on an if-block which may deserve some changes. As for mig, I agree there is no need to have any rounding.

Comment on lines +251 to +258
if signbit(lo)
lo = prevfloat(hi)
elseif !iszero(lo)
lo = hi
hi = nextfloat(hi)
else
lo = hi
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if I follow the algorithm here, so references or details are appreciated, nor if lo and hi may be any arbitrary values.

Yet, I think it is worth to check first if lo is zero (instead of getting its sign) and then deal with the sign part. If you have lo=-0.0 (zero is signed in floating point!) this block yields lo = prevfloat(hi) (first condition is satisfied), whereas if you have lo=+0.0 it yields hi (the else is used). My point is that you get two different answers for the same "value" of lo, and I do know know which one is the correct one.

"""
two_fma(a, b, c)

Computes `val = fl(fma(a, b, c))` and `err = fl(err(fma(a, b, c)))`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you provide a reference or more details, to understand why you do what you do?


Interval(lo, hi)
return Interval(lo, hi)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that, in the way you define lo and hi, the returned interval includes the true answer. However, I can't see if this is the tightest interval or not, and may be it isn't. Can you comment on this?

@OlivierHnt
Copy link
Member

This PR may have improvements from what was implemented in PR #593.

@lucaferranti what do you think? Otherwise let us close the PR.

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

Successfully merging this pull request may close these issues.

remove setrounding from functions implementation
4 participants