/rust/registry/src/index.crates.io-1949cf8c6b5b557f/libm-0.2.15/src/math/sqrt.rs
Line | Count | Source |
1 | | /// The square root of `x` (f16). |
2 | | #[cfg(f16_enabled)] |
3 | | #[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] |
4 | | pub fn sqrtf16(x: f16) -> f16 { |
5 | | select_implementation! { |
6 | | name: sqrtf16, |
7 | | use_arch: all(target_arch = "aarch64", target_feature = "fp16"), |
8 | | args: x, |
9 | | } |
10 | | |
11 | | return super::generic::sqrt(x); |
12 | | } |
13 | | |
14 | | /// The square root of `x` (f32). |
15 | | #[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] |
16 | 0 | pub fn sqrtf(x: f32) -> f32 { |
17 | 0 | select_implementation! { |
18 | | name: sqrtf, |
19 | | use_arch: any( |
20 | | all(target_arch = "aarch64", target_feature = "neon"), |
21 | | all(target_arch = "wasm32", intrinsics_enabled), |
22 | | target_feature = "sse2" |
23 | | ), |
24 | | args: x, |
25 | | } |
26 | | |
27 | 0 | super::generic::sqrt(x) |
28 | 0 | } |
29 | | |
30 | | /// The square root of `x` (f64). |
31 | | #[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] |
32 | 0 | pub fn sqrt(x: f64) -> f64 { |
33 | 0 | select_implementation! { |
34 | | name: sqrt, |
35 | | use_arch: any( |
36 | | all(target_arch = "aarch64", target_feature = "neon"), |
37 | | all(target_arch = "wasm32", intrinsics_enabled), |
38 | | target_feature = "sse2" |
39 | | ), |
40 | | args: x, |
41 | | } |
42 | | |
43 | 0 | super::generic::sqrt(x) |
44 | 0 | } |
45 | | |
46 | | /// The square root of `x` (f128). |
47 | | #[cfg(f128_enabled)] |
48 | | #[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] |
49 | | pub fn sqrtf128(x: f128) -> f128 { |
50 | | return super::generic::sqrt(x); |
51 | | } |