incubator-hama-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edwardy...@apache.org
Subject svn commit: r1022371 - in /incubator/hama/trunk/src: examples/org/apache/hama/examples/PiEstimator.java java/org/apache/hama/bsp/LocalBSPCluster.java
Date Thu, 14 Oct 2010 03:59:22 GMT
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) {



Mime
View raw message