Skip to content

Commit

Permalink
Avoid division for small length2
Browse files Browse the repository at this point in the history
  • Loading branch information
Maumagnaguagno authored Mar 10, 2024
1 parent 4408802 commit cb518e2
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/did_you_mean/jaro_winkler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ def distance(str1, str2)

m = 0.0
t = 0.0
range = length2 / 2 - 1
range = 0 if range < 0
range = length2 > 3 ? length2 / 2 - 1 : 0
flags1 = 0
flags2 = 0

Expand Down

0 comments on commit cb518e2

Please sign in to comment.