@@ -75,24 +75,22 @@ protected Long makeNumberImpl(double pN, FloatingPointType pType, Long pRounding
75
75
protected Long makeNumberImpl (
76
76
BigInteger exponent , BigInteger mantissa , boolean signBit , FloatingPointType type ) {
77
77
78
- long signBv = Native .mkBvNumeral (z3context , 1 , new boolean [] {signBit });
79
- long expoBv =
80
- Native .mkNumeral (
81
- z3context , exponent .toString (), Native .mkBvSort (z3context , type .getExponentSize ()));
82
- long mantBv =
83
- Native .mkNumeral (
84
- z3context , mantissa .toString (), Native .mkBvSort (z3context , type .getMantissaSize ()));
85
-
86
- assert Native .getBvSortSize (z3context , Native .getSort (z3context , signBv )) == 1
87
- : "SignBV should be 1 bit long" ;
88
- assert Native .getBvSortSize (z3context , Native .getSort (z3context , expoBv ))
89
- == type .getExponentSize ()
90
- : "ExpoBV should be " + type .getExponentSize () + " bits long" ;
91
- assert Native .getBvSortSize (z3context , Native .getSort (z3context , mantBv ))
92
- == type .getMantissaSize ()
93
- : "MantBV should be " + type .getMantissaSize () + " bits long" ;
94
-
95
- return Native .mkFpaFp (z3context , signBv , expoBv , mantBv );
78
+ final Long signSort = getFormulaCreator ().getBitvectorType (1 );
79
+ final Long expoSort = getFormulaCreator ().getBitvectorType (type .getExponentSize ());
80
+ final Long mantSort = getFormulaCreator ().getBitvectorType (type .getMantissaSize ());
81
+
82
+ final Long signBv = Native .mkNumeral (z3context , signBit ? "1" : "0" , signSort );
83
+ Native .incRef (z3context , signBv );
84
+ final Long expoBv = Native .mkNumeral (z3context , exponent .toString (), expoSort );
85
+ Native .incRef (z3context , expoBv );
86
+ final Long mantBv = Native .mkNumeral (z3context , mantissa .toString (), mantSort );
87
+ Native .incRef (z3context , mantBv );
88
+
89
+ final Long fp = Native .mkFpaFp (z3context , signBv , expoBv , mantBv );
90
+ Native .decRef (z3context , mantBv );
91
+ Native .decRef (z3context , expoBv );
92
+ Native .decRef (z3context , signBv );
93
+ return fp ;
96
94
}
97
95
98
96
@ Override
0 commit comments