title: NumberFormat rounding issue with Java 8 only
body: <p>Can somebody explain to me why the following code:</p>
  
  <pre><code>public class Test {
      public static void main(String... args) {
          round(6.2088, 3);
          round(6.2089, 3);
      }
  
      private static void round(Double num, int numDecimal) {
          System.out.println("BigDecimal: " + new BigDecimal(num).toString());
  
          // Use Locale.ENGLISH for '.' as decimal separator
          NumberFormat nf = NumberFormat.getInstance(Locale.ENGLISH);
          nf.setGroupingUsed(false);
          nf.setMaximumFractionDigits(numDecimal);
          nf.setRoundingMode(RoundingMode.HALF_UP);
  
          if(Math.abs(num) - Math.abs(num.intValue()) != 0){
              nf.setMinimumFractionDigits(numDecimal);
          }
  
          System.out.println("Formatted: " + nf.format(num));
      }
  }
  </code></pre>
  
  <p>gives the following output?</p>
  
  <pre><code>[me@localhost trunk]$ java Test
  BigDecimal: 6.208800000000000096633812063373625278472900390625
  Formatted: 6.209
  BigDecimal: 6.208899999999999863575794734060764312744140625
  Formatted: 6.208
  </code></pre>
  
  <p>In case you don't see it: "6.2089" rounded to 3 digits gives the output "6.208" while "6.2088" gives "6.209" as output. Less is more?</p>
  
  <p>The results were good when using Java 5, 6 or 7 but this Java 8 gives me this strange output.
  Java version:</p>
  
  <pre><code>[me@localhost trunk]$ java -version
  java version "1.8.0_05"
  Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
  Java HotSpot(TM) Server VM (build 25.5-b02, mixed mode)
  </code></pre>
  
  <p>EDIT: this is Java 7's output:</p>
  
  <pre><code>[me@localhost trunk]$ java Test
  BigDecimal: 6.208800000000000096633812063373625278472900390625
  Formatted: 6.209
  BigDecimal: 6.208899999999999863575794734060764312744140625
  Formatted: 6.209
  </code></pre>
  
  <p>Java 7 version:</p>
  
  <pre><code>[me@localhost trunk]$ java -version
  java version "1.7.0_51"
  Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
  Java HotSpot(TM) Server VM (build 24.51-b03, mixed mode)
  </code></pre>