Dale - Computer Science Illuminated 69

Dale - Computer Science Illuminated 69 - answer should be...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Converting from Base 10 to Other Bases The rules for converting base-10 numbers involve dividing by the base into which you are converting the number. From this division, you get a quotient and a remainder. The remainder becomes the next digit in the new number (from right to left), and the quotient replaces the number to be converted. The process continues until the quotient is zero. Let’s write the rules in a different form. These rules form an algorithm for converting from base 10 to another base. An algorithm is a logical sequence of steps that solves a problem. We have much more to say about algorithms in later chapters. Here we show one way of describing an algorithm and show how we can apply it to perform the conversions. The first line of the algorithm tells us to repeat the next three lines until the quotient from our division becomes zero. Let’s convert the decimal number 2748 to hexadecimal. As we’ve seen in previous examples, the
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: answer should be ABC. While the quotient is not zero Divide the decimal number by the new base Make the remainder the next digit to the left in the answer Replace the decimal number with the quotient Invented in 1617 by Scotsman John Napier, Napiers Bones was a set of rectangular bones (tiles) marked off with numbers at the top of the face and multiples of that number down the face of the tile. Each tile (bone) represented the multiplication table for a single digit. These bones could be lined up beside one another in a way that allowed the user to do one-digit multiplication using only addi-tion. John Napier also invented the slide rule and is given credit for discovering the binary number system. For more on Napier and how to use his bones, see our Web site. Napiers Bones, An Early Calculation Aid Reproduced by permission of University of Calgary W 42...
View Full Document

Ask a homework question - tutors are online