-
Notifications
You must be signed in to change notification settings - Fork 278
C library: add exp, log, pow models #7906
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
Conversation
@kroening and @martin-cs Would really appreciate your input on the proposed approximations. |
Not unreasonable BUT we should probably decide on and document what the user can expect from our math library. The levels of accuracy are something like:
1 and 2 we can do easily but not everyone likes this #6999. I don't think we can realistically do 3 without using the actual implementations as the errors are very ideosyncratic of the implementations. For 3 and 4 and most of the implementations will completely sink the solver. My feeling is that the right answer is to give overapproximate models of the functions such that the result always includes the correctly rounded result and then to support But ... that's quite a bit of work and although it has been on my TODO for a while ... it hasn't got done yet so I guess any model is better than none. |
09fbd6a
to
47321c2
Compare
I have now reworked the implementations to non-deterministically pick a result that is within the margin of error of approximation. This should be closer to soundness, but the caveats that @martin-cs called out do remain. |
47321c2
to
4abc14f
Compare
Codecov ReportAll modified lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #7906 +/- ##
===========================================
- Coverage 78.94% 78.84% -0.10%
===========================================
Files 1697 1697
Lines 195379 195379
===========================================
- Hits 154242 154051 -191
- Misses 41137 41328 +191 ☔ View full report in Codecov by Sentry. |
5783c16
to
8c4058d
Compare
The implementation follows Nicol N. Schraudolph: "A Fast, Compact Approximation of the Exponential Function," Neural Computation 11(4), 1999 and its discussion in https://martin.ankerl.com/2007/10/04/optimized-pow-approximation-for-java-and-c-c/. We use lower and upper bounds to retain soundness.
8c4058d
to
ff137ae
Compare
There may be a need to make this produce a bigger interval, given that the standards demand very little, but let's go for this for now. |
The implementation follows Nicol N. Schraudolph: "A Fast, Compact Approximation of the Exponential Function," Neural Computation 11(4), 1999 and its discussion in
https://martin.ankerl.com/2007/10/04/optimized-pow-approximation-for-java-and-c-c/.