Coverage Report

Created: 2025-08-05 11:48

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/build/cargo-vendor-dir/libm-0.2.15/src/math/generic/fminimum_num.rs
Line
Count
Source
1
/* SPDX-License-Identifier: MIT OR Apache-2.0 */
2
//! IEEE 754-2019 `minimum`.
3
//!
4
//! Per the spec, returns:
5
//! - `x` if `x < y`
6
//! - `y` if `y < x`
7
//! - Non-NaN if one operand is NaN
8
//! - Logic following +0.0 > -0.0
9
//! - Either `x` or `y` if `x == y` and the signs are the same
10
//! - qNaN if either operand is a NaN
11
//!
12
//! Excluded from our implementation is sNaN handling.
13
14
use crate::support::Float;
15
16
#[inline]
17
0
pub fn fminimum_num<F: Float>(x: F, y: F) -> F {
18
0
    let res =
19
0
        if y.is_nan() || x < y || (x.to_bits() == F::NEG_ZERO.to_bits() && y.is_sign_positive()) {
20
0
            x
21
        } else {
22
0
            y
23
        };
24
25
    // Canonicalize
26
0
    res * F::ONE
27
0
}