Skip to content

Commit 22a496d

Browse files
yanghaognsrowen
authored andcommitted
[SPARK-16214][EXAMPLES] fix the denominator of SparkPi
## What changes were proposed in this pull request? reduce the denominator of SparkPi by 1 ## How was this patch tested? integration tests Author: 杨浩 <[email protected]> Closes #13910 from yanghaogn/patch-1. (cherry picked from commit b452026) Signed-off-by: Sean Owen <[email protected]>
1 parent 60e095b commit 22a496d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

examples/src/main/scala/org/apache/spark/examples/SparkPi.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ object SparkPi {
3434
val y = random * 2 - 1
3535
if (x*x + y*y < 1) 1 else 0
3636
}.reduce(_ + _)
37-
println("Pi is roughly " + 4.0 * count / n)
37+
println("Pi is roughly " + 4.0 * count / (n - 1))
3838
spark.stop()
3939
}
4040
}

0 commit comments

Comments
 (0)