MCPcopy Create free account
hub / github.com/douchuan/algorithm / sqrt

Function sqrt

tests/test_math.rs:4–13  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2
3#[test]
4fn sqrt() {
5 // let epsilon = f64::EPSILON;
6 let epsilon = 0.01;
7 let valus: Vec<f64> = vec![1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0];
8 for v in valus {
9 assert!((v.sqrt() - math::mysqrt::sqrt_binary_search(v)) <= epsilon);
10 assert!((v.sqrt() - math::mysqrt::sqrt_newton(v)) <= epsilon);
11 assert!((v.sqrt() - math::mysqrt::sqrt3(v)) <= epsilon);
12 }
13}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected