Divide by zero does not throw exception for longs

Aneesh Aggarwal aneesha@granite.hpl.hp.com
Mon Jun 11 13:43:00 GMT 2001


This is the 3.1 version. When compiled with gcj, divide by zero does not
exception for longs. For ints, however, it throws the exception. The
program I tested it on is :
public class div_test {
 public static void main(String [] args) {
 long a = 10, b = 0;
 try {
 a = a/b;
 }
 catch (java.lang.Exception e) {
 System.out.println("Div by zero working");
 }
 }
 }
I have filed a bug-report, the identification is java/3097. I thought I'll
mention it here so that it gets some attention and if the bug is present
in the 3.0 release, it might be fixed.
-Aneesh


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /