• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

geo-ant / varpro / 10125949499

27 Jul 2024 07:37PM UTC coverage: 82.236%. Remained the same
10125949499

Pull #36

github

web-flow
Merge 9ea649457 into 70eb1d40c
Pull Request #36: Feature/bump version

824 of 1002 relevant lines covered (82.24%)

1268.26 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

50.0
/src/statistics/numeric_traits/mod.rs
1
/// a helper trait for floating point numbers that can be cast from
2
/// f64. This is only implemented for f32 and f64. Casting f64 into
3
/// f32 is typically associated with a loss of precision.
4
pub trait CastF64 {
5
    /// helper for the constant 0 (zero)
6
    const ZERO: Self;
7
    /// helper for the constant 1 (one)
8
    const ONE: Self;
9

10
    /// make an f64 into a value of this type
11
    fn from_f64(value: f64) -> Self;
12

13
    /// make a value of this type into an f64
14
    fn into_f64(self) -> f64;
15
}
16

17
impl CastF64 for f64 {
18
    const ZERO: Self = 0.;
19
    const ONE: Self = 1.;
20

21
    #[inline]
22
    fn from_f64(value: f64) -> Self {
2,000✔
23
        value
2,000✔
24
    }
25

26
    #[inline]
27
    fn into_f64(self) -> Self {
2,002✔
28
        self
2,002✔
29
    }
30
}
31

32
impl CastF64 for f32 {
33
    const ZERO: Self = 0.;
34
    const ONE: Self = 1.;
35

36
    #[inline]
37
    fn from_f64(value: f64) -> Self {
×
38
        value as _
×
39
    }
40

41
    #[inline]
42
    fn into_f64(self) -> f64 {
×
43
        self as _
×
44
    }
45
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc