Add ability to calculate ratio

This commit is contained in:
Dima Kudosh
2016-02-15 14:54:32 +03:00
parent 329dc4419a
commit 6bd7dc4b84
2 changed files with 14 additions and 1 deletions
+8
View File
@@ -9,4 +9,12 @@ pub fn slice_str(string: &str, start: usize, end: usize) -> Option<&str>
unsafe{
Some(string.slice_unchecked(start, end))
}
}
pub fn calculate_ratio(matches: usize, length: usize) -> f32{
if length != 0{
return 2.0 * matches as f32 / length as f32
}
return 1.0
}