Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8338116

Math.pow(anything,0) is returning 1.0 which it shouldn't

XMLWordPrintable

    • generic
    • generic

      A DESCRIPTION OF THE PROBLEM :
      The pow method of the Math class in java.lang doesn't work properly when the second argument is 0. For example,
      double infinity = 1/0.0, nan = 1%0.0;
      Now,
      Math.pow(0,0)
      Math.pow(nan, 0)
      Math.pow(infinity, 0)
      Math.pow(0/0.0, 0)
      All of these and many more are returning 1.0 as output. However, all these expressions are interdeterminate and undefined, so technically the outputs should be NaN in all these cases. This is the bug that Math.pow(anything, 0) is returning 1.0 regardless of the fact that it might be undefined. Please fix this bug as soon as possible



      FREQUENCY : always


            darcy Joe Darcy
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: