Debian Codegraph @

src/nostd_float.rs

raw symbols SCIP
1 /// Basic required float operations.
2 pub(crate) trait FloatExt {
3 fn floor(self) -> Self;
4 fn ceil(self) -> Self;
5 fn round(self) -> Self;
6 fn trunc(self) -> Self;
7 fn fract(self) -> Self;
8 }
9
10 impl FloatExt for f32 {
11 #[inline]
12 fn floor(self) -> Self {
13 libm::floorf(self)
14 }
15 #[inline]
16 fn ceil(self) -> Self {
17 libm::ceilf(self)
18 }
19 #[inline]
20 fn round(self) -> Self {
21 libm::roundf(self)
22 }
23 #[inline]
24 fn trunc(self) -> Self {
25 libm::truncf(self)
26 }
27 #[inline]
28 fn fract(self) -> Self {
29 self - self.trunc()
30 }
31 }