From b452026324da20f76f7d8b78e5ba1c007712e585 Mon Sep 17 00:00:00 2001 From: 杨浩 Date: Mon, 27 Jun 2016 08:31:52 +0100 Subject: [SPARK-16214][EXAMPLES] fix the denominator of SparkPi MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## What changes were proposed in this pull request? reduce the denominator of SparkPi by 1 ## How was this patch tested? integration tests Author: 杨浩 Closes #13910 from yanghaogn/patch-1. --- examples/src/main/scala/org/apache/spark/examples/SparkPi.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples') 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() } } -- cgit v1.2.3