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

  1. 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?
  2. 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)?
  3. Calculate (((3/10) - (1/10)) - (1/10)) - (1/10) in each of the available bases. What do you observe?
  4. Does the calculator provide reasonable results for underflow and overflow?
  5. Find an example which does not overflow or underflow but still illustrates the failure of the associative law for addition.
  6. Find an example which does not overflow or underflow but still illustrates the failure of the distributive law for addition.
  7. Find an example which does not overflow or underflow but still illustrates the failure of the associative law for multiplication.
  8. Find an example which does not overflow or underflow but still illustrates the failure of the distributive law for multiplication.
  9. 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.