[Mpfi-commits] r363 - trunk/mpfi/src

ptheveny at users.gforge.inria.fr ptheveny at users.gforge.inria.fr
Mar 29 Juin 16:17:44 CEST 2010


Author: ptheveny
Date: 2010-06-29 16:17:44 +0200 (Tue, 29 Jun 2010)
New Revision: 363

Modified:
   trunk/mpfi/src/d_div.c
Log:
Fix wrong return value in case of overflow in mpfi_d_div.c

Modified: trunk/mpfi/src/d_div.c
===================================================================
--- trunk/mpfi/src/d_div.c	2010-06-29 14:16:56 UTC (rev 362)
+++ trunk/mpfi/src/d_div.c	2010-06-29 14:17:44 UTC (rev 363)
@@ -42,10 +42,6 @@
   if (MPFI_NAN_P (a))
     MPFR_RET_NAN;
 
-  if (mpfr_inf_p (&(a->left))  && MPFI_LEFT_IS_INEXACT (inexact_div))   /* overflow */
-    inexact += 1;
-  if (mpfr_inf_p (&(a->right)) && MPFI_RIGHT_IS_INEXACT (inexact_div))  /* overflow */
-    inexact += 2;
   if (mpfi_bounded_p (a)) {
     if (inexact_set) /* if the conversion of b into a mpfi is inexact,
                         then so are both endpoints of the result.      */
@@ -53,6 +49,13 @@
     else
       inexact = inexact_div;
   }
+  else {
+    /* this also treats overflow cases */
+    if (MPFI_LEFT_IS_INEXACT (inexact_div))
+      inexact += 1;
+    if (MPFI_RIGHT_IS_INEXACT (inexact_div))
+      inexact += 2;
+  }
 
   if (mpfi_revert_if_needed (a)) {
     WARNING_REVERTED_ENDPOINTS (a, "mpfi_d_div");




More information about the Mpfi-commits mailing list