Skip to content

Commit ecb87fc

Browse files
committed
Skip f64::mul_add tests on MinGW
Per [1], MinGW has an incorrect fma implementation. This showed up in tests run with cranelift after adding float math operations to `core`. Presumably we hadn't noticed this when running tests with LLVM because LLVM was constant folding the result away. [1]: https://sourceforge.net/p/mingw-w64/bugs/848/
1 parent 64d47f7 commit ecb87fc

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

library/core/src/num/f64.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1758,6 +1758,8 @@ pub fn fract(x: f64) -> f64 {
17581758
/// ```
17591759
/// #![feature(core_float_math)]
17601760
///
1761+
/// # // FIXME(mingw): mingw has an incorrect fma https://sourceforge.net/p/mingw-w64/bugs/848/
1762+
/// # #[cfg(all(target_os = "windows", target_env = "gnu", not(target_abi = "llvm")))] {
17611763
/// use core::f64;
17621764
///
17631765
/// let m = 10.0_f64;
@@ -1775,6 +1777,7 @@ pub fn fract(x: f64) -> f64 {
17751777
/// assert_eq!(f64::mul_add(one_plus_eps, one_minus_eps, minus_one), -f64::EPSILON * f64::EPSILON);
17761778
/// // Different rounding with the non-fused multiply and add.
17771779
/// assert_eq!(one_plus_eps * one_minus_eps + minus_one, 0.0);
1780+
/// # }
17781781
/// ```
17791782
///
17801783
/// _This standalone function is for testing only. It will be stabilized as an inherent method._

library/coretests/tests/floats/f64.rs

+2
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,8 @@ fn test_next_down() {
394394
assert_f64_biteq!(nan2.next_down(), nan2);
395395
}
396396

397+
// FIXME(mingw): mingw has an incorrect fma https://sourceforge.net/p/mingw-w64/bugs/848/
398+
#[cfg_attr(all(target_os = "windows", target_env = "gnu", not(target_abi = "llvm")), ignore)]
397399
#[test]
398400
fn test_mul_add() {
399401
let nan: f64 = f64::NAN;

0 commit comments

Comments
 (0)