You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hama.apache.org by ed...@apache.org on 2010/10/14 05:59:22 UTC
svn commit: r1022371 - in /incubator/hama/trunk/src:
examples/org/apache/hama/examples/PiEstimator.java
java/org/apache/hama/bsp/LocalBSPCluster.java
Author: edwardyoon
Date: Thu Oct 14 03:59:22 2010
New Revision: 1022371
URL: http://svn.apache.org/viewvc?rev=1022371&view=rev
Log:
Fixed Pi Estimator bug.
Removed:
incubator/hama/trunk/src/java/org/apache/hama/bsp/LocalBSPCluster.java
Modified:
incubator/hama/trunk/src/examples/org/apache/hama/examples/PiEstimator.java
Modified: incubator/hama/trunk/src/examples/org/apache/hama/examples/PiEstimator.java
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/src/examples/org/apache/hama/examples/PiEstimator.java?rev=1022371&r1=1022370&r2=1022371&view=diff
==============================================================================
--- incubator/hama/trunk/src/examples/org/apache/hama/examples/PiEstimator.java (original)
+++ incubator/hama/trunk/src/examples/org/apache/hama/examples/PiEstimator.java Thu Oct 14 03:59:22 2010
@@ -65,7 +65,11 @@ public class PiEstimator {
BSPMessage received;
while ((received = bspPeer.getCurrentMessage()) != null) {
LOG.info("Receives messages:" + Bytes.toDouble(received.getData()));
- pi = (pi + Bytes.toDouble(received.getData())) / 2;
+ if(pi == 0.0) {
+ pi = Bytes.toDouble(received.getData());
+ } else {
+ pi = (pi + Bytes.toDouble(received.getData())) / 2;
+ }
}
if (pi != 0.0) {