Perhaps this is the wrong sort of question to ask here but I am curious. I know that many languages will simply explode and fail when asked to divide by 0, but are there any programming languages that can intelligently handle this impossible sum - and if so, what do they do? Do they keep processing, treating 350/0 as 350, or stop execution, or what?
相关问题
- Can I ignore a SIGFPE resulting from division by z
- Avoid division by zero between matrices in MATLAB
- Assembly Language: cbw
- Why is 0 mod 0 an error?
- Division in Mysql query
相关文章
- Divide by zero error, how do I fix this?
- Numpy Array Division - unsupported operand type(s)
- How to prevent division by zero?
- How does division work in MIX?
- Division in a SQL statement.
- Recursive subdivision on octahedron in OpenGL
- How to translate kernel's trap divide error rs
- Visual C++ / Weird behavior after enabling floatin
The INTERCAL standard library returns
#0
on divide by zeroMost SQL implementations raise a "division by zero" error, but MySQL just returns NULL
The little-known Java programming language gives the special constant
Double.POSITIVE_INFINITY
orDouble.NEGATIVE_INFINITY
(depending on the numerator) when you divide by zero in an IEEE floating-point context. Integer division by zero is undefined, and results in anArithmeticException
being thrown, which is quite different from your scenario of "explosion and failure".i'd be surprised if any language returns 350 if you do 350/0. Just two examples, but Java throws an Exception that can be caught. C/C++ just crashes (i think it throws a Signal that can probably be caught).