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

5+0.56=5.5600000000000005

XMLWordPrintable

    • generic
    • generic

      A DESCRIPTION OF THE PROBLEM :
      when calculating these two numbers 5+0.56 out put is given as 5.5600000000000005.
      It also happen when adding following numbers
      6+0.56=6.5600000000000005
      7+0.56=7.5600000000000005



      ACTUAL -
      5.5600000000000005

      ---------- BEGIN SOURCE ----------
      class Example{
      public static void main(String[] args){
      double a=5.0;
      double b=0.56;
      double c=a+b;
      System.out.println(c);
      }
      }
      ---------- END SOURCE ----------

      FREQUENCY : always


            tongwan Andrew Wang
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: