-
Notifications
You must be signed in to change notification settings - Fork 32
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
Explanations Table #719
Explanations Table #719
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.
We should merge, even if there are more cleanups possible, just to keep this in sync with the rest of Herbie.
src/error-table.rkt
Outdated
[(and (or (bf> cond-x cond-thres) | ||
(bf> cond-y cond-thres)) | ||
(not (constant? y-ex))) | ||
(mark-erroneous! subexpr 'sensitivity)] |
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.
Issue with pow(x, 1000)
. I think we need:
if G_x > 100 && ! exact(x)
if G_y > 100 && ! exact(y)
src/error-table.rkt
Outdated
(mark-maybe! subexpr 'sensitivity)] | ||
[(and (bf> cond-no maybe-cond-thres) | ||
(bf> cot-x maybe-cond-thres)) | ||
(mark-maybe! subexpr 'cancellation)] | ||
[else #f])] | ||
|
||
[(list (or 'cos.f64 'cos.f32) x-ex) | ||
#:when (list? x-ex) |
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.
So I think list?
is not quite right, because it can be a constant but not one exactly representable in float, like 1/3
. There's gotta be some way to do this exactly right.
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 have been thinking about this. I think it should be a composition of (a) expression that's a product or quotient of constants and (b) representable in floating point. (a) is easy enough not sure how to do (b).
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 think we should write a little wrapper around eval-application
and it can check something like:
(define (exact-constant? expr)
(let ([val (eval-application-recursively expr)])
(and val (= val (exact->inexact val)))))
Would be even better to use real->representation
instead of just exact->inexact
but that is more complex.
src/error-table.rkt
Outdated
@@ -49,28 +64,87 @@ | |||
(make-immutable-hash (map cons | |||
subexprs-list | |||
(map context-repr ctx-list)))) | |||
|
|||
|
|||
(define subexprs-fn (eval-progs-real spec-list ctx-list)) |
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 think we want this to be (compile-progs exprs ctx)
but there might be issues with different ctx
s but maybe we're ok with some expressions erroring for now?
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.
Will it crash on booleans and if? If yes, then I'd rather not use it because right now we don't get crashes on booleans and if.
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.
Let's not mess with this for now.
src/error-table.rkt
Outdated
|
||
(define subexprs | ||
(all-subexpressions-rev expr (context-repr ctx))) | ||
(define subexprs-list (map car subexprs)) |
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.
It would be nice to make all-subexpressions-rev
return the same kind of thing as all-subexpressions
, in other words have it return what is called subexprs-list
here. Then the code could be a little nicer.
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.
Fine to do in another PR
src/error-table.rkt
Outdated
(define repr-hash | ||
(make-immutable-hash (map cons | ||
subexprs-list | ||
(map context-repr ctx-list)))) |
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.
You also wouldn't need repr-hash
if we changed all-sub...s-rev
Proposal: let's not fix the |
There are two extra crashes, otherwise let's merge |
Closing this in favor of #824 |
Forgot to push the fix, sorry |
This PR adds functionality and some more stats to the explanations algorithm: