Hi all,

in Jmol 14.3.13_2015.04.01b the minimum and maximum modifier functions 
'.min' and '.max' change unexpectedly (at least for me) the type of the 
result for integer variables to decimal.

--- Examples -----------
function minMaxTest(x, y) {
   var minValue = [x, y].min;
   var maxValue = [x, y].max;
   print "x=" + x + ";  xType=" + x.type;
   print "y=" + y + ";  yType=" + y.type;
   print "minValue=" + minValue + ";  minValueType=" + minValue.type;
   print "maxValue=" + maxValue + ";  maxValueType=" + maxValue.type;
   print "-----";
}
minMaxTest(1, 2);
minMaxTest(1.0, 2.0);
minMaxTest("1", "2");
minMaxTest("1",2.0)

--- Example Output -----
x=1;  xType=integer
y=2;  yType=integer
minValue=1.0;  minValueType=decimal
maxValue=2.0;  maxValueType=decimal
-----
x=1.0;  xType=decimal
y=2.0;  yType=decimal
minValue=1.0;  minValueType=decimal
maxValue=2.0;  maxValueType=decimal
-----
x=1;  xType=string
y=2;  yType=string
minValue=1.0;  minValueType=decimal
maxValue=2.0;  maxValueType=decimal
-----
x=1;  xType=string
y=2.0;  yType=decimal
minValue=1.0;  minValueType=decimal
maxValue=2.0;  maxValueType=decimal
-----
------------------------

It looks like it is intended that the result is always decimal.
If this is the case I would recommend to mention this in the scripting 
documentation, since it is not obvious to everyone for a set of integer 
values.

Regards,
Rolf

-- 

Rolf Huehne
Postdoc

Leibniz Institute for Age Research - Fritz Lipmann Institute (FLI)
Beutenbergstrasse 11
07745 Jena, Germany

Phone:   +49 3641 65 6205
Fax:     +49 3641 65 6210
E-Mail:  rhue...@fli-leibniz.de
Website: http://www.fli-leibniz.de

           Scientific Director: Prof. Dr. K. Lenhard Rudolph
        Head of Administration: Dr. Daniele Barthel
Chairman of Board of Trustees: Dennys Klein

VAT No: DE 153 925 464
Register of Associations: No. 230296, Amtsgericht Jena
Tax Number: 162/141/08228


------------------------------------------------------------------------------
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-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to