incorporated feedback on the java tutorial

This commit is contained in:
Jonas Bonér 2011-04-20 09:24:19 +02:00
parent 90d6844b4a
commit 5e86f2ee81
4 changed files with 40 additions and 42 deletions

View file

@ -59,7 +59,7 @@ object Pi extends App {
def calculatePiFor(start: Int, nrOfElements: Int): Double = {
var acc = 0.0
for (i <- start until (start + nrOfElements))
acc += 4 * math.pow(-1, i) / (2 * i + 1)
acc += 4 * (1 - (i % 2) * 2) / (2 * i + 1)
acc
}