This post originated from an RSS feed registered with Ruby Buzz
by Kyle Cordes.
Original Post: Incompressible Java, PI day
Feed Title: Kyle Cordes
Feed URL: http://kylecordes.com/category/ruby/feed
Feed Description: Kyle Cordes's Software Site
Weiqi Gao reminded me that today is “PI Day”; that along wouldn’t warrant a post here, but the Java snippet for estimating the value of PI rather inefficiently, did:
[weiqi@gao] $ cat PI.java
public class PI {
public static void main(String[] args) {
double sum = 0.0d;
for (int i = 1; i < 64000; i++) {
sum += 6.0/(i*i);
}
System.out.println(Math.sqrt(sum));
}
}
[weiqi@gao] $ [...]