#! /bin/sh /usr/share/dpatch/dpatch-run
## bugfix-filter.dpatch by Joachim Reichel <joachim.reichel@gmx.de>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: The patch fixes a problem exposed by the following piece of code:
## DP:
## DP: #include "CORE/Expr.h"
## DP: 
## DP: int main (int argc, char* argv[])
## DP: {
## DP:   CORE::BigRat large ("22056730828276574458547175013883216467476872755086964295193460720021853755465629072269258954121163731475631714119099840347497961090538262328734056966733720709815412125069165956247150829255095890113693179945329398691563060211289184266247766729226258574306693936046940295499433823219204319239906902222024366393841401155626607535624231276347490007095991669259288994417285636787983003769503223726502372783693309954766065876799926762287172711748917912232935178660587316551968245210589455313071167076401493075299837356515655888411082309335826494442934347285376887664307211239365443306044183662876478985244212735844924974989150199069307003280200060111499569786382285977364825392318326851159432635346367151290291631531554913751724893460469069547208946955224265325392885399798126657208221180788778400324907150233302791588009276803009797028184220618992783121977857908976266677561242802415919690200544114295109720535221099297209448522061332432197124484207428635197981586216597681588717101511557253786343834032638045890884717389911401000590189782799474466040733722126091652892707223954277743304836036311008667705531056276150658576893318688109218369131172944113814569041058017252601228351626529536894545671431774164326784454508884394355149284154441884153238020072100248384069127883977817374317881721365157547731991130497340067027095158450768002152789673852171185697375893915055282375021710680972671037261939809348959898244034519810739833260745241274632367144064250505129889920830125711206378536009811130822431321822223006689430061821350208089344103560621893694553717767618669117454686718040075832411848289616082068565327605459820927971564224635272839395488625653689443250779901268746633776694188674413434194729654493929833283912621040736895959147326292521899914111877902178492154547202941117349222179613641054322697542774178737769632217397181032969294874757392502243456256079712050558596812288058246727669016499639023706941884747862412582052641835266418284885728964319815812258779086499090061763081207521408713543051054202030839930630401951233176791299227117356324258433064969253290770713624926626235861939377682590602658977681375515775284293988813502174038878847682159558119588666364539632642349084495252373743605298522860136713999547072522111189366203938081292843");
## DP:   CORE::Expr expr (CORE::BigRat(1) / large);
## DP:   double lb, ub;
## DP:   expr.doubleInterval (lb, ub);
## DP:   assert (lb == 0);
## DP:   assert (ub > 0);
## DP:   return 0;
## DP: }

@DPATCH@
diff -urNad core++-1.7.orig/inc/CORE/Filter.h core++-1.7/inc/CORE/Filter.h
--- core++-1.7.orig/inc/CORE/Filter.h	2005-08-27 12:32:14.156723880 +0200
+++ core++-1.7/inc/CORE/Filter.h	2005-08-27 12:32:41.016640552 +0200
@@ -80,7 +80,10 @@
     if (value != CORE_REAL_ZERO) {
       ind = 1;
       fpVal = value.doubleValue();
-      maxAbs = core_abs(fpVal); // NaN are propagated correctly by core_abs.
+      if (value.MSB() <= -1075)
+	maxAbs = 1;
+      else	
+      	maxAbs = core_abs(fpVal); // NaN are propagated correctly by core_abs.
     }
   }
   //@}
@@ -91,7 +94,7 @@
   double getValue() const {
     return fpVal;
   }
-  /// check whether filtered value is OK
+  /// check whether the sign (!) of the filtered value is OK
   bool isOK() const {
     return (fpFilterFlag  && // To disable filter
             finite(fpVal) && // Test for infinite and NaNs
