Reverse Polish Notation Calculator

Reverse Polish Notation (RPN) is a way of expressing mathematical operations in which the operator is placed to the right of the operand.

For example, the expression 4 + 4 is written as:

4 4 +

The RPN Calculator version 1_08 is a BBC BASIC for Windows implementation and is available by following the download link below.  The full source code is included for any programming students to hack.
New colour scheme!

Reverse Polish Calculations can be entered in one line.  Full support for the Windows clipboard.

Loads of new features including web searching, defining words, opening command prompt and Windows control panel.

DOWNLOAD version 1.08 Reverse Polish Notation Calculator for Windows (including source code and executable)

What's new in version 8?
* The calculator now tells you when updates are available (assuming your internet connection works).
* New functions for Windows 10, including running shell commands, opening Cortana and OneNote.
* New online help.
* Type any non-command word to search in your favourite browser.
* New commands: bing, clock, cortana, desk, desktop, dictionary, drive, open, google, mail, people, rename, restart, shell, shutdown, update.  See online help for more info,

What's new in version 7?
* BUG FIX - accumulator is now copied to Windows clipboard in the same numerical base as the current calculator mode.
* Open Windows dialogue boxes (explorer, admin tools, control panel)
* GOOGLE and BING commands - search directly from the calculator.
* Type a URL to open it in your browser.
* Open Wordpad, Magnifier and set time/date dialogues.
* PING url
* FREE SPACE command calculates free space on specified drive (eg. FREE SPACE C)
* POWER command indicates current power settings.

What's new in version 3?
* COPY command added.  Copies the accumulator to the Windows Clipboard.
* ACC ON/ACC OFF comands added.  Turning on forces the accumulator not to clear after a calculation.  The following result is added to the accumulator following each calculation.
* HEX/DEN/BIN/OCT commands added to switch between base 16, base 10, base 2 and base 8.
* LAST special variable added which stores the current value of the accumulator, allowing the previous result to be treated as a variable in proceeding calculations.
* INV function added.  Returns 1/x where x is the argument.

DOWNLOAD version 1.08 Reverse Polish Notation Calculator for Windows (including source code and executable)

Setting variables with the RPN.  Here we set the value of 'c' using the assignment operator := .
The Calculator has full Clipboard support.  Use the cursor keys to navigate through your past history, or to edit your expressions.

RPN Calculator Help for version 1.08

