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

frem bitblaster gives incorrect result for (frem 3.0 2.0) #2369

Closed
nunoplopes opened this issue Jul 1, 2019 · 1 comment
Closed

frem bitblaster gives incorrect result for (frem 3.0 2.0) #2369

nunoplopes opened this issue Jul 1, 2019 · 1 comment
Assignees

Comments

@nunoplopes
Copy link
Collaborator

(declare-const C (_ BitVec 8))
(assert (bvuge C #x80))
(assert (bvule C #x80))

(push)
(assert (= (fp.rem (fp #b0 C #b10000000000000000000000)
                       (fp #b0 #x80 #b00000000000000000000000))
               (fp #b0 #x7f #b00000000000000000000000)))
(check-sat)
(pop)

(assert (= (fp.rem (fp #b0 #x80 #b10000000000000000000000)
                       (fp #b0 #x80 #b00000000000000000000000))
               (fp #b0 #x7f #b00000000000000000000000)))
(check-sat)
(simplify (fp.rem (fp #b0 #x80 #b10000000000000000000000)
                       (fp #b0 #x80 #b00000000000000000000000)))

gives:

sat
unsat
(fp #b1 #x7f #b00000000000000000000000)

The 2 formulas are the same; but the first goes to the bitblaster, while the second uses the rewriter.
Talking with @wintersteiger, we agree the rewriter is correct (-1.0) and the bitblaster is wrong (1.0). x86's frem agrees with the rewriter.
Logging this issue so we don't forget.

P.S.: It would be nice to have fmod as well, though it seems the SMT standard only supports frem as well..

@wintersteiger wintersteiger self-assigned this Jul 1, 2019
@wintersteiger
Copy link
Contributor

Fixed, many thanks! That was indeed yet another bug in the FP->BV converter.

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

No branches or pull requests

2 participants