Andy Glew's comp-arch.net wiki, http://semipublic.comp-arch.net
If you are reading this elsewhere, e.g. at site waboba.info, it is an unauthorized copy, and probably a malware site.
comp-arch.net wiki on hold from October 17, 2011
Logarithmic number system (LNS)
A logarithmic number system (LNS) is typically and regularly proposed as an alternative to floating point (FP).
Instead of a number being represented as floating point sign-exponent-mantissa, in an LNS numbers are represented as sign-exponent. The exponent is typically not considered solely an integer, but is considered to be some fixed point fraction. Zero is a special case. In other words, exponent = logB(|X|).
Numerically, the big advantage of LNS is in dynamic range, and "smoothness" of its approximations to real numbers.
Computationally, the big advantage of LNS is that multiplication and division are comparable in cost to addition and subtraction.
Computationally, the big disadvantage of LNS is with respect to addition and subtraction, roots and powers.
logB(X + Y) = x + sB(Y), X, Y > 0 logB(X - Y) = x + dB(Y), X, Y > 0, X > Y x = logB(X) sB(z) = logB(1 + Bz) dB(z) = logB(1 - Bz)
sB(z) and dB(z) are known as the Gaussian logarithms.
Typically an LNS is implemented with lookup tables for sB(z) and dB(z). Much effort has been expended, in the literature, on efficient lookup tables, irregular, using PLAs, piecewise linear and other approximations, etc.
LNS are good for workloads dominated by log-friendly multiplies, divides, etc. They have been implemented in several real world special purpose computers, but are not very common in general purpose computers.
I (Glew) have several times encountered codes, running on general purpose processors such as x86, dominated by operations that would be more efficient in an LNS. I have often wished that compilers could recognize such cases, and work in an LNS, switching back to regular FP only as necessary. This would require a special compiler option to say "no need for IEEE accuracy".
Similarly or conversely, I have wished for a C++ or other type that performed operations in LNS. Thus allowing the programmer to code using regular notation, but performing the appropriate add for multiply, etc.
Lacking such support, motivated programmers must work in the logarithmic domain themselves.
LNS would be a good motivator for ISA support for Lookup Tables (LUTs), except that LNS are some of the most challenging LUT applications. Seeking to minimize the lookup table, the Gaussian log is usually implemented with highly irregular LUTs, with interpolation calculations.
See wikipedia http://en.wikipedia.org/wiki/Logarithmic_number_system
Pages that should(!) link here. (Would be better if these links were automatically created: see Link Here versus Link There)
- logarithmic number system
- logarithmic number system (LNS)