Using BigDecimal to print Pi
问题 I'm tring to use BigDecimal to print Pi, but it turns out it's not accurate BigDecimal d = new BigDecimal(Math.PI); System.out.println(d); The above answer gives me "3.141592653589793115997963468544185161590576171875" but the digits after "3.141592653589793" is incorrect how this is happenning ? and can i use bigdecimal to print PI ? 回答1: From Javadoc for Math.PI: PI public static final double PI The double value that is closer than any other to pi, the ratio of the circumference of a circle