Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
asgs112752yMuch more common because many idiots write such code and many reviewers are too lazy to review
-
It is only a common problem in code containing divisions. In code not containing divisions, division by zero doesn't happen too often.
-
Yeah floating point numbers don't work so you never divide by Ero and get a larger number
*Waits for the hate* -
Honestly, I can't even remember the last time I properly divided something full stop
-
Division by something that isn't a size is actually extremely rare, and sizes are generally assumed to never be zero as part of the API contract.
If my problem domain may include a zero in something I intend to use as a size, I usually handle it manually rather than checking whether the thing I'm sizing will be able to deal with it, because even if it does, its edge case handling almost certainly doesn't match my needs, and even if it does, it's cleaner to specify it explicitly, otherwise the next reader would have to dig up the same information I used. -
Essentially the only place I ever met a division by zero error was in inverse square laws.
-
Yeah the few times it has happened to me it was due to bad data that would've messed something up anyway. Had a padding set to (image.width/image.height)%
but turned out all images from old systems had 0 as both values. So the css would've failed anyway but now turned out as NaN%
When I was learning to program nearly 15 my years ago I was incorrectly lead to believe that dividing by zero would be a much more common problem.
joke/meme