Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
6a91ebf
Remove workaround for toIeeeBitvector() in Bitwuzla as the extra cons…
baierd Aug 13, 2025
5c86496
Add fallback for toIeeeBitvector() based on the SMTLIB2 standards sug…
baierd Aug 13, 2025
06e365f
Add extended toIeeeBitvector() fallback implementation with the optio…
baierd Aug 31, 2025
d00e534
Add bool manager to all FP managers for new toIeeeBitvector() impl
baierd Aug 31, 2025
bc5a5e3
Simplify toIeeeBitvector() fallback implementation
baierd Aug 31, 2025
6e6ec7e
Add CVC4 implementation for getMantissaSize() and getExponentSize()
baierd Aug 31, 2025
f584f6b
Add CVC5 implementation for getMantissaSize() and getExponentSize()
baierd Aug 31, 2025
9df8f21
Add Mathsat5 implementation for getMantissaSize() and getExponentSize()
baierd Aug 31, 2025
105e7f2
Add Z3 implementation for getMantissaSize() and getExponentSize()
baierd Aug 31, 2025
4ec7107
Add internal API to retrieve the width of a BV and implement it for a…
baierd Sep 1, 2025
97c1fe4
Add test for FP special number identity for equal precisions
baierd Sep 1, 2025
fdaabcc
Add preconditions for FP toIeeeBitvector() method special number mapp…
baierd Sep 1, 2025
3ecd133
Add native Mathsat test for mantissa not including the sign bit with …
baierd Sep 1, 2025
52dbeb5
Add tests for FP toIeeeBitvector() fallback (without custom special n…
baierd Sep 1, 2025
353b12c
Add public API to get exponent and mantissa size in FloatingPointForm…
baierd Sep 1, 2025
6c554d0
Add note about mantissa und sign bit in FloatingPointNumber.java
baierd Sep 1, 2025
9603aa6
Remove accidental double implementation of bitvector width getter
baierd Sep 1, 2025
1f09a65
Use existing BV size getter + make size getters for FP public + exten…
baierd Sep 1, 2025
43ee2a0
Extend delegate FloatingPointManagers with FP size methods
baierd Sep 1, 2025
a27cc7e
Rename new FloatingPointFormulaManager method getMantissaSize() to ge…
baierd Sep 1, 2025
de90781
Add JavaDoc to FormulaType.FloatingPointType and add methods to get t…
baierd Sep 1, 2025
b652b7f
Add JavaDoc to FloatingPointNumber and add methods to get the mantiss…
baierd Sep 1, 2025
11926f1
Add suppression of return value to test method checking native FP to …
baierd Sep 1, 2025
17227ac
Extend FP tests with new mantissa API to be unambiguous about the sig…
baierd Sep 1, 2025
31ffd68
Extend FloatingPointFormulaManager with new mantissa API to be unambi…
baierd Sep 1, 2025
3cc3a99
Rename getMantissaSize() in FloatingPointFormulaManager delegates wit…
baierd Sep 1, 2025
cd3a9c1
Update Bitwuzla with new unambiguous FP mantissa size getters
baierd Sep 1, 2025
2fbe5bd
Update CVC4 with new unambiguous FP mantissa size getters
baierd Sep 1, 2025
b789362
Update CVC5 with new unambiguous FP mantissa size getters
baierd Sep 1, 2025
2fc661c
Update MathSAT5 with new unambiguous FP mantissa size getters
baierd Sep 1, 2025
7b2b1de
Update Z3 with new unambiguous FP mantissa size getters
baierd Sep 1, 2025
dbacf94
Update SolverVisitorTest with new unambiguous FP mantissa size getters
baierd Sep 1, 2025
2d27890
Use mantissa size without sign bit when building special numbers to c…
baierd Sep 2, 2025
15efd20
Fix off-by-one FP mantissa bug when casting BV to FP
baierd Sep 2, 2025
ba26c93
Extend FP tests with new tests for toIeeeBitvector() fallback testing…
baierd Sep 2, 2025
9c72a5b
Remove done TODO
baierd Sep 2, 2025
85a5b4e
Rename internal method getMantissaSizeImpl() to getMantissaSizeWithSi…
baierd Sep 2, 2025
edf028d
Apply checkstyle and ECJ suggestions
baierd Sep 2, 2025
567e120
Use type information for FP exponent and mantissa in toIeeeBitvector(…
baierd Sep 2, 2025
87a90df
Extend the exception message for parsing failing due to no support fo…
baierd Nov 2, 2025
6fa0b35
Merge branch 'master' into 504-ieee-floating-point-to-bitvector-conve…
baierd Jan 24, 2026
68aa184
Rename "precision" into type for FP types in AbstractFloatingPointFor…
baierd Jan 29, 2026
de440e1
Use existing FP type inside toIeeeBitvector() method in AbstractFloat…
baierd Jan 29, 2026
8973957
Remove public methods to get the exponent and mantissa of a FP formula
baierd Jan 29, 2026
bfe56ac
Make public methods to get the exponent and mantissa of a FP formula …
baierd Jan 29, 2026
aae26af
Remove (new) methods to retrieve FP mantissa and exponent from Abstra…
baierd Jan 29, 2026
95bd69b
Use fp type total size in toIeeeBitvector() instead of building the t…
baierd Jan 29, 2026
638472c
Add null check before getting a message from a caught exception when …
baierd Jan 29, 2026
faca8c9
Merge branch 'master' into 504-ieee-floating-point-to-bitvector-conve…
baierd Jan 30, 2026
8f3a60e
Add a toIeeeBitvector() implementation based on 2 parameters; an FP t…
baierd Jan 30, 2026
7b2b45b
Improve JavaDoc of toIeeeBitvector() implementation based on 2 parame…
baierd Jan 30, 2026
ddfac9d
Refactor tests for fallback of toIeeeBitvector() to use the version w…
baierd Jan 30, 2026
2fc367e
Remove 2 distinct toIeeeBitvector() fallback methods in favor of the …
baierd Jan 30, 2026
275802e
Re-add accidentally removed JavaDoc of FloatingPointType.getExponentS…
baierd Jan 30, 2026
e5e0c81
Remove problematic implementation of (native) FP toIeeeBitvector() in…
baierd Jan 30, 2026
10df745
Add tests for dumping and parsing SMTLIB2 for the Fp to IEEE BV methods
baierd Jan 30, 2026
9a27db3
Improve error message when parsing SMTLIB2 for the Fp to IEEE BV meth…
baierd Jan 30, 2026
1b6a671
Remove boolean manager from FP manager is it is no longer needed
baierd Jan 30, 2026
24230d9
Remove now unused things from BitwuzlaFloatingPointManager
baierd Jan 30, 2026
76ffa33
Access FloatingPointType.getSinglePrecisionFloatingPointType() direct…
baierd Jan 30, 2026
41c0784
Also remove bool manager from solver implementations of FloatingPoint…
baierd Jan 30, 2026
f805aeb
Improve JavaDoc of solver native toIeeeBitvector() and its Unsupporte…
baierd Jan 30, 2026
a824dac
Improve error msg in case of parsing failure on containing "to_ieee_b…
baierd Jan 30, 2026
2ada968
Switch to requireNativeFPToBitvector() in fpToBvTest instead of using…
baierd Jan 30, 2026
2f98439
Build/get formula type only once when wrapping FP formulas (used in t…
baierd Feb 7, 2026
9e0eee4
Refactor assertions when wrapping FP formulas
baierd Feb 7, 2026
f7ac283
Add 2 new FP tests for NaN representation in BV -> FP and FP -> BV
baierd Feb 7, 2026
1b227a2
Update JavaDoc of FloatingPointFormulaManager toIeeeBitvector() fallback
baierd Feb 7, 2026
9f63898
Fix problem with new FP test and add another new FP tests for NaN rep…
baierd Feb 7, 2026
72ad0e3
Merge branch 'master' into 504-ieee-floating-point-to-bitvector-conve…
baierd Feb 7, 2026
1a5e5dc
Rename NaN bit String variable in FP tests
baierd Feb 7, 2026
86c4ab8
Add a FP test for BV -> FP transformation for special FP numbers +-0 …
baierd Feb 9, 2026
914d367
Fix test in FloatingPointFormulaManagerTest in which solvers return e…
baierd Feb 21, 2026
dba1560
Format
baierd Feb 23, 2026
31d23af
Merge branch 'master' into 504-ieee-floating-point-to-bitvector-conve…
baierd Feb 27, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 40 additions & 3 deletions src/org/sosy_lab/java_smt/api/FloatingPointFormulaManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -299,12 +299,49 @@ FloatingPointFormula castFrom(
FloatingPointFormula fromIeeeBitvector(BitvectorFormula number, FloatingPointType pTargetType);

/**
* Create a formula that produces a representation of the given floating-point value as a
* bitvector conforming to the IEEE 754-2008 FP format. The bit size of the resulting bitvector is
* equal to the total size of the {@link FloatingPointNumber}s precision.
* Returns a {@link BitvectorFormula} equal to the representation of the given floating-point
* value as a bitvector conforming to the IEEE 754-2008 FP format. The bit size of the resulting
* bitvector is equal to the total size of the {@link FloatingPointFormula}s {@link
* FloatingPointType}. This method is not natively supported by all solvers, and SMTLIB2 output
* generated containing formulas originating from this method is often not parsable by other
* solvers. You can use the method {@link #toIeeeBitvector(FloatingPointFormula,
* BitvectorFormula)} to avoid both problems.
*/
BitvectorFormula toIeeeBitvector(FloatingPointFormula number);

/**
* Create a {@link BooleanFormula} representing the equality of the bitvector representation of
* the given {@link FloatingPointFormula}s value with the given {@link BitvectorFormula},
* conforming to the IEEE 754-2008 floating-point format. The size m of the given {@link
* BitvectorFormula} has to be equal to the sum of the sizes of the exponent eb and mantissa sb
* (including the hidden bit) of the given {@link FloatingPointFormula}. This implementation can
* be used independently of {@link #toIeeeBitvector(FloatingPointFormula)}, as it does not rely on
* an SMT solvers support for {@link #toIeeeBitvector(FloatingPointFormula)}. Behavior for special
* FP values (NaN, Inf, etc.), is solver dependent. This method is based on a suggestion in the
* (<a href="https://smt-lib.org/theories-FloatingPoint.shtml">SMTLIB2 standard</a>), with eb
* being the {@link FloatingPointFormula}s exponent bit size, sb being its mantissa with the
* hidden bit, and eb + sb equal to the bit size of the used {@link BitvectorFormula} parameter,
* illustrated in SMTLIB2 as:
*
* <p>(= ((_ to_fp eb sb) bitvectorFormulaSetToBeEqualToFpNumber) fpNumber)
*
* <p>Example usage in SMTLIB2, asserting the equality of the 2 parameters:
*
* <p>(declare-fun bitvectorFormulaSetToBeEqualToFpNumber () (_ BitVec m))
*
* <p>(assert (= ((_ to_fp eb sb) bitvectorFormulaSetToBeEqualToFpNumber) fpNumber))
*
* <p>Note: SMTLIB2 output of this method uses the SMTLIB2 keyword 'to_fp' as described above.
*
* @param fpNumber the {@link FloatingPointFormula} to be converted into an IEEE bitvector.
* @param bitvectorFormulaSetToBeEqualToFpNumber a {@link BitvectorFormula} that is set to be
* equal to the IEEE bitvector representation of the {@link FloatingPointFormula} parameter.
* @return a {@link BooleanFormula} representing the result of the equality of the two parameters,
* i.e. (= ((_ to_fp eb sb) bitvectorFormulaSetToBeEqualToFpNumber) fpNumber).
*/
BooleanFormula toIeeeBitvector(
FloatingPointFormula fpNumber, BitvectorFormula bitvectorFormulaSetToBeEqualToFpNumber);

FloatingPointFormula round(FloatingPointFormula formula, FloatingPointRoundingMode roundingMode);

// ----------------- Arithmetic relations, return type NumeralFormula -----------------
Expand Down
Loading
Loading