Revision: 20431
          http://sourceforge.net/p/jmol/code/20431
Author:   hansonr
Date:     2015-04-03 01:41:00 +0000 (Fri, 03 Apr 2015)
Log Message:
-----------
Jmol.___JmolVersion="14.3.13_2015.04.02" 

bug fix: [3 4 5].min should give integer 3, not decimal 3.0 (same with .max)

Modified Paths:
--------------
    branches/v14_2/Jmol/src/org/jmol/scriptext/MathExt.java
    branches/v14_2/Jmol/src/org/jmol/viewer/Jmol.properties

Modified: branches/v14_2/Jmol/src/org/jmol/scriptext/MathExt.java
===================================================================
--- branches/v14_2/Jmol/src/org/jmol/scriptext/MathExt.java     2015-04-03 
01:32:20 UTC (rev 20430)
+++ branches/v14_2/Jmol/src/org/jmol/scriptext/MathExt.java     2015-04-03 
01:41:00 UTC (rev 20431)
@@ -2742,20 +2742,27 @@
         break;
       }
       double sum;
+      int minMax;
+      boolean isMin = false;
       switch (tok) {
       case T.min:
+        isMin = true;
         sum = Float.MAX_VALUE;
+        minMax = Integer.MAX_VALUE;
         break;
       case T.max:
         sum = -Float.MAX_VALUE;
+        minMax = -Integer.MAX_VALUE;
         break;
       default:
-        sum = 0;
+        sum = minMax = 0;
       }
       double sum2 = 0;
       int n = 0;
+      boolean isInt = true;
       for (int i = ndata; --i >= 0;) {
-        float v = (data == null ? SV.fValue(sv.get(i)) : data[i]);
+        SV svi = sv.get(i);
+        float v = (data == null ? SV.fValue(svi) : data[i]);
         if (Float.isNaN(v))
           continue;
         n++;
@@ -2769,12 +2776,13 @@
           sum += v;
           break;
         case T.min:
-          if (v < sum)
-            sum = v;
-          break;
         case T.max:
-          if (v > sum)
+          isInt &= (svi.tok == T.integer); 
+          if (isMin == (v < sum)) {
             sum = v;
+            if (isInt)
+              minMax = svi.intValue;
+          }
           break;
         }
       }
@@ -2791,6 +2799,9 @@
         break;
       case T.min:
       case T.max:
+        if (isInt)
+          return Integer.valueOf(minMax);
+        break;
       case T.sum:
         break;
       case T.sum2:

Modified: branches/v14_2/Jmol/src/org/jmol/viewer/Jmol.properties
===================================================================
--- branches/v14_2/Jmol/src/org/jmol/viewer/Jmol.properties     2015-04-03 
01:32:20 UTC (rev 20430)
+++ branches/v14_2/Jmol/src/org/jmol/viewer/Jmol.properties     2015-04-03 
01:41:00 UTC (rev 20431)
@@ -4,8 +4,12 @@
 # THIS IS THE RELEASE BRANCH 
 # BUG FIXES ONLY, PLEASE
 
-Jmol.___JmolVersion="14.2.13_2015.04.01b" 
+Jmol.___JmolVersion="14.2.13_2015.04.02" 
 
+bug fix: [3 4 5].min should give integer 3, not decimal 3.0 (same with .max)
+
+JmolVersion="14.2.13_2015.04.01b" 
+
 bug fix: hash values created from named int variables do not clone properly
 bug fix: hash[key1]..key2.push()  does not work properly
 bug fix: show hash  where one of the elements is an empty hash ignores that key

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Jmol-commits mailing list
Jmol-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-commits

Reply via email to