Combine fmin{,f,f16,f128} and fmax{,f,f16,128} into a single file

These don't have much content since they now use the generic
implementation. There will be more similar functions in the near future
(fminimum, fmaximum, fminimum_num, fmaximum_num); start the pattern of
combining similar functions now so we don't have to eventually maintain
similar docs across 24 different files.
This commit is contained in:
Trevor Gross 2025-02-10 19:56:52 +00:00 committed by Trevor Gross
parent a6dd7980f1
commit 86ee1f99c9
11 changed files with 65 additions and 64 deletions

View file

@ -365,56 +365,56 @@
},
"fmax": {
"sources": [
"src/math/fmax.rs",
"src/math/fmin_fmax.rs",
"src/math/generic/fmax.rs"
],
"type": "f64"
},
"fmaxf": {
"sources": [
"src/math/fmaxf.rs",
"src/math/fmin_fmax.rs",
"src/math/generic/fmax.rs"
],
"type": "f32"
},
"fmaxf128": {
"sources": [
"src/math/fmaxf128.rs",
"src/math/fmin_fmax.rs",
"src/math/generic/fmax.rs"
],
"type": "f128"
},
"fmaxf16": {
"sources": [
"src/math/fmaxf16.rs",
"src/math/fmin_fmax.rs",
"src/math/generic/fmax.rs"
],
"type": "f16"
},
"fmin": {
"sources": [
"src/math/fmin.rs",
"src/math/fmin_fmax.rs",
"src/math/generic/fmin.rs"
],
"type": "f64"
},
"fminf": {
"sources": [
"src/math/fminf.rs",
"src/math/fmin_fmax.rs",
"src/math/generic/fmin.rs"
],
"type": "f32"
},
"fminf128": {
"sources": [
"src/math/fminf128.rs",
"src/math/fmin_fmax.rs",
"src/math/generic/fmin.rs"
],
"type": "f128"
},
"fminf16": {
"sources": [
"src/math/fminf16.rs",
"src/math/fmin_fmax.rs",
"src/math/generic/fmin.rs"
],
"type": "f16"

View file

@ -1,5 +0,0 @@
/// Return the greater of two arguments or, if either argument is NaN, the other argument.
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
pub fn fmax(x: f64, y: f64) -> f64 {
super::generic::fmax(x, y)
}

View file

@ -1,5 +0,0 @@
/// Return the greater of two arguments or, if either argument is NaN, the other argument.
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
pub fn fmaxf(x: f32, y: f32) -> f32 {
super::generic::fmax(x, y)
}

View file

@ -1,5 +0,0 @@
/// Return the greater of two arguments or, if either argument is NaN, the other argument.
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
pub fn fmaxf128(x: f128, y: f128) -> f128 {
super::generic::fmax(x, y)
}

View file

@ -1,5 +0,0 @@
/// Return the greater of two arguments or, if either argument is NaN, the other argument.
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
pub fn fmaxf16(x: f16, y: f16) -> f16 {
super::generic::fmax(x, y)
}

View file

@ -1,5 +0,0 @@
/// Return the lesser of two arguments or, if either argument is NaN, the other argument.
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
pub fn fmin(x: f64, y: f64) -> f64 {
super::generic::fmin(x, y)
}

View file

@ -0,0 +1,51 @@
/// Return the lesser of two arguments or, if either argument is NaN, the other argument.
#[cfg(f16_enabled)]
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
pub fn fminf16(x: f16, y: f16) -> f16 {
super::generic::fmin(x, y)
}
/// Return the lesser of two arguments or, if either argument is NaN, the other argument.
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
pub fn fminf(x: f32, y: f32) -> f32 {
super::generic::fmin(x, y)
}
/// Return the lesser of two arguments or, if either argument is NaN, the other argument.
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
pub fn fmin(x: f64, y: f64) -> f64 {
super::generic::fmin(x, y)
}
/// Return the lesser of two arguments or, if either argument is NaN, the other argument.
#[cfg(f128_enabled)]
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
pub fn fminf128(x: f128, y: f128) -> f128 {
super::generic::fmin(x, y)
}
/// Return the greater of two arguments or, if either argument is NaN, the other argument.
#[cfg(f16_enabled)]
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
pub fn fmaxf16(x: f16, y: f16) -> f16 {
super::generic::fmax(x, y)
}
/// Return the greater of two arguments or, if either argument is NaN, the other argument.
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
pub fn fmaxf(x: f32, y: f32) -> f32 {
super::generic::fmax(x, y)
}
/// Return the greater of two arguments or, if either argument is NaN, the other argument.
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
pub fn fmax(x: f64, y: f64) -> f64 {
super::generic::fmax(x, y)
}
/// Return the greater of two arguments or, if either argument is NaN, the other argument.
#[cfg(f128_enabled)]
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
pub fn fmaxf128(x: f128, y: f128) -> f128 {
super::generic::fmax(x, y)
}

View file

@ -1,5 +0,0 @@
/// Return the lesser of two arguments or, if either argument is NaN, the other argument.
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
pub fn fminf(x: f32, y: f32) -> f32 {
super::generic::fmin(x, y)
}

View file

@ -1,5 +0,0 @@
/// Return the lesser of two arguments or, if either argument is NaN, the other argument.
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
pub fn fminf128(x: f128, y: f128) -> f128 {
super::generic::fmin(x, y)
}

View file

@ -1,5 +0,0 @@
/// Return the lesser of two arguments or, if either argument is NaN, the other argument.
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
pub fn fminf16(x: f16, y: f16) -> f16 {
super::generic::fmin(x, y)
}

View file

@ -165,10 +165,7 @@ mod floor;
mod floorf;
mod fma;
mod fmaf;
mod fmax;
mod fmaxf;
mod fmin;
mod fminf;
mod fmin_fmax;
mod fmod;
mod fmodf;
mod frexp;
@ -273,10 +270,7 @@ pub use self::floor::floor;
pub use self::floorf::floorf;
pub use self::fma::fma;
pub use self::fmaf::fmaf;
pub use self::fmax::fmax;
pub use self::fmaxf::fmaxf;
pub use self::fmin::fmin;
pub use self::fminf::fminf;
pub use self::fmin_fmax::{fmax, fmaxf, fmin, fminf};
pub use self::fmod::fmod;
pub use self::fmodf::fmodf;
pub use self::frexp::frexp;
@ -346,8 +340,6 @@ cfg_if! {
mod fabsf16;
mod fdimf16;
mod floorf16;
mod fmaxf16;
mod fminf16;
mod fmodf16;
mod ldexpf16;
mod rintf16;
@ -363,8 +355,8 @@ cfg_if! {
pub use self::fabsf16::fabsf16;
pub use self::fdimf16::fdimf16;
pub use self::floorf16::floorf16;
pub use self::fmaxf16::fmaxf16;
pub use self::fminf16::fminf16;
pub use self::fmin_fmax::fmaxf16;
pub use self::fmin_fmax::fminf16;
pub use self::fmodf16::fmodf16;
pub use self::ldexpf16::ldexpf16;
pub use self::rintf16::rintf16;
@ -385,8 +377,6 @@ cfg_if! {
mod fdimf128;
mod floorf128;
mod fmaf128;
mod fmaxf128;
mod fminf128;
mod fmodf128;
mod ldexpf128;
mod rintf128;
@ -403,8 +393,8 @@ cfg_if! {
pub use self::fdimf128::fdimf128;
pub use self::floorf128::floorf128;
pub use self::fmaf128::fmaf128;
pub use self::fmaxf128::fmaxf128;
pub use self::fminf128::fminf128;
pub use self::fmin_fmax::fmaxf128;
pub use self::fmin_fmax::fminf128;
pub use self::fmodf128::fmodf128;
pub use self::ldexpf128::ldexpf128;
pub use self::rintf128::rintf128;