problem about divide-by-zero-Collection of common programming errors


  • Mathew Foscarini
    programming-languages error-handling divide-by-zero
    I’m in the middle of developing a new programming language to solve some business requirements, and this language is targeted at novice users. So there is no support for exception handling in the language, and I wouldn’t expect them to use it even

  • braindead

  • Aziz Shaikh
    java divide-by-zero
    The following compiles fine in my Eclipse:final int j = 1/0; // compiles fine!!! // throws ArithmeticException: / by zero at run-timeJava prevents many “dumb code” from even compiling in the first place (e.g. “Five” instanceof Number doesn’t compile!), so the fact this didn’t even generate as much as a warning was very surprising to me. The intrigue deepens when you consider the fact that constant expressions are allowed to be o

  • Aziz Shaikh
    signals posix divide-by-zero sigfpe
    I have a program which deliberately performs a divide by zero (and stores the result in a volatile variable) in order to halt in certain circumstances. However, I’d like to be able to disable this halting, without changing the macro that performs

  • Jim
    theoretical divide-by-zero
    To be clear, I am not looking for NaN or infinity, or asking what the answer to x/0 should be. What I’m looking for is this:Based on how division is performed in hardware (I do not know how it is done), if divisio

  • Aziz Shaikh

  • Aziz Shaikh
    c++ c implementation undefined-behavior divide-by-zero
    Regarding division by zero, the standards say:C99 6.5.5p5 – The result of the / operator is the quotient from the division of the first operand by the second; the result of the % operator is the remainder. In both operations, if the value of the second operand is zero, the behavior is undefined.C++03 5.6.4 – The binary / operator yields the quotient, and the binary % operator yields the remainde

  • Aziz Shaikh
    c++ visual-c++ compiler divide-by-zero
    According to C++ Standard (5/5) dividing by zero is undefined behavior. Now consider this code (lots of useless statements are there to prevent the compiler from optimizing code out):int main() {char buffer[1] = {};int len = strlen( buffer );if( len / 0 ) {rand();} }Visual C++ compiles the if-statement like this:sub eax,edx cdq xor ecx,ecx idiv eax,ecx test eax,eax je

  • Neil Traft

  • Aziz Shaikh
    c# divide-by-zero
    C# novice here, when the int ‘max’ below is 0 I get a divide by zero error, I can see why this

  • Aziz Shaikh
    integer division integer-division divide-by-zero
    Consider integer divisiona = bq + rwhere a, b, q, r are respectively: dividend, divisor, quotient, and remainder. Particularly when b = 0, there is no unique b that satisfies the equation for a given a, and hence it makes sense that

  • Aziz Shaikh
    math division divide-by-zero
    I have come across this problem in a calculation I do in my code, where the divisor is 0 if the divident is 0 too. In my code I return 0 for that case. I am wonde

  • Aziz Shaikh
    c++ mod divide-by-zero
    Why is X % 0 an invalid expression?I always t

  • Aziz Shaikh

  • sgar91

  • Tertium

  • Aziz Shaikh
    design user-interface reporting divide-by-zero
    What is the best way (most intuitive to users) or best practice for displaying the results of a divide by 0 error when doing reporting? Within the report, I capture this error, however, when displaying it on a human readabl

Originally posted 2013-11-10 00:13:36.