math: why do we divide the way we do?

This is a discussion on math: why do we divide the way we do? within the A Brief History of Cprogramming.com forums, part of the Community Boards category; Code: 2.8 ___ 5| 14 -10 --- 4 0 i'm a bit confused behind the logic of this "long hand" ...

  1. #1
    Set Apart -- jrahhali's Avatar
    Join Date
    Nov 2002
    Posts
    254

    math: why do we divide the way we do?

    Code:
        2.8
       ___
    5| 14
       -10
       ---
        4 0
    i'm a bit confused behind the logic of this "long hand" way to division.

    ok, so
    5 goes into 14 2 times, so you write a 2. you then subtract the amount of times 5 can go into 14 from 14, and you get 4. Up to this point, i understand it.

    why, now, do you bring down a 0, and see how many times 5 can go into 40? why does this give you your fractional part, logically?
    Clear the mines from our Shazbot!
    Get the enemy Shazbot!

  2. #2
    Mayor of Awesometown Govtcheez's Avatar
    Join Date
    Aug 2001
    Location
    MI
    Posts
    8,825
    Technically it's how many times it goes into 4.0, but it's a lot easier to look at it as 40 instead. The decimal point does actually come down, but we never show it because it's a lot easier to learn that way.

  3. #3
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,515
    A whole number is not just the integer part that you see.

    4/100 = 25

    But it's 4.00... /100.00...

    The zeroes are not made up, they are really there since there is 0 amount of tenths, hundreths, etc. That's why you bring the zero down because it is really there and it allows you to continue the division.
    Arrogance breeds bad code

  4. #4
    aoeuhtns
    Join Date
    Jul 2005
    Posts
    581
    The algorithm uses this relationship:

    For all values of k, x/y = k/y + (x-k)/y

    For example:
    Code:
    To divide 84732/7, let:
    
    84732/7 = 10000 * (8/7)     + 4732/7  (We lop off all but the last
            = 10000 * (1 + 1/7) + 4732/7   four digits.)
            = 10000 + 10000/7   + 4732/7
            = 10000 + 14732/7             (At this point, we write down '1'.)
    
    14732/7 =  1000 * (14/7)    + 732/7   (We lop off all but the last
            =  1000 * (2 + 0/7) + 732/7    three digits.)
            =  2000 + 0/7       + 732/7
            =  2000 + 732/7               (At this point, we write down '2'.)
    
      732/7 =   100 * (7/7)     + 32/7    (We lop off all but the last
            =   100 * (1 + 0/7) + 32/7     two digits.)
            =   100 + 0/7       + 32/7
            =   100 + 32/7                (At this point, we write down '1'.)
    
       32/7 =    10 * (3/7)     + 2/7     (We lop off all but the last
            =    10 * (0 + 3/7) + 2/7      one digit.)
            =     0 + 30/7      + 2/7
            =     0 + 32/7                (At this point, we write down '0'.)
    
       32/7 =     1 * (32/7)    + 0/7     (We lop off all the digits.)
            =     1 * (4 + 4/7) + 0/7
            =     4 + 4/7       + 0/7
            =     4 + 4/7                 (At this point, we write down '1'.)
    
        4/7 =   0.1 * (40/7)    + 0/7     (We 'lop off' past the decimal
            =   0.1 * (5 + 5/7) + 0/7      place.)
            =   0.5 + 0.5/7     + 0/7
            =   0.5 + 0.5/7               (We write a decimal point and a
                                           '5'.)
    
      0.5/7 =  0.01 * (50/7)    + 0/7
            =  0.01 * (7 + 1/7) + 0/7
            =  0.07 + 0.01/7    + 0/7
            =  0.07 + 0.01/7              (We write down a '7'.)
    
    
    And so on and so forth.
    Substituting expressions back up, we get the answer:
    Code:
    10000 + 2000 + 100 + 00 + 4 + 0.5 + 0.7 + 0.01/7
    = 12104.57 + 0.01/7

  5. #5
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,515
    Ok.

    Our numbers are base 10. So:

    12500 is

    1 * (10^4)+
    2 * (10^3)+
    5* (10^2)+
    0 *(10^1)+
    0 *(10^0)

    for decimals

    .01 is
    0 * (10^-1)+
    1 * (10^-2)

    I'm not sure where the other stuff from above came from, but this is why we drop zeros. If the value was not zero, you would drop that value.
    Arrogance breeds bad code

  6. #6
    Registered User white's Avatar
    Join Date
    Nov 2004
    Posts
    39
    did anyone knows that there is a similar way of finding the square root of any number?
    http://www.nist.gov/dads/HTML/squareRoot.html
    ----------------

  7. #7
    Set Apart -- jrahhali's Avatar
    Join Date
    Nov 2002
    Posts
    254
    >>Technically it's how many times it goes into 4.0, but it's a lot easier to look at it as 40 instead.

    ok. since there are 5 8's in 40, then there should 5 0.8's in 4.
    Clear the mines from our Shazbot!
    Get the enemy Shazbot!

  8. #8
    Rad gcn_zelda's Avatar
    Join Date
    Mar 2003
    Posts
    942
    Quote Originally Posted by white
    did anyone knows that there is a similar way of finding the square root of any number?
    http://www.nist.gov/dads/HTML/squareRoot.html
    I think I'll stick to local linear approximation.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Math
    By knightjp in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 04-01-2009, 05:36 PM
  2. Help with C++ Math
    By aonic in forum C++ Programming
    Replies: 4
    Last Post: 01-29-2005, 03:40 AM
  3. Basic Math Problem. Undefined Math Functions
    By gsoft in forum C Programming
    Replies: 1
    Last Post: 12-28-2004, 02:14 AM
  4. Math Header?
    By Rune Hunter in forum C++ Programming
    Replies: 26
    Last Post: 09-17-2004, 06:39 AM
  5. toughest math course
    By axon in forum A Brief History of Cprogramming.com
    Replies: 12
    Last Post: 10-28-2003, 09:06 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21