diff options
| author | Trevor Gross <tmgross@umich.edu> | 2025-02-12 10:12:24 +0000 |
|---|---|---|
| committer | Trevor Gross <tmgross@umich.edu> | 2025-02-12 10:18:48 +0000 |
| commit | 212d463e89b0b2db7560fde4216b0c48a5448f34 (patch) | |
| tree | e2f9313087a8139f0e4761ebb99dd96d2d7ca5bd | |
| parent | dea2ed3d1d2e43df597f72e097e8fd439143e956 (diff) | |
| download | rust-212d463e89b0b2db7560fde4216b0c48a5448f34.tar.gz rust-212d463e89b0b2db7560fde4216b0c48a5448f34.zip | |
fma refactor 1/3: remove math/fma.rs
Done in stages so git tracks the moved file correctly.
| -rw-r--r-- | library/compiler-builtins/libm/src/math/fma.rs | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/library/compiler-builtins/libm/src/math/fma.rs b/library/compiler-builtins/libm/src/math/fma.rs deleted file mode 100644 index 69cc3eb6726..00000000000 --- a/library/compiler-builtins/libm/src/math/fma.rs +++ /dev/null @@ -1,40 +0,0 @@ -/// Fused multiply add (f64) -/// -/// Computes `(x*y)+z`, rounded as one ternary operation (i.e. calculated with infinite precision). -#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] -pub fn fma(x: f64, y: f64, z: f64) -> f64 { - return super::generic::fma(x, y, z); -} - -#[cfg(test)] -mod tests { - use super::*; - #[test] - fn fma_segfault() { - // These two inputs cause fma to segfault on release due to overflow: - assert_eq!( - fma( - -0.0000000000000002220446049250313, - -0.0000000000000002220446049250313, - -0.0000000000000002220446049250313 - ), - -0.00000000000000022204460492503126, - ); - - let result = fma(-0.992, -0.992, -0.992); - //force rounding to storage format on x87 to prevent superious errors. - #[cfg(all(target_arch = "x86", not(target_feature = "sse2")))] - let result = force_eval!(result); - assert_eq!(result, -0.007936000000000007,); - } - - #[test] - fn fma_sbb() { - assert_eq!(fma(-(1.0 - f64::EPSILON), f64::MIN, f64::MIN), -3991680619069439e277); - } - - #[test] - fn fma_underflow() { - assert_eq!(fma(1.1102230246251565e-16, -9.812526705433188e-305, 1.0894e-320), 0.0,); - } -} |
