Choose one: (1) Install Package, (2) No-Install Package (each about 1 MB).
Code: Select all
v7.60.0018 - 2008-09-20 13:27
+++ Scripting now can do basic calculation using math operators +-*/.
Fractions and parentheses are supported.
Examples:
::echo 1 + 1;
::echo 1 - 2 - 3; // -4
::echo 1 - (2 - 3); // 2
::echo 1/3 + 1/3;
::echo 1 + 2 * 3;
::echo (1 + 2) * 3;
::echo 1/0; // error division by zero
::$a=3; $b=2; echo $a / $b; // 1.5
::$fraction = "1.5"; echo $fraction == 3/2; // true
::echo "1.2" + "2.1"; // 3.3
Remarks:
- Strings are converted to numbers as possible (just like in
comparisons).
::$a=""; $b="2"; echo $a + $b; // = 2
::$a="1a"; $b="2b"; echo $a + $b; // = 3
- The decimal separator is NOT locale specific (e.g. dot in US,
comma in Germany) but hard-coded to dot. This way scripts are
interchangeable between regions.
- To define fractional numbers you have to quote them:
::$fraction = "1.5"; echo $fraction / 2; // 0.75 (1.5/2)
::$fraction = 1.5; echo $fraction / 2; // 7.5 (15/2)
- Calculation uses 8-byte floating point numbers with the
following ranges:
negative: -1.79769313486232E308 to -4.94065645841247E-324
positive: 4.94065645841247E-324 to 1.79769313486232E308
Floating point arithmetic has its natural shortcomings so don't
expect too much in terms of precise accuracy down to the 12th
digit. A file manager is not a scientific calculator.
! Scripting: Comparison did not honour fractions. Fixed. This works
now as expected:
::echo "10.3" > "2.2"; //true
+ Scripting got a new command.
Name: Echo
Action: Show simple message box.
Syntax: echo text
Examples:
::echo "hi!";
::echo <date>;
Remarks: It's the smaller brother of msg. Added mainly for
copy+paste compatibility with PHP code.
! Scripting: Nesting ternaries did not work as expected:
::msg (1==1)?((2==2)?"yes":"no"):"error"; //should be "yes"
Fixed.
! Scripting: Nesting comparisons did not work as expected:
::msg (1==1) == (2==2); //should be 1 (True)
Fixed.
! Scripting: Numerical comparison was invoked if any of the operands
was numerical. Wrong: _both_ operands need to be numerical! Fixed.
::echo ("0" > ""); //true (1)
::echo ("0" > "0"); //false (0) (numeric)
::echo ("0" > "00"); //false (0) (numeric)
::echo ("0" == "00"); //true (1) (numeric)
::echo ("0" == "")"; //false (0)
::echo ("a" == "")"; //false (0)
::echo ("a" == "0")"; //false (0)
::echo (0 == ""); //false (0)
::$foo=0; echo ($foo == ""); //false (0)
! Scripting: Would ignore functions when one or more blanks were
between function name and opening parenthesis. Fixed. Now you can
do this:
::msg quote ("pluto");
! Scripting: Setting variables using equal-operator would convert
the variables to lower case internally. Fixed: Case is preserved
now, and this works as expected:
::$myText = "Howdy!"; echo $myText;
! SC "load": In a passed list of script labels any blanks were not
trimmed. Fixed.