127: Relax EPSILON comparisons in mul_add tests r=cuviper a=cuviper

Closes #124.

Co-authored-by: Josh Stone <cuviper@gmail.com>
This commit is contained in:
bors[bot] 2019-09-27 18:02:41 +00:00 committed by GitHub
commit 5b9f6e4c47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 2 deletions

View File

@ -14,6 +14,18 @@ script:
- ./ci/test_full.sh - ./ci/test_full.sh
matrix: matrix:
include: include:
# i586 presents floating point challenges for lack of SSE/SSE2
- name: "i586"
rust: stable
env: TARGET=i586-unknown-linux-gnu
addons:
apt:
packages:
- gcc-multilib
before_script:
- rustup target add $TARGET
script:
- cargo test --verbose --target $TARGET --all-features
# try a target that doesn't have std at all # try a target that doesn't have std at all
- name: "no_std" - name: "no_std"
rust: stable rust: stable

View File

@ -18,7 +18,7 @@
/// // 100.0 /// // 100.0
/// let abs_difference = (m.mul_add(x, b) - (m*x + b)).abs(); /// let abs_difference = (m.mul_add(x, b) - (m*x + b)).abs();
/// ///
/// assert!(abs_difference <= f32::EPSILON); /// assert!(abs_difference <= 100.0 * f32::EPSILON);
/// ``` /// ```
pub trait MulAdd<A = Self, B = Self> { pub trait MulAdd<A = Self, B = Self> {
/// The resulting type after applying the fused multiply-add. /// The resulting type after applying the fused multiply-add.
@ -140,7 +140,7 @@ mod tests {
let abs_difference = (MulAdd::mul_add(m, x, b) - (m*x + b)).abs(); let abs_difference = (MulAdd::mul_add(m, x, b) - (m*x + b)).abs();
assert!(abs_difference <= $t::EPSILON); assert!(abs_difference <= 46.4 * $t::EPSILON);
} }
)+ )+
}; };