[ShCommands Return to command index] == simple calculations == '''command''': CALC <&var> <=> [ []] [

] === parameters === * ''parameter type: char''[[BR]] Determines type of operators , and result type. Possible values are "i" (integer), "r" (real), "s" (string) and "t" (time). * <&var> ''parameter type: symbol address''[[BR]] Variable where to store the result of the calculation. This may be a local or global variable. * <=> ''parameter type: constant''[[BR]] Must be "="-character. * , ''parameter type: depends on ''[[BR]] operators * ''parameter type: string''[[BR]] Operation to be applied to operators. For detailed information see [#typetable type table] below. === type table === {{{ #!rst .. note: some of the operation signs are escaped by back slash to disable their special meaning inside ReST markup ====== ========== ========== ========== =========== ==== 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 i (undocumented) ------ ---------- ---------- ---------- ----------- ---- 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 (undocumented) s lowercase s (undocumented) s upper s (undocumented) s phaseupper s (undocumented) s doslash s (undocumented) s qname s (undocumented) s strlen s (undocumented) ------ ---------- ---------- ---------- ----------- ---- 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 (undocumented) t cnv_julian t (undocumented) t make_time t (undocumented) ====== ========== ========== ========== =========== ==== }}} ''Note:'' The "extract" operation requires an additional parameter

specifying the number of characters to be extracted. === qualifier === * /fmt[[BR]] 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"