Use powi() instead of powf() for performance

This commit is contained in:
Dirkjan Ochtman 2021-02-04 10:17:11 +01:00
parent 970caeba44
commit 55cc7c54a3
1 changed files with 1 additions and 1 deletions

View File

@ -56,7 +56,7 @@ impl Segmenter {
Some(p) => p / self.total, Some(p) => p / self.total,
// Penalize words not found in the unigrams according // Penalize words not found in the unigrams according
// to their length, a crucial heuristic. // to their length, a crucial heuristic.
None => 10.0 / (self.total * 10.0f64.powf(word.len() as f64)), None => 10.0 / (self.total * 10.0f64.powi(word.len() as i32)),
} }
} }