title: Calculating PI with sig figure precision without rounding
body: <p>I have to calculate Pi using leibinz series</p>
  
  <p>pi/4 = 1 - 1/3 + 1/5 - 1/7 ...</p>
  
  <p>I need the number of iterations it takes to get to six significant digit accuracy, originally java has 15 digits beyond the decimal place but I only need 5(3.14159)in precision and I cannot round, How would I check sig figure precision without rounding tho and without using the Math,round function if java is gonna give me 9 digits beyond the decimal place?</p>
  
  <pre><code>public class Main {
  
      public static void main(String[] args) {
  
          double series = 0;
          double denominator = 1;
          double numerator = 1;
          double testingPi;
          double formattedTestingPi = 0;
          double formattedMathPi = Math.round(Math.PI * 100000.0) / 100000.0;
          int max = 1200000;
          int iterations = 0;
          double formattedPreviousPi = 0;
          double formattedDelta = 0;
  
          for(int i = 1; i &lt; max;i++)
          {
  
              iterations = i;
  
              if((i % 2) != 0)
              {
                  series = series + (numerator/denominator);
              }
              else if((i % 2) == 0)
              {
                  series = series + ((numerator/denominator) * -1);
              }
  
              testingPi = series * 4;
  
              formattedTestingPi = (Math.round(testingPi * 100000.0))/100000.0;
  
              formattedDelta = formattedTestingPi - formattedPreviousPi;
  
              if(Math.abs(formattedDelta) &lt;= 0.000009)
              {
                  i = max;
              }
  
              formattedPreviousPi = formattedTestingPi;
              denominator = denominator + 2;
          }
  
          System.out.println("Formatted Delta            :" + formattedDelta);
          System.out.println("Iterations                 :" + iterations);
          System.out.println("Pi Formatted Computed      :" + formattedTestingPi);
          System.out.println("Pi Formatted Math Library  :" + formattedMathPi);
      }
  }
  </code></pre>
  
  <p>The output is</p>
  
  <p>Formatted Delta            :0.0</p>
  
  <p>Iterations                 :426183</p>
  
  <p>Pi Formatted Computed      :3.14159</p>
  
  <p>Pi Formatted Math Library  :3.14159</p>
  
  <p>I do not need the solution but some help as to how could this be done without rounding.</p>