[Toc][Index]

@EVAL


@EVAL[expression]:  Evaluates an arithmetic expression.  @EVAL supports 
addition (+), subtraction (-), multiplication (*), division (/), integer 
division (\, returns the integer part of the quotient), modulo (%%), and 
integer exponentiation (**).  The expression can contain environment 
variables and other variable functions.  @EVAL also supports parentheses, 
commas, and decimals.  Parentheses can be nested.  @EVAL will strip 
leading and trailing zeros from the result. When evaluating expressions, 
**, *, /, and %% take precedence over + and -.  For example, 3 + 4 * 2 
will be interpreted as 3 + 8, not as 7 * 2.  To change this order of 
evaluation, use parentheses to specify the order you want. Also see @DEC 
and @INC 
To ensure that your @EVAL expressions are interpreted correctly, spaces 
should be placed on both sides of each operator, for example: 


        %@eval[(20 %% 3) + 4]

The maximum precision is 16 digits to the left of the decimal point and 8 
digits to the right of the decimal point.  You can alter the default 
precision to the right of the decimal point on the Options 2 page of the 
OPTION dialogs or with the EvalMax and EvalMin directives in CMD.INI, and 
with the SETDOS /F command.  You can alter the decimal character from the 
Options 1 page of the OPTION dialogs, with the DecimalChar directive, or 
the SETDOS /G command. 
You can alter the precision for a single evaluation with the construct 
@EVAL[expression=x.y].  The x value specifies the minimum decimal 
precision (i.e., the minimum number of decimal places displayed); the y 
value sets the maximum decimal precision.  You can use =x,y instead of 
=x.y if the comma is your decimal separator.  If x is greater than y, it 
is ignored.  You can specify either or both arguments, for example: 


        @eval[3 / 7=2]          returns 0.42857143
        @eval[3 / 7=.4]         returns 0.4286
        @eval[3 / 6=2.4]        returns 0.50


Created using Inf-PHP v.2 (c) 2003 Yuri Prokushev
Created using Inf-HTML v.0.9b (c) 1995 Peter Childs