Skip to content

Commit

Permalink
Revert to direct equality testing (it is for the zero/sign case only)
Browse files Browse the repository at this point in the history
  • Loading branch information
ezicheq committed Jul 21, 2021
1 parent c804641 commit d76d1b1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ulps_eq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ impl ApproxEqUlps for f32 {
fn approx_eq_ulps(&self, other: &f32, ulps: i32) -> bool {
// -0 and +0 are drastically far in ulps terms, so
// we need a special case for that.
if (*self - *other).abs() < core::f32::EPSILON { return true; }
if *self==*other { return true; }

// Handle differing signs as a special case, even if
// they are very close, most people consider them
Expand Down Expand Up @@ -80,7 +80,7 @@ impl ApproxEqUlps for f64 {
fn approx_eq_ulps(&self, other: &f64, ulps: i64) -> bool {
// -0 and +0 are drastically far in ulps terms, so
// we need a special case for that.
if (*self - *other).abs() < core::f64::EPSILON / 2.0 { return true; }
if *self==*other { return true; }

// Handle differing signs as a special case, even if
// they are very close, most people consider them
Expand Down

0 comments on commit d76d1b1

Please sign in to comment.