Number Conversion
Hindu-Arabic numerals are written in the form anan-1 ... a1a0 denoting, in number base r , the integer:
an · rn + an-1 · rn-1 + ... + a1 · r1 + a0
Factoring this expression yields:
((...(( 0 · r + an ) · r + an-1 ) · r + ... ) · r + a1) · r + a0
This suggests an algorithm for converting a number expressed by digits dndn-1 ... d1d0 to internal form in a left-to-right scan: