Skip to content
This repository was archived by the owner on Apr 28, 2025. It is now read-only.

Combine the source files for fmod #544

Merged
merged 1 commit into from
Apr 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions etc/function-definitions.json
Original file line number Diff line number Diff line change
Expand Up @@ -537,21 +537,21 @@
},
"fmodf": {
"sources": [
"src/math/fmodf.rs",
"src/math/fmod.rs",
"src/math/generic/fmod.rs"
],
"type": "f32"
},
"fmodf128": {
"sources": [
"src/math/fmodf128.rs",
"src/math/fmod.rs",
"src/math/generic/fmod.rs"
],
"type": "f128"
},
"fmodf16": {
"sources": [
"src/math/fmodf16.rs",
"src/math/fmod.rs",
"src/math/generic/fmod.rs"
],
"type": "f16"
Expand Down
20 changes: 20 additions & 0 deletions src/math/fmod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
/// Calculate the remainder of `x / y`, the precise result of `x - trunc(x / y) * y`.
#[cfg(f16_enabled)]
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
pub fn fmodf16(x: f16, y: f16) -> f16 {
super::generic::fmod(x, y)
}

/// Calculate the remainder of `x / y`, the precise result of `x - trunc(x / y) * y`.
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
pub fn fmodf(x: f32, y: f32) -> f32 {
super::generic::fmod(x, y)
}

/// Calculate the remainder of `x / y`, the precise result of `x - trunc(x / y) * y`.
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
pub fn fmod(x: f64, y: f64) -> f64 {
super::generic::fmod(x, y)
}

/// Calculate the remainder of `x / y`, the precise result of `x - trunc(x / y) * y`.
#[cfg(f128_enabled)]
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
pub fn fmodf128(x: f128, y: f128) -> f128 {
super::generic::fmod(x, y)
}
5 changes: 0 additions & 5 deletions src/math/fmodf.rs

This file was deleted.

5 changes: 0 additions & 5 deletions src/math/fmodf128.rs

This file was deleted.

5 changes: 0 additions & 5 deletions src/math/fmodf16.rs

This file was deleted.

1 change: 1 addition & 0 deletions src/math/frexp.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
pub fn frexp(x: f64) -> (f64, i32) {
let mut y = x.to_bits();
let ee = ((y >> 52) & 0x7ff) as i32;
Expand Down
16 changes: 3 additions & 13 deletions src/math/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@ mod fmin_fmax;
mod fminimum_fmaximum;
mod fminimum_fmaximum_num;
mod fmod;
mod fmodf;
mod frexp;
mod frexpf;
mod hypot;
Expand Down Expand Up @@ -260,8 +259,7 @@ pub use self::fma_wide::fmaf;
pub use self::fmin_fmax::{fmax, fmaxf, fmin, fminf};
pub use self::fminimum_fmaximum::{fmaximum, fmaximumf, fminimum, fminimumf};
pub use self::fminimum_fmaximum_num::{fmaximum_num, fmaximum_numf, fminimum_num, fminimum_numf};
pub use self::fmod::fmod;
pub use self::fmodf::fmodf;
pub use self::fmod::{fmod, fmodf};
pub use self::frexp::frexp;
pub use self::frexpf::frexpf;
pub use self::hypot::hypot;
Expand Down Expand Up @@ -318,10 +316,6 @@ pub use self::trunc::{trunc, truncf};

cfg_if! {
if #[cfg(f16_enabled)] {
// verify-sorted-start
mod fmodf16;
// verify-sorted-end

// verify-sorted-start
pub use self::ceil::ceilf16;
pub use self::copysign::copysignf16;
Expand All @@ -331,7 +325,7 @@ cfg_if! {
pub use self::fmin_fmax::{fmaxf16, fminf16};
pub use self::fminimum_fmaximum::{fmaximumf16, fminimumf16};
pub use self::fminimum_fmaximum_num::{fmaximum_numf16, fminimum_numf16};
pub use self::fmodf16::fmodf16;
pub use self::fmod::fmodf16;
pub use self::ldexp::ldexpf16;
pub use self::rint::rintf16;
pub use self::round::roundf16;
Expand All @@ -348,10 +342,6 @@ cfg_if! {

cfg_if! {
if #[cfg(f128_enabled)] {
// verify-sorted-start
mod fmodf128;
// verify-sorted-end

// verify-sorted-start
pub use self::ceil::ceilf128;
pub use self::copysign::copysignf128;
Expand All @@ -362,7 +352,7 @@ cfg_if! {
pub use self::fmin_fmax::{fmaxf128, fminf128};
pub use self::fminimum_fmaximum::{fmaximumf128, fminimumf128};
pub use self::fminimum_fmaximum_num::{fmaximum_numf128, fminimum_numf128};
pub use self::fmodf128::fmodf128;
pub use self::fmod::fmodf128;
pub use self::ldexp::ldexpf128;
pub use self::rint::rintf128;
pub use self::round::roundf128;
Expand Down