Reverse Polish Notation is a method for expressing algebra in which the operators are placed to the right of their operands. For example, the algebraic expression (4+5)*3becomes 4 5 + 3 *.
Functions are placed to the right of their argument, and return a single value. For example,sin(x+y) becomes x y + sin



  • +         Addition.
  • -         Subtraction.
  • *         Multiplication.
  • /         Division.
  • ^         Raise to power.
  • div       Integer division.
  • mod       Remainder of division.
  • and       Bitwise logical AND operation.
  • or       Bitwise logical OR operation.
  • eor       Bitwise logical EXCLUSIVE OR operation.
  • ==      Checks for equality between the operands. Returns -1 (true) if the two operands are equal, otherwise returns 0 (false)


  • abs A function which returns the absolute value of its numeric argument.
  • acs A function which returns, in radians, the arc-cosine of its numeric argument. The permitted range of the argument is –1 to +1.
  • asn A function which returns, in radians, the arc sine of its numeric argument. The permitted range of the argument is –1 to +1.
  • atn A function which returns, in radians, the arc tangent of its numeric argument. The permitted range of the argument is from minus infinity to plus infinity.
  • cos A function giving the cosine of its radian argument.
  • deg A function which converts radians to degrees.
  • exp A function returning 'e' to the power of the argument.
  • int A function truncating a real number to the lower integer.
  • inv A function which returns the inverse 1/x of the argument.
  • ln This function gives the logarithm to the base 'e' of its argument. The 'natural' number, 'e', is approximately 2.71828183.
  • log A function giving the base-10 logarithm of its argument.
  • not A function return the opposite boolean value to its argument. All +ve/-ve numbers evaluate as -1 (true). Zero evaluates as 0 (false)
  • rad A function which converts degrees to radians.
  • rnd A function which returns a random number. The type and range of the number returned depends upon the optional parameter.
  • sgn A function returning –1 for negative argument, 0 for zero argument and +1 for positive argument.
  • sin This function returns the sine of an angle. The angle must be expressed in radians, not degrees.
  • sqr A function returning the square root of its argument.
  • tan This function returns the tangent of an angle. The angle must be expressed in radians, not degrees.
  • round This function returns a real number rounded to the nearest integer.


  • acc off Returns the accumulator to its usual behaviour.
  • acc on Prevents the accumulator from clearing between calculations. The value of each calculation is added to the previous value of the accumulator.
  • admin Opens Windows admin tools.
  • bin Enters BINARY mode (base 2).
  • bing Sends search query to Bing, eg bing this thing. Without a parameter, sets the preferred search engine to Bing.
  • clear Sets the accumulator, all user-defined variables and the system clock to zero.
  • clock Open Clock and alarms (if available).
  • cmd Windows command line.
  • copy Copies the accumulator to the Windows Clipboard. NB CTRL+C copies the current input line to the clipboard instead.
  • cortana Opens Cortana (if available).
  • cp Opens Windows 'control panel' dialogue.
  • define word Defines the search term using your browser.
  • den Enters DENARY mode (base 10).
  • desk or desktop Opens the desktop.
  • dictionary Open superdecade dictionary.
  • drive Microsoft maps (if available). egdrive London.
  • file Open a specific file. eg file c:\users\username\filename.ext.
  • files Opens windows explorer.
  • free space Shows free space on drive letter, eg free space c.
  • google Sends search query to Google, eg google this thing. Without a parameter, sets the preferred search engine to Google.
  • help Loads online help (you are currently reading it now).
  • hex Enters HEXADECIMAL mode (base 16).
  • magnifier Opens Windows magnifier tool.
  • mail Send mail (if available). eg mail someone@domain.
  • notepad Opens Windows Wordpad.
  • oct Enters OCTAL mode (base 8).
  • onenote Open OneNote (if avilable).
  • open Synonymous with file.
  • people Open People (if available).
  • ping Sends a ping to ip eg ping
  • power Shows current power status.
  • programs Opens the Windows 'programs' dialogue.
  • quit Closes the RPN calculator without further warning.
  • rename Rename the title bar, eg rename My shopping calculations.
  • restart Restart the computer.
  • set time Opens the Windows 'set time' dialogue.
  • set date Opens the Windows 'set date' dialogue.
  • settings Open Windows settings.
  • shell Open Windows 10 shell command. eg shell ms-settings:powersleep
  • shutdown Shuts down the computer.
  • sound Opens Windows sound controls.
  • tasks Opens Windows task scheduler.
  • update Check for updates.
  • user Finds current user
  • version Shows current version of RPN calc and OS.
  • walk Microsoft maps (if available). egwalk London.

Special variables and constants

  • last This special variable holds the current value of the accumulator. Thus a calculation can make use of the previous result.
  • pi This variable has a constant value of 3.14159265
  • time This special variable holds the value of the current internal system clock in centi-seconds (one-hundreths of a second).

Making an assignment to a variable

The RPN calculator has 26 variables with the identifiers 'a', 'b', 'c' ... 'z'. Assignment to a variable is made as follows:
5 5 + = x
Here, the value '10' is assigned to the varible 'x'. This variable can now be used in further expressions.
All variables are initialised to zero upon the program starting, and can be cleared with theclear command.

User Interace


  • Insert - Toggle Insert/Overwrite mode
  • Enter - End input
  • Esc - Terminate input, returns NUL string
  • Ctrl+J - As Enter but does not store in line history
  • Ctrl+S - Toggle case of current character
  • Ctrl+T - Transpose adjacent characters
  • Ctrl+G - Sound system bell


  • Left - Move left one character
  • Right - Move right one character
  • Ctrl+Left - Move left one word
  • Ctrl+Right - Move right one word
  • Home - Move to start
  • End - Move to end


  • Ctrl+C - Copy line to clipboard
  • Ctrl+X - Cut line to clipboard
  • Ctrl+V - Paste text from clipboard


  • BkSp - Delete left one character
  • Del - Delete right one character
  • Ctrl+U - Clear input buffer
  • Ctrl+Home - Delete to start
  • Ctrl+End - Delete to end


  • Up - Previous input
  • Down - Next input
  • Ctrl+Up - Select first input in buffer
  • Ctrl+Down - Select last input
  • Shift+Up - Skip back 16 inputs
  • Shift+Down - Skip forward 16 inputs

Error messages

The RPN Calculator no longer returns error messages. Failed queries are sent to your search engine of choice instead.

DOWNLOAD version 1.08 Reverse Polish Notation Calculator for Windows (including source code and executable)