Base Conversion: Dr. Arunachalam V Associate Professor, SENSE
Base Conversion: Dr. Arunachalam V Associate Professor, SENSE
Base Conversion: Dr. Arunachalam V Associate Professor, SENSE
Dr. Arunachalam V
Associate Professor, SENSE
Base conversion
• Since computers usually work with binary numbers, and human prefer decimal
representations, input/output base conversions are needed.
• In a typical computation, there are only a few conversions, compared to the
total number of operations, so optimizing conversions is less important than
optimizing other aspects of the computation.
• However, when working with huge numbers, naive conversion algorithms may
slow down the whole computation.
• All the numbers are represented internally in base - usually a power of 2 -
and externally in base B - say a power of 10.
• When both bases are commensurable, i.e., both are powers of a common
integer, like β = 8 and B = 16, conversions of n-digit numbers can be
performed in O(n) operations.
• We assume here that and B are not commensurable.
• One might think that only one algorithm is needed, since input and output are
symmetric by exchanging bases and B.
• Unfortunately, this is not true, since computations are done only in base .
Quadratic Algorithms
MODULAR ARITHMETIC
Start reading the Chapter 2 of Richard P Brent and Paul Zimmerman, “Modern
Computer Arithmetic”, Cambridge University Press 2010.