Coverage Report

Created: 2025-07-11 06:39

/rust/registry/src/index.crates.io-6f17d22bba15001f/libm-0.2.11/src/math/fdimf.rs
Line
Count
Source (jump to first uncovered line)
1
use core::f32;
2
3
/// Positive difference (f32)
4
///
5
/// Determines the positive difference between arguments, returning:
6
/// * x - y if x > y, or
7
/// * +0  if x <= y, or
8
/// * NAN if either argument is NAN.
9
///
10
/// A range error may occur.
11
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
12
0
pub fn fdimf(x: f32, y: f32) -> f32 {
13
0
    if x.is_nan() {
14
0
        x
15
0
    } else if y.is_nan() {
16
0
        y
17
0
    } else if x > y {
18
0
        x - y
19
    } else {
20
0
        0.0
21
    }
22
0
}