Skip to content

Commit efce6e1

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 e017763 commit efce6e1

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
@@ -36,7 +36,7 @@ object SparkPi {
3636
val y = random * 2 - 1
3737
if (x*x + y*y < 1) 1 else 0
3838
}.reduce(_ + _)
39-
println("Pi is roughly " + 4.0 * count / n)
39+
println("Pi is roughly " + 4.0 * count / (n - 1))
4040
spark.stop()
4141
}
4242
}

0 commit comments

Comments
 (0)