|
Horner's Algorithm
To convert number of a given base to base 10
Usually we
convert a number from a given base to base 10 by multiplying every digit
in the given number with the corresponding power of its base and then
adding all these products:
For ex: To Convert 1011(2) to base 10, we do it as
1x23 + 0x22 + 1x21 + 1x20 =
8+0+2+1 = 11
As you can see
here, using higher powers becomes difficult once the number of digits gets
bigger and also as the base is larger (For ex: base 16)
A more simple
approach for this would be Horner's Algorithm.
Horner's
Algorithm is used to convert a number from a given base system to base 10
System.
The Steps involved in this conversion process are as follows.
-
Take The
First Digit of the given number
-
Multiply it
with it's base and add the next digit in the number to this product
-
Repeat the
above step till all the digits are done and you have the base 10 value
of the number
For instance:
Consider 1011(2). Now to convert this to base 10 using the
above method.
-
Take 1 i.e.
the first digit in the given number.
-
Multiply it
by 2 i.e. the given base. So we have 1x2=2.
-
Add the next
digit i.e. 0 to this product. So we have 2+0=2.
Repeat the steps
2 and 3 as follows:
2x2=4 Then 4+1=5
5x2=10 Then 10+1=11
11 is the base 10
value of 1011(2).
This procedure of
conversion could be simplified if you write it down as follows.
| 1 |
0 |
1 |
1 |
Number |
| 1 |
2 |
5 |
11 |
Conversion |
When I find any free time I shall explain
why this algorithm works.
Sorry guys, was a bit late. Finally
found some free time today after over 20 months. So here is Why
Horner's Algorithm Works? Thank you all those who kept sending me
mails reminding about this unfinished work.
-by Gurudev
MADE IN
INDIA
gurudevp@vsnl.net
On 13 December 2002
Home
>> Mathematics >> Arithmetic
|