Thread: severe beating of divide by zero

  1. #1
    Registered User
    Join Date
    Apr 2002
    Posts
    129

    severe beating of divide by zero

    SO like, whenever a divide by zero is encountered it is caught by the cpu and the program dies, right???

    what would happen if I hooked that interrupt so that no stupid kill-my-program routine would happen? What would the result of the divide be?
    flashdaddee.com rocks!!!

  2. #2
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    Well your question isn't very clear. First of all, the result would be infinity, or UNDEFINED, so there's no way to tell the interrupt to do this, unless you do a bit of processing yourself. Check to see if the denominator is 0, if it is, just send back however you want to write infinity, and don't call the interrupt. If it isn't 0, no problem.

  3. #3
    anything divided by 0 is not infinity, you can either call it undefined or no result, per math laws, deviding by 0 is impossible

  4. #4
    PC Fixer-Upper Waldo2k2's Avatar
    Join Date
    May 2002
    Posts
    2,001
    I wonder how computer gurus back in the day first discovered that dividing by 0 was a no-no?
    (flashback to tech guys running around with fire hoses trying to cool down their processors which are caught in infinite loops of death)

  5. #5
    His posts are far and few Esparno's Avatar
    Join Date
    Mar 2002
    Posts
    100
    Couldnt they have just used 'Ctrl + Alt + Pull power cord' :?
    Signature is optional, I didnt opt for one.

  6. #6
    Registered User moi's Avatar
    Join Date
    Jul 2002
    Posts
    946
    Originally posted by Waldo2k2
    I wonder how computer gurus back in the day first discovered that dividing by 0 was a no-no?
    (flashback to tech guys running around with fire hoses trying to cool down their processors which are caught in infinite loops of death)
    ummmmm, they knew that dividing by zero was no good when they took 5th grade math.
    hello, internet!

  7. #7
    PC Fixer-Upper Waldo2k2's Avatar
    Join Date
    May 2002
    Posts
    2,001
    >>5th grade math

    hmmm...then why the hell do so many programs out there divide by 0? is it that those programmers didn't take 5th grade math? No, it's because they didn't realize it was going to happen. I bet if you were one of those original programmers you wouldn't have thought about it either. I'm sick of people flaming other people on these boards, especially when it was just meant to be a joke in the first place, i mean come on, can't you just picture guys running around a room with fire extinguishers trying to put out these huge spinning tape drives? damn.
    PHP and XML
    Let's talk about SAX

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. divide by zero
    By George2 in forum C# Programming
    Replies: 17
    Last Post: 05-02-2008, 02:37 AM
  2. Divide 64bit number
    By freeindy in forum C Programming
    Replies: 4
    Last Post: 10-01-2007, 03:56 AM
  3. How to multiply and Divide Huge int numbers
    By Dewayne in forum C++ Programming
    Replies: 3
    Last Post: 10-21-2004, 08:41 PM
  4. Beating stick of annoying people
    By jverkoey in forum A Brief History of Cprogramming.com
    Replies: 17
    Last Post: 05-27-2004, 04:00 PM
  5. Divide and Conquer: array in the reverse order
    By Steamer in forum C Programming
    Replies: 11
    Last Post: 03-08-2004, 07:31 PM