Slashdot Mirror


Ask Slashdot: What's the Harm In a Default Setting For Div By Zero?

New submitter CodeInspired writes: After 20 years of programming, I've decided I'm tired of checking for div by zero. Would there be any serious harm in allowing a system wide setting that said div by zero simply equals zero? Maybe it exists already, not sure. But I run into it all the time in every language I've worked with. Does anyone want their div by zero errors to result in anything other than zero?

14 of 1,067 comments (clear)

  1. I'm tired, too by linuxwrangler · · Score: 5, Funny

    Hi SlashDot. I'm a programmer who is tired of sanitizing inputs and checking for exceptions. Can you suggest a way to change the world so those things don't exist?

    --

    ~~~~~~~
    "You are not remembered for doing what is expected of you." - Atul Chitnis
    1. Re:I'm tired, too by 31415926535897 · · Score: 5, Funny

      Code in PHP

  2. Re:Bugs? by aardvarkjoe · · Score: 4, Funny

    Didn't you hear? Slashdot is trying this cutting-edge "Agile Development" thing. The idea is that instead of testing your changes, you just make them directly on your production site and see what happens. It's the wave of the future!

    --

    How can we continue to believe in a just universe and freedom to eat crackers if we have no ale?
  3. Re:Fuck your web monkeys by Anonymous Coward · · Score: 2, Funny

    Good thing you're pushing untested code into production, Dice!

    Well, you see, they had this divide by zero error ...

  4. Maybe by Anonymous Coward · · Score: 5, Funny

    Does anyone want their div by zero errors to result in anything other than zero?

    Yes.

    No.

    Maybe.

    1. Re:Maybe by Anonymous Coward · · Score: 3, Funny

      Does anyone want their div by zero errors to result in anything other than zero?

      Yes.

      No.

      Maybe.

      Maybe not.

    2. Re:Maybe by Anonymous Coward · · Score: 5, Funny

      Does anyone want their div by zero errors to result in anything other than zero?

      Yes.

      No.

      Maybe.

      Maybe not.

      Wrong!

      Pineapple.

  5. I don't think you understand the definition by Thud457 · · Score: 5, Funny
    Division by zero - how many times does zero go into a number?

    100.0 / 0 = 3
    402350.32302 / 0 = 3
    pi / 0 = infinity
    1942 / 0 = 0
    194.3 / 0 = 0
    101 / 0 = 1
    1010 / 0 = 2
    200.02 / 0 = 3
    4004004 / 0 = 4

    Somebody please submit a RFP for this to C++17 standards committee.

    --

    the preceding comment is my own and in no way reflects the opinion of the Joint Chiefs of Staff

  6. Re:Bury Head in Sand by Anonymous Coward · · Score: 2, Funny

    He could be a mySQL programmer.

  7. And 2+2 = 5 by PPH · · Score: 3, Funny

    ... for extremely large values of 2.

    While you are making changes ....

    --
    Have gnu, will travel.
  8. Dear Slashdot, math is hard by sideslash · · Score: 3, Funny

    "Can't I just be a programmer and not understand math?"

  9. Sounds like bugs by The+MAZZTer · · Score: 5, Funny

    caused by dividing by zero returning zero.

  10. Re: Infinity by Anonymous Coward · · Score: 0, Funny

    0/0 should be 1

  11. Re:Yes by AthanasiusKircher · · Score: 5, Funny

    Right, I don't even... ehh... totally confused. It's not aprils fools right? Did this article get approved just to mock the submitter, or has Slashdot gone totally of the rails?

    Well, Slashdot recently implemented a new engine for approving articles, but there was a place in the code where one could end up dividing by zero, and they just decided to arbitrarily set that value to "post a random nonsensical Ask Slashdot question."

    So, Timothy screwed something up... and, well, rather than throwing up an exception -- VOILA... this story was approved!

    I'm surprised you haven't noticed this before -- I think it's how most "Ask Slashdot" questions get posted these days.