@@ -105,19 +105,58 @@ public void negative() throws SolverException, InterruptedException {
105
105
106
106
@ Test
107
107
public void parser () throws SolverException , InterruptedException {
108
- for (String s : new String [] {"-1" , "-Infinity" , "-0" , "-0.0" , "-0.000" }) {
108
+ for (String s :
109
+ new String [] {
110
+ "-1" ,
111
+ "-Infinity" ,
112
+ "-0" ,
113
+ "-0.0" ,
114
+ "-0.000" ,
115
+ "-0e5" ,
116
+ "-0.00e-5" ,
117
+ "-12e34" ,
118
+ "-12e-34" ,
119
+ "-12.34E56" ,
120
+ "-12.34e-56"
121
+ }) {
109
122
FloatingPointFormula formula = fpmgr .makeNumber (s , singlePrecType );
110
123
assertThatFormula (fpmgr .isNegative (formula )).isTautological ();
111
124
assertThatFormula (fpmgr .isNegative (fpmgr .negate (formula ))).isUnsatisfiable ();
112
125
assertEqualsAsFp (fpmgr .negate (formula ), fpmgr .abs (formula ));
113
126
}
114
- for (String s : new String [] {"1" , "Infinity" , "0" , "0.0" , "0.000" }) {
127
+ for (String s :
128
+ new String [] {
129
+ "1" ,
130
+ "Infinity" ,
131
+ "0" ,
132
+ "0.0" ,
133
+ "0.000" ,
134
+ "0e5" ,
135
+ "0.00e-5" ,
136
+ "12e34" ,
137
+ "12e-34" ,
138
+ "12.34E56" ,
139
+ "12.34e-56"
140
+ }) {
115
141
FloatingPointFormula formula = fpmgr .makeNumber (s , singlePrecType );
116
142
assertThatFormula (fpmgr .isNegative (formula )).isUnsatisfiable ();
117
143
assertThatFormula (fpmgr .isNegative (fpmgr .negate (formula ))).isTautological ();
118
144
assertEqualsAsFp (formula , fpmgr .abs (formula ));
119
145
}
120
- for (String s : new String [] {"+1" , "+Infinity" , "+0" , "+0.0" , "+0.000" }) {
146
+ for (String s :
147
+ new String [] {
148
+ "+1" ,
149
+ "+Infinity" ,
150
+ "+0" ,
151
+ "+0.0" ,
152
+ "+0.000" ,
153
+ "+0e5" ,
154
+ "+0.00e-5" ,
155
+ "+12e34" ,
156
+ "+12e-34" ,
157
+ "+12.34E56" ,
158
+ "+12.34e-56"
159
+ }) {
121
160
FloatingPointFormula formula = fpmgr .makeNumber (s , singlePrecType );
122
161
assertThatFormula (fpmgr .isNegative (formula )).isUnsatisfiable ();
123
162
assertThatFormula (fpmgr .isNegative (fpmgr .negate (formula ))).isTautological ();
@@ -791,6 +830,26 @@ private <T> void proveForAll(List<T> args, Function<T, BooleanFormula> f)
791
830
}
792
831
}
793
832
833
+ @ Test
834
+ public void checkString2FpConversion32 () throws SolverException , InterruptedException {
835
+ proveForAll (
836
+ getListOfFloats (),
837
+ pFloat ->
838
+ fpmgr .equalWithFPSemantics (
839
+ fpmgr .makeNumber (pFloat , singlePrecType ),
840
+ fpmgr .makeNumber (Float .toString (pFloat ), singlePrecType )));
841
+ }
842
+
843
+ @ Test
844
+ public void checkString2FpConversion64 () throws SolverException , InterruptedException {
845
+ proveForAll (
846
+ getListOfDoubles (),
847
+ pDouble ->
848
+ fpmgr .equalWithFPSemantics (
849
+ fpmgr .makeNumber (pDouble , doublePrecType ),
850
+ fpmgr .makeNumber (Double .toString (pDouble ), doublePrecType )));
851
+ }
852
+
794
853
@ Test
795
854
public void checkIeeeBv2FpConversion32 () throws SolverException , InterruptedException {
796
855
proveForAll (
0 commit comments