title: DecimalFormat not ceiling properly
body: <p>We are currently running some tests which involve ceiling numbers that have two decimal places. In order to achieve this, we are using Java's <a href="http://docs.oracle.com/javase/7/docs/api/java/text/DecimalFormat.html" rel="nofollow">DecimalFormat</a>. </p>
  
  <p>However, the tests are getting strange results, particularly for the case when we wish to ceil up a <strong>'0.00xxx'</strong> number.   </p>
  
  <p>The following is the instance of the DecimalFormatter that is being used by the tests:</p>
  
  <pre><code>DecimalFormat decimalFormatter = new DecimalFormat("#########0.00");
      decimalFormatter.setRoundingMode(RoundingMode.CEILING);
  </code></pre>
  
  <p>This test works as expected, that is, it was ceiled correctly: </p>
  
  <pre><code>//The below asserts as expected
      @Test
      public void testDecimalFormatterRoundingDownOneDecimalPlace3()
      {
          String formatted = decimalFormatter.format(234.6000000000001);
          Assert.assertEquals("Unexpected formatted number", "234.61", formatted);
      }
  </code></pre>
  
  <p>However, this does not:</p>
  
  <pre><code>//junit.framework.ComparisonFailure: Unexpected formatted number 
  //Expected :0.01
  //Actual   :0.00
  
      @Test
      public void testSmallNumber()
      {
          double amount = 0.0000001;
  
          String formatted = decimalFormatter.format(amount);
          Assert.assertEquals("Unexpected formatted number", "0.01", formatted);
      }
  </code></pre>
  
  <p><strong>Can you please explain why we are getting this behaviour</strong>. Thanks</p>
  
  <p>EDIT:Another test as requested by comment. Still does not work.</p>
  
  <pre><code>//junit.framework.ComparisonFailure: null
  //Expected :0.01
  //Actual :0.00
  
  @Test
  public void testStackOverflow() throws Exception
  {
  double amount = 0.0000006;
  String formatted = decimalFormatter.format(amount);
  Assert.assertEquals("Unexpected formatted number", "0.01", formatted);
  }
  </code></pre>
  
  <p>I noticed that for it to work, a number greater than 0 must be within the range of the pattern. Is this a bug or am I missing something?</p>