Internally, this calculator represents a value (Val)
as its sign bit (Sgn) and the base b logarithm (Log) of its absolute
value. Each time you click on one of the digit buttons
or on the "<-" (delete) button, the input string (ValAcc referred to as X) is
reconverted to its LNS representation (SgnAcc referred to as xS and LogAcc referred to as x). Each
time you click on one of the operators, the LNS result (SgnAcc ( xS )
and LogAcc ( x )) is converted back to the equivalent floating point in ValAcc ( X=(1-xS)*b raised to x ).
The notation x and y are used in the "Steps" field that shows how the LNS algorithms work. (You may have to move the cursor in this field to see the entire algorithm.)
The
JavaScript
code for this calculator is modified from the Netscape
Postfix Calculator Example .
Restrictions: Like the example from which it was taken,
if more than two values are entered,
only the last two are kept.
Also, do not enter numbers from the keyboard. Use only the mouse with the
numeric buttons.
If you view the source (choose Page Source from the
View menu), you can see the LNS algorithms for the
operations. Multiplication and Division are trivial (adding or
subtracting the logarithms and exclusive ORing the sign bits).
Addition and Subtraction is more complicated, involving computing
the functions known as Gaussian or addition logarithms (sb
and db) using what is called Leonelli's algorithm.
Much research in this field has been devoted to
finding efficient algorithms to compute these functions.
A bibliography for much of this work can be found at
www.xlnsresearch.com .