dasp_sample/
ops.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
pub mod f32 {
    #[allow(unused_imports)]
    use core;

    #[cfg(not(feature = "std"))]
    pub fn sqrt(x: f32) -> f32 {
        unsafe { core::intrinsics::sqrtf32(x) }
    }
    #[cfg(feature = "std")]
    pub fn sqrt(x: f32) -> f32 {
        x.sqrt()
    }
}

pub mod f64 {
    #[allow(unused_imports)]
    use core;

    #[cfg(not(feature = "std"))]
    pub fn sqrt(x: f64) -> f64 {
        unsafe { core::intrinsics::sqrtf64(x) }
    }
    #[cfg(feature = "std")]
    pub fn sqrt(x: f64) -> f64 {
        x.sqrt()
    }
}