Calc
 
Format v1 =Calc v2 o3 v4
Examples MyVar =Calc 3 +4 ;Set MyVar to 7
Purpose Perform an integer calculation
Parameters v1 -Variable being set
v2 -First integer number
o3 -Operation
v4 -Second integer number
Similar Cmds CalcReal
Notes All extraneous text (i.e.everything but 0 to 9 and the minus
sign)is removed from the values v2 and v4.
If either v2 or v4 are null,they are interpreted as 0.
The operations used by Calc (and also CalcReal)are as follows:
————————— ———————— ————————— ———————— ————————— ————————————————————
Operation Meaning Operation Meaning Operation Meaning)
————————— ———————— ————————— ———————— ————————— ————————————————————
+ Add * Multiply Highest Pick biggest number
- Subtract / Divide Lowest Pick smallest number
————————— ———————— ————————— ———————— ————————— ————————————————————
The Calc command uses integer division.This means that any remainder is discarded.Thus,the calculation 10 /3 will return a value of 3,since 3 goes into 10 three times,with a remainder of 1 (which is ignored).
The Calc command can handle very large numbers,but if your calculations take you beyond 18 digits,you are getting very close to the edge of Parse-O-Matic ’ s integer range.
 
CalcReal
 
Format v1 =CalcReal v2 o3 v4 [v5 ]  
Examples MyVar =CalcReal 3.1 *4.3
MyVar =CalcReal 10.0 /3.0 5
;Set MyVar to 13.33
;Set MyVar to 3.33333
Purpose Perform a real-number calculation
Parameters v1 -Variable being set
v2 -First real number
o3 -Operation
v4 -Second real number
v5 -Number of decimal places
 
Defaults v5 =2  
Similar Cmds Calc  
Notes All extraneous text (i.e.everything but 0 to 9,the minus
sign and the decimal point)is removed from v2 and v4.
If either v2 or v4 are null,they are interpreted as 0.0.
By default,operations with fixed decimal places are subject
to rounding.See the Rounding command for details.
For a list of operations,see the Calc command.
Real number operations have 18 valid digits across the range (expressed in scientific notation)of
3.6 x 10 ^–4951 to 1.1 x 10 ^4932
If you are working with very large numbers,it is a good idea to write some experimental scripts to determine if the accuracy you require can be obtained.
If v5 is set to “Float ”,CalcReal will calculate as many decimal places as it possibly can.Before you do this, however,you should be aware that when computer calculations are taken to the limit of the software's precision,it can result in inaccuracy.
 
Dec
 
Here is a list of the literal comparators:
 
Format Dec v1 [v2 ]
Examples Dec MyVar 3 ;Subtract 3 from variable MyVar
Purpose Decrements (decreases)an integer number
Parameters v1 -Variable being set
v2 -The amount by which to decrement v1
Defaults v2 =1
Restrictions Inc
Notes Decrementing with a negative value increases v1
The Dec command can handle very large numbers,but if your calculations take you beyond 18 digits,you are getting very close to the edge of Parse-O-Matic ’ s integer range.
 
Inc
 
Format Inc v1 [v2 ]
Examples Inc MyVar 3
Inc MyVar
;Add 3 to variable MyVar
;Add 1 to variable MyVar
Purpose Increments (increases)an integer number
Parameters v1 -Variable being set
v2 -The amount by which to increment v1
Defaults v2 =1
Similar Cmds Dec
Notes Incrementing with a negative value decreases v1
 
The Inc command can handle very large numbers,but if your calculations take you beyond 18 digits,you are
getting very close to the edge of Parse-O-Matic ’s integer range.
 
Rounding
 
Format Rounding c1
Examples Rounding 'Yes'
Purpose Turns rounding-up on or off for fixed-place answers calculated
by the CalcReal command
Parameters c1 -'Yes'or 'No'('Yes'=Round-up the answers)
Notes Turning off rounding is not recommended .By default,
rounding-up is on .If you turn it off,the answers are simply
truncated according to the number of fixed decimal places.If
you do this,you should be aware of the problems inherent in
computer calculation.For details,see CalcReal.
Fixed-place numbers are rounded-up by adding 5 to the next-lowest position.So 4.56 with one fixed- decimal place is rounded by adding 0.05,yielding 4.61,which truncates to '4.6'.If the answer is negative,the adjustment is subtracted rather than added,so -4.56 with one fixed decimal becomes '-4.6'.

(This page is part of the online user manual for Parse-O-Matic.  Parse-O-Matic is a programmable parsing tool that can extract, manipulate, convert or mine existing data sources and turn them into importable data.  For more information on Parse-O-Matic products and conversion services, please visit www.ParseOMatic.com)