Add IEEE-754 Floating Point to Bitvector Conversion Fallback#512
Add IEEE-754 Floating Point to Bitvector Conversion Fallback#512baierd wants to merge 106 commits into
Conversation
…traint is not handed to the user
…gestion + add helper to get mantissa and exponent sizes for FPs (not finished for all solvers)
…n of user defined results for special FP numbers
…ll BV capable solvers
…ings and add it to JavaDoc
…BV transformation and width comparison
…umber mapping) and a test for FP size/mantissa/exponent in relation to BV width for toIeeeBitvector()
…ulaManager (based on solver return)
…d text for native toIeeeBitvector() in AbstractFloatingPointFormulaManager
|
@kfriedberger the SMTLIB2 standard defines the size of an FP as mantissa + exponent with the mantissa including the sign bit. Our current implementation excludes it, and we do not document this properly in all cases, especially the FP type constructor. This is problematic, as the standard defines the size of a BV representation of a FP as My proposal (already WIP):
I don't want to change the current FP-Type constructor, as users expect this to not change behavior. What do you think? I am happy about thoughts/ideas. Edit: it would probably be a good idea to also update the API for |
…tMantissaSizeWithSignBit() +
…he type/mantissa with/without sign bit and add sign bit to toString and toSMTLIBString representations
…a with/without sign bit and use those as far as possible to make the code unambiguous for mantissas
…IEEE BV method availability
…n bit and add some assertions for mantissa/exponent
…guous about the sign bit
…h new mantissa API
…or messages to a method and the invocation into parseAllImpl() as this is called for all parsing operations
…pected to throw, as if requireParser() fails, the test would fail with a weird error
…rsion-not-supported-in-all-solvers # Conflicts: # src/org/sosy_lab/java_smt/basicimpl/AbstractFloatingPointFormulaManager.java # src/org/sosy_lab/java_smt/basicimpl/AbstractFormulaManager.java # src/org/sosy_lab/java_smt/solvers/bitwuzla/BitwuzlaFormulaCreator.java # src/org/sosy_lab/java_smt/solvers/cvc4/CVC4FormulaCreator.java # src/org/sosy_lab/java_smt/solvers/cvc5/CVC5FormulaCreator.java
…rsion-not-supported-in-all-solvers # Conflicts: # src/org/sosy_lab/java_smt/basicimpl/AbstractFormulaManager.java
…nsive check and make the cheap checks message lazy
I chose Note: It returns a
It works due to SMTLIB(2) only defining each special FP number only once. Hence "all" bitvector NaN representations return the "same" NaN (as defined by SMTLIB2). If translated back, the original bitvector is returned. I added tests for all special FP numbers that check this. |
…rsion-not-supported-in-all-solvers
|
I agree that the current name is bad as mentioned in #512 (comment). |
PhilippWendler
left a comment
There was a problem hiding this comment.
I had a look over the API, but no in-depth review.
…rsion-not-supported-in-all-solvers
This PR adds a fallback method for
FloatingPointManager.toIeeeBitvector(FloatingPointFormula):FloatingPointManager.toIeeeBitvector(FloatingPointFormula, BitvectorFormula), returns a BooleanFormula that is the result of the equality of the FP input with the BV input (BV is equal to the floating-points bit representation according to the IEEE 754-2008 floating-point format). Special FP numbers are returned as the solver sees fit.Tests for this method have been added. This includes the SMTLIB2 output of it, and the native
toIeeeBitvector()method, showing us what solver can parse what output.Furthermore, i added common FP type checks in the wrapping function of
AbstractFloatingPointFormulaManager