weavatrix-graph 0.6.3

Deterministic, evidence-carrying graph core for Weavatrix repository intelligence
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
pub(super) fn square_root(value: f64) -> f64 {
    if value <= 0.0 {
        return 0.0;
    }
    #[cfg(feature = "std")]
    {
        value.sqrt()
    }
    #[cfg(not(feature = "std"))]
    {
        let mut estimate = if value < 1.0 { 1.0 } else { value };
        for _ in 0..32 {
            estimate = 0.5 * (estimate + value / estimate);
        }
        estimate
    }
}