ue.0190
Stack arithmetic.
Syntax
string.delimiter calculation.string.data ? u0190 string.delimiter output.target
Description
performs arithmetic on a reverse-Polish notation string which has been built in the current output buffer.
'string.delimiter' is a single-character delimiter which may be any character of the user's choosing, as long as it does not appear in the calculation string.
'calculation.string' is the arithmetic function to perform, in reverse-Polish notation. It is built in the primary input buffer prior to the user exit call. The final argument in the calculation string is always a '?' to indicate that the calculation is to be performed.
The line following the user exit contains the closing string.delimiter.
'output.target' specifies where the output is to be placed. 'Output.targets' are : 'S' for current output buffer, 'P' for primary input buffer, 'A' for secondary output buffer. Any other entry is taken to mean output to terminal, however 'T' is usually used.
The calculation string is evaluated, the input buffer is cleared, and the result is output to the specified 'output.target'.
The following arithmetic operators are available for use within the calculation string:
+ Addition.
- Subtraction.
* Multiplication.
/ Division.
& Logical AND.
! Logical OR.
\ Logical NOT.
< Less than.
<= Less than or equal to.
= Equal to.
\= Not equal.
>= Greater than or equal to.
> Greater than.
\< Not less than.
\> Not greater than.
Example
001 pq
002 OEnter A and B
003 ip
004 st on
005 h:
006 a1
007 h
008 a2
009 h +
010 a1
011 h
012 a2
013 h - * ?
014 u0190
015 : t
016 x
Builds the calculation string ':<a><b>+ <a><b>- *
?:', which evaluates to '(<a>+<b>) *
(<a>-<b>)'
002 s2
003 h: 0 ?
004 u0190
005 : P
Places a zero in the second position of the primary input buffer.
See Also
User Comments
What do you think?
Share your experience or ask a question by using the form below.
Login to leave your comments.
