Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 413009
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T18:08:30+00:00 2026-05-12T18:08:30+00:00

I am currently reading Charles Petzold’s book ‘Code’. In it he explains how to

  • 0

I am currently reading Charles Petzold’s book ‘Code’. In it he explains how to convert a decimal number into binary using the following template:

                [ ]   [ ]   [ ]   [ ]   [ ]   [ ]   [ ]   [ ]
                ÷128  ÷64   ÷32   ÷16   ÷8    ÷4    ÷2    ÷1
                [ ]   [ ]   [ ]   [ ]   [ ]   [ ]   [ ]   [ ]

In the book, his explanation on how to use the template reads:

“Put the entire decimal number (less than or equal to 255) in the box in the upper
left corner. Divide that number (the dividend) by the first divisor (128), as
indicated. Put the quotient in the box below (the box at the lower left corner), and
the remainder in the box to the right (the second box on the top row). That first remainder is the dividend for the next calculation, which uses a divisor of 64. Continue in the same manner through the template.

Keep in mind that each quotient will be either 0 or 1. If the dividend is less than the divisor the quotient is 0 and the remainder is simply the dividend. if the dividend is greater than or equal to the divisor, the quotient is 1 and the remainder is the divider – the divisor. Here’s how it’s done with 150:”

                [150]  [22]   [22]   [22]   [6 ]   [6 ]   [2 ]   [0 ]
                ÷128   ÷64    ÷32    ÷16    ÷8     ÷4     ÷2     ÷1
                [1 ]   [0 ]   [0 ]   [1 ]   [0 ]   [1 ]   [1 ]   [0 ]

But I’m puzzled! When I do the calculations as instructed, I’m getting very different results. What I’m doing is as follows:

150 ÷ 128 = 1.171875 (I don’t see where the 22 comes from above?) So, I place a 1 in the box below the 150 and then carry the 171875 and use that as the dividend for the next calculation, which of course gets me into all sorts of problems, and ultimately, not the binary number 10010110!

Can somebody tell me where I’m going wrong?

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T18:08:30+00:00Added an answer on May 12, 2026 at 6:08 pm

    22 is the remainder of 150/128.

    Since you’ve determined that there’s 1 128 “in” 150, and given a value to that bit, you can forget about the 128 that’s “in” 150, so you take it away from 150, leaving our 22. Then it’s time for the digit worth 64: 64 doesn’t go into 22, so that digit is a 0. And similarly for the digit worth 32. Then for the digit worth 16: 16 goes into 22 once, so there’s a 1 digit there, and now you’re done with the 16 “in” 22, so take it away — leaving 6. And so on.

    (Consider a similar base 10 case, let’s say 309. Take the 100s column; there are 3 100s in 309, so you put a 3 there. And now there’s 9 left over. Then take the 10s column; there are 0 10s in 9, so you put a 0 there. And then the 1s column: there are 9 1s in 9, so you put a 9 in there. And now there’s nothing left — you’re done.)

    I have a horrible feeling this might confuse more than clarify, but that’s how I think of it anyway.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Currently reading quite a heavy WCF book. I have used it myself in production
Im currently reading Code Complete by Steve McConnell, specifically page 295 on floating-point numbers.
I am currently reading the book called "Programming ActionScript 3.0" available from Adobe. After
I'm Currently reading two excellent books Working Effectively with Legacy Code and Clean Code.
I am currently reading some C++ source code, and I came across this: double
I'm currently reading Aaron Hillegass' book Cocoa Programming for Mac OS X as it
I am currently reading Beginning CakePHP:From Novice to Professional by David Golding. At one
I'm currently reading, Design Patterns:Elements of Reusable Object-Oriented Software by Erich Gamma and others.
I'm currently evaluating CodeRush and one thing that I liked most when reading the
I'm currently reading in a list of tables in a SQL database and populating

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.