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 40d37dd commit acc0289Copy full SHA for acc0289
contents/monte_carlo_integration/code/rust/monte_carlo.rs
@@ -26,5 +26,5 @@ fn monte_carlo(n: i64) -> f64 {
26
fn main() {
27
let pi_estimate = monte_carlo(10000000);
28
29
- println!("Percent error is {:.3}%", (100.0 * (PI - pi_estimate) / PI));
+ println!("Percent error is {:.3}%", (100.0 * (pi_estimate - PI).abs() / PI));
30
}
0 commit comments