Calculator Example 

The following specifications have been derived from the instructions printed on the back of the calculator. (Image from http://www.hpmuseum.org/hp35.htm.)
Low battery lights all decimal points.
Improper operations flash display. Press clx.
clx clears the display.
clr clears all registers.
chs changes sign of display. May be used as the first entry when entering negative numbers.
eex causes next entries to become the exponent of x. For negative expoinents chs must precede digits. The operational stack consistes of four registers (x, y, z and t). A fifth register (s) is used for constant storage. The stack is automatically raised by an entry into x or by rcl unless the entry or rcl immediately follows clx, sto or enter. Follwing any trig function z is duplicated into register t. All angles are in degrees. Example (2+3) * (4/5) / sin(30) * (4^1.5) = 1.0000
You can run this document as it stands right now against a calculator implemented at c2.com. You will find that that the tests, the fixture and the calculator code are all not yet complete. Failing tests turn a cell red. There are two values in the cell. The top one is the expected result. The bottom is the actual result.


Last edited September 12, 2002 Return to WelcomeVisitors 