title: What is the reason for the strange behavior of the double value?
body: <p>I have created a 2D array to store <strong>double</strong> values,on executing the below code the decimal range of some values are getting modified unexpectedly !</p>
  
  <pre><code>package learnJavaProj;
  public class SquareRootin2D {
  
  public static void main(String[] args) {
  
      double [][] arr = new double[10][10];
      double f= 0.00;
      double g=0.00;
  
      for(int i=0;i&lt;10;i++)
      {
          for(int j=0;j&lt;10;j++)
          {
              arr[i][j]=0.00;
          }
      }
  
      for (int i=0;i&lt;10;i++)
      {
          arr[i][0]=f;
          arr[0][i]=g;
          g=g+0.10;
          f++;
      }
      for(int i=0;i&lt;10;i++)
      {
          for(int j=0;j&lt;10;j++)
          {
              System.out.print(arr[i][j]+"     ");
          }
          System.out.println("\n");
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Output :</p>
  
  <pre><code>0.0     0.1     0.2     0.30000000000000004     0.4     0.5     0.6     0.7  0.7999999999999999     0.8999999999999999     
  
  1.0     0.0     0.0     0.0     0.0     0.0     0.0     0.0     0.0     0.0     
  
  2.0     0.0     0.0     0.0     0.0     0.0     0.0     0.0     0.0     0.0     
  
  3.0     0.0     0.0     0.0     0.0     0.0     0.0     0.0     0.0     0.0     
  
  4.0     0.0     0.0     0.0     0.0     0.0     0.0     0.0     0.0     0.0     
  
  5.0     0.0     0.0     0.0     0.0     0.0     0.0     0.0     0.0     0.0     
  
   6.0     0.0     0.0     0.0     0.0     0.0     0.0     0.0     0.0     0.0     
  
   7.0     0.0     0.0     0.0     0.0     0.0     0.0     0.0     0.0     0.0     
  
   8.0     0.0     0.0     0.0     0.0     0.0     0.0     0.0     0.0     0.0     
  
   9.0     0.0     0.0     0.0     0.0     0.0     0.0     0.0     0.0     0.0     
  </code></pre>
  
  <p>This kind of fluctuation appeared while using float too !
  Kindly explain this chaos.
  Thank You !</p>