Skip to content

Latest commit

 

History

History
61 lines (40 loc) · 1.32 KB

README.md

File metadata and controls

61 lines (40 loc) · 1.32 KB

Build Documentation Demo

heron

A library implementing Heron's method to find a square root.

Usage

use heron::heron;

let square = 25.0;
let precision = 0.00001;

let root = heron(square, precision);

println!("square root: {}", root);

Examples

This repository contains two examples.

CLI

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

Web (WASM)

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