@@ -777,10 +777,10 @@ public void ieeeFpConversion() throws SolverException, InterruptedException {
777
777
/**
778
778
* Map the function over the input list and prove the returned assertions.
779
779
*
780
- * @param f A function that takes values from the list and returns assertions
781
780
* @param args A list of arguments to the function
781
+ * @param f A function that takes values from the list and returns assertions
782
782
*/
783
- private <T > void proveForAll (Function < T , BooleanFormula > f , List < T > args )
783
+ private <T > void proveForAll (List < T > args , Function < T , BooleanFormula > f )
784
784
throws InterruptedException , SolverException {
785
785
try (ProverEnvironment prover = context .newProverEnvironment ()) {
786
786
for (T value : args ) {
@@ -794,24 +794,24 @@ private <T> void proveForAll(Function<T, BooleanFormula> f, List<T> args)
794
794
public void checkIeeeBv2FpConversion32 () throws SolverException , InterruptedException {
795
795
proveForAll (
796
796
// makeFP(value.float) == fromBV(makeBV(value.bits))
797
+ getListOfFloats (),
797
798
pFloat ->
798
799
fpmgr .equalWithFPSemantics (
799
800
fpmgr .makeNumber (pFloat , singlePrecType ),
800
801
fpmgr .fromIeeeBitvector (
801
- bvmgr .makeBitvector (32 , Float .floatToRawIntBits (pFloat )), singlePrecType )),
802
- getListOfFloats ());
802
+ bvmgr .makeBitvector (32 , Float .floatToRawIntBits (pFloat )), singlePrecType )));
803
803
}
804
804
805
805
@ Test
806
806
public void checkIeeeBv2FpConversion64 () throws SolverException , InterruptedException {
807
807
proveForAll (
808
808
// makeFP(value.float) == fromBV(makeBV(value.bits))
809
+ getListOfDoubles (),
809
810
pDouble ->
810
811
fpmgr .equalWithFPSemantics (
811
812
fpmgr .makeNumber (pDouble , doublePrecType ),
812
813
fpmgr .fromIeeeBitvector (
813
- bvmgr .makeBitvector (64 , Double .doubleToRawLongBits (pDouble )), doublePrecType )),
814
- getListOfDoubles ());
814
+ bvmgr .makeBitvector (64 , Double .doubleToRawLongBits (pDouble )), doublePrecType )));
815
815
}
816
816
817
817
@ Test
@@ -823,11 +823,11 @@ public void checkIeeeFp2BvConversion32() throws SolverException, InterruptedExce
823
823
824
824
proveForAll (
825
825
// makeBV(value.bits) == fromFP(makeFP(value.float))
826
+ getListOfFloats (),
826
827
pFloat ->
827
828
bvmgr .equal (
828
829
bvmgr .makeBitvector (32 , Float .floatToRawIntBits (pFloat )),
829
- fpmgr .toIeeeBitvector (fpmgr .makeNumber (pFloat , singlePrecType ))),
830
- getListOfFloats ());
830
+ fpmgr .toIeeeBitvector (fpmgr .makeNumber (pFloat , singlePrecType ))));
831
831
}
832
832
833
833
@ Test
@@ -839,11 +839,11 @@ public void checkIeeeFp2BvConversion64() throws SolverException, InterruptedExce
839
839
840
840
proveForAll (
841
841
// makeBV(value.bits) == fromFP(makeFP(value.float))
842
+ getListOfFloats (),
842
843
pDouble ->
843
844
bvmgr .equal (
844
845
bvmgr .makeBitvector (64 , Double .doubleToRawLongBits (pDouble )),
845
- fpmgr .toIeeeBitvector (fpmgr .makeNumber (pDouble , doublePrecType ))),
846
- getListOfFloats ());
846
+ fpmgr .toIeeeBitvector (fpmgr .makeNumber (pDouble , doublePrecType ))));
847
847
}
848
848
849
849
private List <Float > getListOfFloats () {
@@ -1034,6 +1034,7 @@ public void failOnInvalidString() {
1034
1034
@ Test
1035
1035
public void fpFrom32BitPattern () throws SolverException , InterruptedException {
1036
1036
proveForAll (
1037
+ getListOfFloats (),
1037
1038
pFloat -> {
1038
1039
// makeFP(value.bits.sign, value.bits.exponent, value.bits.mantissa) = makeFP(value.float)
1039
1040
int bits = Float .floatToRawIntBits (pFloat );
@@ -1045,14 +1046,14 @@ public void fpFrom32BitPattern() throws SolverException, InterruptedException {
1045
1046
BigInteger .valueOf (exponent ), BigInteger .valueOf (mantissa ), sign , singlePrecType );
1046
1047
final FloatingPointFormula fp = fpmgr .makeNumber (pFloat , singlePrecType );
1047
1048
return fpmgr .assignment (fpFromBv , fp );
1048
- },
1049
- getListOfFloats ());
1049
+ });
1050
1050
}
1051
1051
1052
1052
@ Test
1053
1053
public void fpFrom64BitPattern () throws SolverException , InterruptedException {
1054
1054
proveForAll (
1055
1055
// makeFP(value.bits.sign, value.bits.exponent, value.bits.mantissa) = makeFP(value.float)
1056
+ getListOfDoubles (),
1056
1057
pDouble -> {
1057
1058
long bits = Double .doubleToRawLongBits (pDouble );
1058
1059
long exponent = (bits >>> 52 ) & 0x7FF ;
@@ -1063,8 +1064,7 @@ public void fpFrom64BitPattern() throws SolverException, InterruptedException {
1063
1064
BigInteger .valueOf (exponent ), BigInteger .valueOf (mantissa ), sign , doublePrecType );
1064
1065
final FloatingPointFormula fp = fpmgr .makeNumber (pDouble , doublePrecType );
1065
1066
return fpmgr .assignment (fpFromBv , fp );
1066
- },
1067
- getListOfDoubles ());
1067
+ });
1068
1068
}
1069
1069
1070
1070
@ Test
0 commit comments