Fix exact sqrt (#3721)
authorAndrew Reynolds <andrew.j.reynolds@gmail.com>
Fri, 7 Feb 2020 01:12:29 +0000 (19:12 -0600)
committerGitHub <noreply@github.com>
Fri, 7 Feb 2020 01:12:29 +0000 (17:12 -0800)
Co-authored-by: Ahmed Irfan <43099566+ahmed-irfan@users.noreply.github.com>
src/theory/arith/nl_model.cpp
test/regress/CMakeLists.txt
test/regress/regress0/nl/issue3719.smt2 [new file with mode: 0644]

index eff810522c991dbc6c670f4e1389f1d8ad385a52..54ae4c52acb1a4767dd6f7406d720050b8bc90ce 100644 (file)
@@ -1200,8 +1200,8 @@ bool NlModel::getApproximateSqrt(Node c, Node& l, Node& u, unsigned iter) const
     Rational curr_sq = curr * curr;
     if (curr_sq == rc)
     {
-      rl = curr_sq;
-      ru = curr_sq;
+      rl = curr;
+      ru = curr;
       break;
     }
     else if (curr_sq < rc)
index 35d60476838afb91fdc182d7cde9f2b48b97dbc0..ef33adb598339f20e129fa0a87c15b0fb9b90d0b 100644 (file)
@@ -558,6 +558,7 @@ set(regress_0_tests
   regress0/nl/issue3411.smt2
   regress0/nl/issue3475.smt2
   regress0/nl/issue3652.smt2
+  regress0/nl/issue3719.smt2
   regress0/nl/magnitude-wrong-1020-m.smt2
   regress0/nl/mult-po.smt2
   regress0/nl/nia-wrong-tl.smt2
diff --git a/test/regress/regress0/nl/issue3719.smt2 b/test/regress/regress0/nl/issue3719.smt2
new file mode 100644 (file)
index 0000000..c620432
--- /dev/null
@@ -0,0 +1,5 @@
+(set-logic QF_NRA)
+(set-info :status sat)
+(declare-fun a () Real)
+(assert (= (* 4 a a) 9))
+(check-sat)