-
Notifications
You must be signed in to change notification settings - Fork 76
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
More precise abstractions of trigonometric functions using c-stubs #1277
Conversation
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.
Semgrep found more than 10 potential problems in the proposed changes. Check the Files changed tab for more details.
cfde041
to
a79eb9a
Compare
I have added a first draft of an explanation that hopefully helps to understand the computations in the floatDomain. |
Thank you for this addition! I took a look at the conceptual description and think it is a nice idea. Since I am quite busy right now, I might have to postpone the review for another two weeks. |
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 had a few questions regarding the rounding modes. Apart from that I think it is a nice and generic idea to get a good abstraction for trigonometric computations in case the interval of the input variable is not too imprecise. I think a few more comments with some selected information from the pdf draft could improve the clarity of the code.
I addressed the comments, fixed some rounding modes and added some comments to the code. |
Semgrep warns because there are several usages of functions from |
For approximating pi, @michael-schwarz and me discussed, that one could write a C-stub for |
Thanks for fixing the semgrep issues. I have removed the phase shift and changed the case checks instead |
And there now seems to be an issue with GobView because there is no JavaScript implementation for the stub I added for pi. |
Would it work to do something like |
There's something our stubs don't account for: in C, |
So the problem seems to be that the rounding mode only specifies how floating point numbers are rounded per instruction.
On the Intel Mac this outputs: ( |
This not only affects the trigonometric functions but also other more complex mathematical functions such as |
I might have mentioned it somewhere at some point, but there's also crlibm. Maybe we'll have to turn to something like that. |
@sim642 How would crlibm help us here? It correctly rounds w.r.t. to the mathematical definition and not w.r.t. some arbitrarily (mis-)behaving implementation. Am I missing something here? |
That at least sounds like it should provide that, but I haven't looked further into it. |
If we can assume that for any operation |
At our meeting today, we discussed that we would like to implement the above idea, make this feature optional (turned off by default) and comment/warn that it can be unsound. |
I implemented the option However, thinking about it, I am wondering if we should include I have not yet thought about if there is a similar issue for rounding mode |
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.
The failing indentation check is unrelated.
These changes allow for a more precise abstraction of the trigonometric functions on monotonic intervals.
Similar to #1253, c-stubs are used for the calculation of the resulting interval, once an interval is identified to be monotonic.
The option to enable/disable this option can be removed, if we trust, that the implementation of the trigonometric functions used in the analyzer is the same as the one used in the program to be analyzed.
You can find a rough explanation in this PDF:
Explanation_draft.pdf