A Wilkinson RPN Calculator
This page displays an applet which acts as a Reverse Polish Notation
calculator, similar to an HP-48.
The calculator uses an engine which supports the Wilkinson model of
floating point arithmetic.
The engine supports arbitrary bases between b = 2 and b = 2^15 (32,768).
It supports an arbitrary number of base b digits which, for all
practical purposes, is only limited by the available memory.
Technically, the largest number of digits is 2,147,483,647.
The engine supports exponents ranges from -2,147,483,647 <= emin to
emax <= 2,147,483,647.
For display purposes this calculator applet provides only a restricted set
of bases and precision.
Nonetheless, this should provide a good tool for experimenting with floating
point arithmetic.
Some Exercises
- One property of the machine epsilon is that if it is added to 1, then the
result will be larger than 1. It is the smallest number for which we can guarantee
this result for "loose" rounding. The calculator implements correct rounding.
Can you find a number smaller than the machine epsilon which when added to 1
yields a results which is larger than 1?
- If you can find a number, a, which is smaller than the machine epsilon and
for which (1+a) > 1, what do you get when you subtract 1? That is what is ((1+a)-1)?
- Calculate (((3/10) - (1/10)) - (1/10)) - (1/10) in each of the available
bases. What do you observe?
- Does the calculator provide reasonable results for underflow and overflow?
- Find an example which does not overflow or underflow but still illustrates the failure
of the associative law for addition.
- Find an example which does not overflow or underflow but still illustrates the failure
of the distributive law for addition.
- Find an example which does not overflow or underflow but still illustrates the failure
of the associative law for multiplication.
- Find an example which does not overflow or underflow but still illustrates the failure
of the distributive law for multiplication.
- Find an example where (a/b) is not equal to a*(1/b).
Please explore other aspects of the calculator and report any anomalies to the author,
Dan Warner
The calculator buttons are a CalculatorButton class designed by
Sven.VanCaekenberghe.
Source for the CalculatorButton class.