View Poll Results: do you use goto in c/c++/c#/etc programming?

Voters
15. You may not vote on this poll
  • Everything should flow. No goto.

    9 60.00%
  • I like the flexibility. Yes, goto.

    3 20.00%
  • I'm still wondering what this has to do with logic gates.

    3 20.00%

Thread: addition

  1. #1
    Just because ygfperson's Avatar
    Join Date
    Jan 2002
    Posts
    2,490

    Talking addition

    i read somewhere that computers add using some combination of logic gates, and that the only way multiplication could be done is through addition. is this true, and if so, how?
    ty in advance

  2. #2
    Registered User
    Join Date
    Aug 2001
    Posts
    202
    think of multiplication like this:

    9 multiplied by 8 means 9 eight times over,
    so 9 * 8 == 9+9+9+9+9+9+9+9.

    starX
    www.axisoftime.com

  3. #3
    The Artful Lurker Deckard's Avatar
    Join Date
    Jan 2002
    Posts
    633
    I believe you're thinking of boolean logic gates. You may be interested in the explination provided here.
    Jason Deckard

  4. #4
    Just because ygfperson's Avatar
    Join Date
    Jan 2002
    Posts
    2,490
    about multiplication: what if the number were big? back when i had a tandy 1000ex(8.077 mhz, 1984 i think) basic could do a for i=1 to 5000, next loop in one second. is there some sort of help the processor gets?

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660

  6. #6
    Hamster without a wheel iain's Avatar
    Join Date
    Aug 2001
    Posts
    1,385
    the multiplication cannot actually be done by a computer due to the logic systems it uses, so the multipolication is carried out by bit-shifting and addition
    Monday - what a way to spend a seventh of your life

  7. #7
    Registered User
    Join Date
    Sep 2001
    Posts
    752
    Well, multiplication and loops are different beasts.

    For multiplication: Technically, you could just have a multiplication table in your CPU, but the way I learned it, it's a combination of shifts, additions, and perhaps subtractions.

    For loops: You can think of increment or decrement operators as even more basic than addition and subtraction. Loops are very important, so much that loop commands are commonly a part of a processor's architecture.
    Callou collei we'll code the way
    Of prime numbers and pings!

  8. #8
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    or you may be interested in wasting your time clicking the link provided here

  9. #9
    The Artful Lurker Deckard's Avatar
    Join Date
    Jan 2002
    Posts
    633
    Originally posted by Sean
    or you may be interested in wasting your time clicking the link provided here
    That is a stroke of pure genius which should be prominently displayed at the beginning of the FAQ. :)
    Jason Deckard

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. reliably checking for overflow before addition?
    By cyberfish in forum C++ Programming
    Replies: 18
    Last Post: 06-23-2008, 03:35 AM
  2. Replies: 7
    Last Post: 06-01-2008, 07:47 AM
  3. Repeated Addition
    By rocksteady in forum C Programming
    Replies: 15
    Last Post: 12-11-2007, 07:05 AM
  4. need some help with binary addition.
    By InvariantLoop in forum C++ Programming
    Replies: 21
    Last Post: 01-27-2005, 06:52 AM
  5. Problems with an addition operator
    By jamjar in forum C++ Programming
    Replies: 12
    Last Post: 03-28-2003, 01:47 PM