## simple calculations

command: CALC <type> <&var> <=> <operand1> [<operation> [<operand2>]] [<p>]

### parameters

• <type> parameter type: char
Determines type of operators <operand1>, <operand2> and result type. Possible values are "i" (integer), "r" (real), "s" (string) and "t" (time).
• <&var> parameter type: symbol address
Variable where to store the result of the calculation. This may be a local or global variable.
• <=> parameter type: constant
Must be "="-character.
• <operand1>, <operand2> parameter type: depends on <type>
operators
• <operation> parameter type: string
Operation to be applied to operators.

For detailed information see type table below.

### type table

 operation result-type task operations on integer numbers i + i i i addition of integers i - i i i subtraction of integers i * i i i multiplication of integers i div i i i division of integers (no remainder) i mod i i i remainder of integer division i int f i return integer value of float operations on real numbers r + r r r addition of real numbers r - r r r subtraction of real numbers r * r r r multiplication of real numbers r div r r r division of real numbers r abs r r remove sign r arccos r r arccos of in degrees r arcsin r r arcsin of in degrees r arctan r r arctan of in degrees r arctan2 r r r arctan of / in degrees r cos r r cosine of (input in degrees) r sin r r sine of (input in degrees) r tan r r tangens of (input in degrees) r cosh r r cosh of r sinh r r sinh of r tanh r r tanh of r exp r r exp() r ln r r natural logarithm r log r r decimal logarithm r power r r r exponentiation of by r sqrt r r square root of operations on strings s + s s s concatenation with blank s parse s i s takes ""-th substring of s extract s i(+i) s extracts

chars from pos s lower s s s turn one character after into lower case s lowercase s s change into lower case s upper s s change into upper case s phaseupper s s pre-seed all lower case characters with V and return upper case string s doslash s s replace back-slash by forward slash s qname s t s construct filename from station () and time () s strlen s i return length of operations on time values t tdiff t t r computes difference of absolute times in sec t tadd t r t adds secs to t julian t i return julian day of t cnv_julian i i s calc month and day out of year () and julian day () t make_time s t turn string "year month day hour minute second ms" into SH time string

Note: The "extract" operation requires an additional parameter <p> specifying the number of characters to be extracted.

### qualifier

• /fmt
Produces output in a special format. Format string must be entered as in C printf commands. The format string should be enclosed in "< >" brackets. Note the automatic lowercase to uppercase conversion of the command line interpreter. To prevent this conversion for a single character within a format string precede this character by a "@"-sign (Example: /fmt=<%5.2@f> creates real number in floating point format "%5.2f" with two decimal digits).

### examples

calc r &res = 2.0 * ^delta(1)
computes real multiplication of sample distance of second trace by two and stores the result in variable "res"
calc s &str = teststring
copies string "TESTSTRING" to variable "str"
calc r &res = ^maxval(2) sqrt
computes square root of maximum value of trace 2 and stores result in variable "res"