This function evaluates a complex numerical expression and returns the results.
result = CALC(expression,[decimal])
Parameters
Numeric result of the operation.
The mathematical expression to be evaluated. Numbers can be up to six significant digits, containing a decimal point and leading plus sign or leading minus sign. Blanks are ignored. The operators that you can use are shown in the following section.
Because CALC() uses true floating-point arithmetic, values can be imprecise. Large and small numbers include a scaling factor (power of 10), and return values in the following form:
1.23456 * 10 ** 25
Number of digits to the right of the decimal point.
Default: All significant digits appear, but trailing zeros are omitted.
Plus
Minus
Raise to a power
Multiply
Divide
Start priority grouping
End priority grouping
Evaluate sine
Evaluate cosine
Evaluate arc tangent
Exponential
Absolute value
Square root
Base 10 logarithm
Base 10 logarithm
Base e (natural) logarithm
One of the following codes:
ARG 1 MISSING OR INVALID
CHARACTER IN ARG 1
ARG 2 INVALID
One of the following codes:
EXPECTED OPERATOR MISSING
TOO MANY NUMERIC FIELDS
OPERATOR FOLLOWS OPERATOR
INVALID OPERATOR
NUMBER FOLLOWS RIGHT PARENTHESIS
UNBALANCED PARENTHESES
OVERFLOW OR UNDERFLOW
EXPRESSION TOO COMPLEX
ERROR DURING SIN/COS EVALUATION
ERROR DURING EXP EVALUATION
ERROR DURING LOG EVALUATION
ERROR DURING SQRT EVALUATION
RESULT TOO LARGE
DIVISION BY ZERO
Example
calc('1+1') == '2' calc('(1+2)*5') == '15' /* Not 11 */ calc('abs(-9)') == '9'
Copyright © 2014 CA Technologies.
All rights reserved.
|
|