Add FMA tests that cause it to segfault
This commit is contained in:
parent
002b51d035
commit
42e0c8c0a1
2 changed files with 38 additions and 0 deletions
|
|
@ -205,3 +205,22 @@ pub fn fma(x: f64, y: f64, z: f64) -> f64 {
|
|||
}
|
||||
scalbn(r, e)
|
||||
}
|
||||
|
||||
#[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,
|
||||
);
|
||||
|
||||
assert_eq!(fma(-0.992, -0.992, -0.992), -0.00793599999988632,);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
19
library/compiler-builtins/libm/tests/unit.rs
Normal file
19
library/compiler-builtins/libm/tests/unit.rs
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
use libm::*;
|
||||
|
||||
#[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,
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
fma(-0.992, -0.992, -0.992),
|
||||
-0.00793599999988632,
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue