Title
Fundamental arithmetic operations for use with rpnfcn()
Syntax
Command name Argument
&add() NULL
&subtract() NULL
&product() NULL
÷() NULL
Description
These functions perform the four fundamental arithmetic operations on the two top elements of the stack. They remove the top element and replaces the upper but one element with the result of the operation, i.e. the number of elements in the stack are reduced by one and the result is the new top element. All four perform their operations element-wise without checking for conformability as they rely on the Mata colon operators :+, :-+, :*, and :/, see Mata colon operators. &subtract() subtracts the current top element of the stack element from the element just below, ÷() divides the upper but one element of the stack with the top element.
Source code
rpnbinop.mata
Author
Henrik Støvring, Research Unit of General Practice, University of Southern Denmark. Please email hstovring@health.sdu.dk if you have comments, questions or observe any problems.
Also see
Manual: [M] Mata Reference Manual
Online: help for [M-0] mata, Evaluation of algorithm matrix using RPN, RPN stack manipulation functions, RPN distribution functions, RPN functions for integration