Search code examples
javamathdoubledecimalpi

Java - 100 decimal places in variable


I have a problem when it comes to calculating pi with more than 15 decimal places(i used double).

My result looks quite good except my variable is limited to 15 decimal places:

3.140592653839794

Anybody could tell me what i have to do if i want more decimal places?

Thanks and Greeting!


Solution

  • Use java.math.BigDecimal instead of double for arbitrary (finite) precision.