compiler_builtins/math/libm_math/
ceil.rs

1/// Ceil (f16)
2///
3/// Finds the nearest integer greater than or equal to `x`.
4#[cfg(f16_enabled)]
5#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
6pub fn ceilf16(x: f16) -> f16 {
7    super::generic::ceil(x)
8}
9
10/// Ceil (f32)
11///
12/// Finds the nearest integer greater than or equal to `x`.
13#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
14pub fn ceilf(x: f32) -> f32 {
15    select_implementation! {
16        name: ceilf,
17        use_arch: all(target_arch = "wasm32", intrinsics_enabled),
18        args: x,
19    }
20
21    super::generic::ceil(x)
22}
23
24/// Ceil (f64)
25///
26/// Finds the nearest integer greater than or equal to `x`.
27#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
28pub fn ceil(x: f64) -> f64 {
29    select_implementation! {
30        name: ceil,
31        use_arch: all(target_arch = "wasm32", intrinsics_enabled),
32        use_arch_required: all(target_arch = "x86", not(target_feature = "sse2")),
33        args: x,
34    }
35
36    super::generic::ceil(x)
37}
38
39/// Ceil (f128)
40///
41/// Finds the nearest integer greater than or equal to `x`.
42#[cfg(f128_enabled)]
43#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
44pub fn ceilf128(x: f128) -> f128 {
45    super::generic::ceil(x)
46}