Skip to content
Snippets Groups Projects
Commit b4520263 authored by 杨浩's avatar 杨浩 Committed by Sean Owen
Browse files

[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.
parent 30b182bc
No related branches found
No related tags found
No related merge requests found
...@@ -36,7 +36,7 @@ object SparkPi { ...@@ -36,7 +36,7 @@ object SparkPi {
val y = random * 2 - 1 val y = random * 2 - 1
if (x*x + y*y < 1) 1 else 0 if (x*x + y*y < 1) 1 else 0
}.reduce(_ + _) }.reduce(_ + _)
println("Pi is roughly " + 4.0 * count / n) println("Pi is roughly " + 4.0 * count / (n - 1))
spark.stop() spark.stop()
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment