File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -221,3 +221,24 @@ def from_numeric(n: Numeric) -> OtherNumeric: # type: ignore[empty-body]
221
221
222
222
egraph .register (rewrite (OtherNumeric (1 )).to (from_numeric (Numeric .ONE )))
223
223
assert expr_parts (egraph .simplify (OtherNumeric (i64 (1 )), 10 )) == expr_parts (from_numeric (Numeric .ONE ))
224
+
225
+
226
+ def test_f64_negation () -> None :
227
+ egraph = EGraph ()
228
+ # expr1 = -2.0
229
+ expr1 = egraph .define ("expr1" , - f64 (2.0 ))
230
+
231
+ # expr2 = 2.0
232
+ expr2 = egraph .define ("expr2" , f64 (2.0 ))
233
+
234
+ # expr3 = -(-2.0)
235
+ expr3 = egraph .define ("expr3" , - (- f64 (2.0 )))
236
+
237
+ x , y = vars_ ("x y" , f64 )
238
+
239
+ egraph .register (rewrite (- (- x )).to (x ))
240
+
241
+ egraph .run (10 )
242
+
243
+ egraph .check (eq (expr1 ).to (- expr2 ))
244
+ egraph .check (eq (expr3 ).to (expr2 ))
You can’t perform that action at this time.
0 commit comments