summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJustin Worthe <justin@worthe-it.co.za>2017-09-10 22:06:03 +0200
committerJustin Worthe <justin@worthe-it.co.za>2017-09-10 22:06:03 +0200
commit1dd2d5bc841bcf4a26d45efd52e50e1e7ee08feb (patch)
tree004a7e5e78eb1786dda89c040d47a49d00b8dfa4 /src
parent8cf2f2888cd2b2f48dd0264cf1efe66a46aed2f4 (diff)
parente289da3f599050236ea6b124ab2c97d6f3ad957a (diff)
Merge branch 'master' of github.com:JWorthe/rusty_microphone
Diffstat (limited to 'src')
-rw-r--r--src/transforms.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/transforms.rs b/src/transforms.rs
index 7d1c829..ac83a32 100644
--- a/src/transforms.rs
+++ b/src/transforms.rs
@@ -88,10 +88,10 @@ fn score_guess(correlation: &[f32], period: f32, data_points: usize) -> f32 {
}
fn interpolate(correlation: &[f32], x: f32) -> f32 {
- if x < 0.0 {
+ if x.floor() < 0.0 {
correlation[0]
}
- else if x >= correlation.len() as f32 {
+ else if x.ceil() >= correlation.len() as f32 {
correlation[correlation.len()-1]
}
else {