Revision: 20430
          http://sourceforge.net/p/jmol/code/20430
Author:   hansonr
Date:     2015-04-03 01:32:20 +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:
--------------
    trunk/Jmol/src/org/jmol/scriptext/MathExt.java
    trunk/Jmol/src/org/jmol/viewer/Jmol.properties

Modified: trunk/Jmol/src/org/jmol/scriptext/MathExt.java
===================================================================
--- trunk/Jmol/src/org/jmol/scriptext/MathExt.java      2015-04-01 20:16:22 UTC 
(rev 20429)
+++ trunk/Jmol/src/org/jmol/scriptext/MathExt.java      2015-04-03 01:32:20 UTC 
(rev 20430)
@@ -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:
@@ -2847,8 +2858,8 @@
         if (!ok)
           break;
         Object f = getMinMax(fdata, tok);
-        if (f instanceof Float) {
-          float value = ((Float) f).floatValue();
+        if (f instanceof Number) {
+          float value = ((Number) f).floatValue();
           switch (xyz) {
           case 0:
             result.x = value;

Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties
===================================================================
--- trunk/Jmol/src/org/jmol/viewer/Jmol.properties      2015-04-01 20:16:22 UTC 
(rev 20429)
+++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties      2015-04-03 01:32:20 UTC 
(rev 20430)
@@ -14,8 +14,12 @@
 
 TODO: remove HTML5 dependency on synchronous file loading (check SCRIPT 
command for problems)
 
-Jmol.___JmolVersion="14.3.13_2015.04.01b" 
+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)
+
+JmolVersion="14.3.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