diff options
author | 杨浩 <yanghaogn@163.com> | 2016-06-27 08:31:52 +0100 |
---|---|---|
committer | Sean Owen <sowen@cloudera.com> | 2016-06-27 08:31:52 +0100 |
commit | b452026324da20f76f7d8b78e5ba1c007712e585 (patch) | |
tree | 3b71fa9bf54f3d8e1e8afa86addd8153e3d58a96 | |
parent | 30b182bcc088aef161585211c517f473b9ee6632 (diff) | |
download | spark-b452026324da20f76f7d8b78e5ba1c007712e585.tar.gz spark-b452026324da20f76f7d8b78e5ba1c007712e585.tar.bz2 spark-b452026324da20f76f7d8b78e5ba1c007712e585.zip |
[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: 杨浩 <yanghaogn@163.com>
Closes #13910 from yanghaogn/patch-1.
-rw-r--r-- | examples/src/main/scala/org/apache/spark/examples/SparkPi.scala | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/examples/src/main/scala/org/apache/spark/examples/SparkPi.scala b/examples/src/main/scala/org/apache/spark/examples/SparkPi.scala index 42f6cef4e1..272c1a4fc2 100644 --- a/examples/src/main/scala/org/apache/spark/examples/SparkPi.scala +++ b/examples/src/main/scala/org/apache/spark/examples/SparkPi.scala @@ -36,7 +36,7 @@ object SparkPi { val y = random * 2 - 1 if (x*x + y*y < 1) 1 else 0 }.reduce(_ + _) - println("Pi is roughly " + 4.0 * count / n) + println("Pi is roughly " + 4.0 * count / (n - 1)) spark.stop() } } |