We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c7375be commit 2c88287Copy full SHA for 2c88287
contents/monte_carlo_integration/code/java/MonteCarlo.java
@@ -6,7 +6,7 @@ public class MonteCarlo {
6
public static void main(String[] args) {
7
double piEstimation = monteCarlo(1000);
8
System.out.println("Estimated pi value: " + piEstimation);
9
- System.out.printf("Percent error: " + 100 * (piEstimation - Math.PI) / Math.PI);
+ System.out.printf("Percent error: " + 100 * Math.abs(piEstimation - Math.PI) / Math.PI);
10
}
11
12
//function to check whether point (x,y) is in unit circle
0 commit comments