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.
2 parents ff753eb + 2c88287 commit 8b49852Copy full SHA for 8b49852
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 * (Math.PI - piEstimation) / 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