[Kst] branches/work/kst/portto4/kst/src/libkstapp

Mike Fenton mike at staikos.net
Fri May 22 17:34:06 CEST 2009


SVN commit 971517 by fenton:

Fix proximity to zero double bug for major ticks.


 M  +6 -1      plotaxis.cpp  


--- branches/work/kst/portto4/kst/src/libkstapp/plotaxis.cpp #971516:971517
@@ -771,7 +771,12 @@
     int i = 0;
     qreal nextTick = firstTick;
     while (1) {
-      nextTick = firstTick + (i++ * majorTickSpacing);
+      // Note:  This was divided into two lines to avoid a close to zero error with double 
+      // values.  firstTick + (i++ * majorTickSpacing) where values where (-0.03 + 3 + 0.01)
+      // consistently provided a value of 1.73472e-18 resulting in base offset mode being
+      // triggered.
+      qreal space = i++ * majorTickSpacing;
+      nextTick = firstTick + space;
       if (nextTick > max)
         break;
       ticks << nextTick;


More information about the Kst mailing list