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
base: master
Are you sure you want to change the base?
remove setrounding from functions #443
Conversation
03690da
to
4599197
Compare
@dpsanders @lbenet I think this could be merged at this point and investigate the |
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.
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.
if signbit(lo) | ||
lo = prevfloat(hi) | ||
elseif !iszero(lo) | ||
lo = hi | ||
hi = nextfloat(hi) | ||
else | ||
lo = hi | ||
end |
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'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)))`. |
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.
Can you provide a reference or more details, to understand why you do what you do?
|
||
Interval(lo, hi) | ||
return Interval(lo, hi) |
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 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?
This PR may have improvements from what was implemented in PR #593. @lucaferranti what do you think? Otherwise let us close the PR. |
The functions using
setrounding
¨do not seem to work properly with 1.6 on windowsnow work, but it was discussed to remove setrounding from the implementation. For what I can say, the functions using setrounding areRelated issues: #442