MathU for iPhoneCreative Creek, LLC

MathU™ RPN 2.2 for iPhone
Documentation

Number Base Functions

MathU RPN can display and compute with numbers in hexadecimal (base 16), octal (base 8), and binary (base 2) format as well as the default decimal (base 10) format. Non-decimal values are displayed with a subscript following them indicating the number base and subscripts that indicate the bit position. The number base functions honor the wordsize set in the preference screen. You can also choose to display the numbers with leading zeros via the preferences screen.

hexadecimal display
octal display
binary display

When one of the non-decimal bases is chosen, the keypad changes to reveal the number base functions and the A-F hex digits.

Number base functions revealed when in hex, oct or bin mode.

The functions HEX, OCT, BIN, and DEC convert values between bases and set the number base for further calculations and input.

Key Function Description
HEX hex Convert x register to hexadecimal number base.
OCT oct Convert x register to octal number base.
BIN bin Convert x register to binary number base.
DEC dec Convert x register to decimal number base.
AND and Bitwise AND of x and y
OR or Bitwise OR of x and y
XOR xor Bitwise exclusive OR of x and y
NOT not Bitwise NOT of x (all bits inverted)
#BITS #bits Number of bits in x as an integer
SHL shl Logical shift y left by x bits
SHR shr Logical shift y right by x bits
ASR asr Arithmetic shift y right by x bits. The leftmost bit in the word is replicated during the shift.
MASKL maskl Left justified bit mask with x bits
MASKR maskl Right justified bit mask with x bits

Values outside the wordsize preference are wrapped (that is, the excess most significant bits are dropped) and are converted to an integer. The display will automatically switch to a smaller font when large numbers are viewed in oct or bin format. Large binary numbers may wrap on the display as well.

Modular Functions

A few functions behave differently when a non-decimal number base is chosen:

Key Function Description
CHS chs Two's complement. Replace x register with its two's complement (all bits inverted and 1 added)
+ + Modular addition. Same as regular addition except that results that exceed the wordsize are wrapped.
- Modular subtraction. Same as regular subtraction except that negative results are returned as two's complement numbers.
Χ * Modular multiplication. Same as regular multiplication except that results that exceed the wordsize are wrapped.
÷ / Modular division. Same as regular division except that results that exceed the wordsize are wrapped and any fractional remainder is discarded.
RAND rand Uniformly distributed random integer chosen within the range implied by the wordsize. When in decimal mode, the RAND function produces a random number between 0.0 and 1.0.

The other functions on the calculator can be applied to the non-decimal numbers. The result will be displayed as an integer even though the value may contain a fractional part. However, if the result has more than 48 bits, the number will be displayed in decimal. Simply reapply the conversion routine to wrap and truncate the value to the wordsize.