Skip to content

Commit

Permalink
dip_check: fix boolean logic bug
Browse files Browse the repository at this point in the history
  • Loading branch information
intarga committed Apr 20, 2024
1 parent 0b2617d commit 6b97fab
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/qc_tests/dip_check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ pub fn dip_check(data: &SeriesCache, high: f32, max: f32) -> Result<Vec<Flag>, E
let diffsum = ((data[2] - data[1]).abs() + (data[1] - data[0]).abs()).abs();
let diffdiff = ((data[2] - data[1]).abs() - (data[1] - data[0]).abs()).abs();

// TODO: this seems suspicious, shouldn't the max check be first? and can't the
// latter condition be lifted out?
if diffsum > high && diffdiff < (diffsum * 35. / 100.) {
return Flag::Warn;
}
if diffdiff < (diffsum * 0.35) {
if diffsum > max {
return Flag::Fail;
}

if diffsum > max && diffdiff < (diffsum * 35. / 100.) {
return Flag::Fail;
if diffsum > high {
return Flag::Warn;
}
}
}
Flag::Pass
Expand Down

0 comments on commit 6b97fab

Please sign in to comment.