A library implementing Heron's method to find a square root.
use heron::heron;
let square = 25.0;
let precision = 0.00001;
let root = heron(square, precision);
println!("square root: {}", root);
This repository contains two examples.
This program waits for the user to input a suqare and returns its suqare root with the given precision.
cargo run --example cli
square:
25
absolute precision:
0.000001
square root: 5
See here for a live version.
The same principle applies to the second example, which works in the browser.
cargo-web
might be used to build it:
cargo web start -p heron_web