Thread: Question About Binary Division

  1. #1
    Registered User
    Join Date
    Oct 2008
    Posts
    22

    Question Question About Binary Division

    How would I divide these two binary numbers?

    100101/011011

    This is assuming I am on a 6bit 2's complement machine. I would understand how to do it if the first number were not negative. How do I approach this?

    Thank you!

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Why not negate the first number and then make the answer negative at the end?

    Edit: Although I did verify that the usual "subtract until you get 0" method works here as well; you subtract 011011 from 100101 a total of 111111 times to get to 0, for a quotient of 111111 = -1 which you would expect from -27/27.
    Last edited by tabstop; 02-13-2009 at 03:08 PM.

  3. #3
    Registered User
    Join Date
    Oct 2008
    Posts
    22
    Why not negate the first number and then make the answer negative at the end?
    Is this how the computer would operate on this problem?

  4. #4
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. insert into binary tree question..
    By transgalactic2 in forum C Programming
    Replies: 32
    Last Post: 11-18-2008, 03:21 PM
  2. Question: Binary Tree only with parent pointer
    By outlaw525 in forum C Programming
    Replies: 11
    Last Post: 06-24-2008, 05:07 PM
  3. Binary division of large numbers
    By hooper in forum C Programming
    Replies: 5
    Last Post: 06-01-2007, 02:33 AM
  4. Binary Search Tree - one last question
    By tms43 in forum C++ Programming
    Replies: 2
    Last Post: 11-14-2006, 03:58 AM
  5. Binary Tree Question
    By tar in forum C Programming
    Replies: 6
    Last Post: 09-26-2002, 01:22 AM