Float and Double Division by Zero throws no Exception

XMLWordPrintable

    • Type: Bug
    • Resolution: Not an Issue
    • Priority: P4
    • None
    • Affects Version/s: 12.0.1
    • Component/s: core-libs
    • x86_64
    • linux

      A DESCRIPTION OF THE PROBLEM :
      The major Problem is, that "double" and "float" knows infinity and act in every time. So the handling does not recognize the concept in Math of a division by zero. This is not expected for developer and an expected Exception isn't thrown. -Infinity and Infinity means counts over an casting limitation of possible numbers. But a division by zero is not infinite and means an infinity stepcount of calculations.


              //hidden for the compiler
              System.out.println(Float.valueOf("100") / Float.valueOf("0") * 1);

              //Several IDE's yells , but returns infinity
              System.out.println((float) 100 / (float) 0 * 10);
              System.out.println((double) 100 / (double) 0 * 10);

              //drop an java.lang.ArithmeticException: / by zero
              System.out.println((int) 100 / (int) 0 * 10);


            Assignee:
            Pallavi Sonal (Inactive)
            Reporter:
            Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: