8000 [ruby/did_you_mean] Avoid division for small length2 · jeremyevans/ruby@f168240 · GitHub
[go: up one dir, main page]

Skip to content

Commit f168240

Browse files
Maumagnaguagnomatzbot
authored andcommitted
[ruby/did_you_mean] Avoid division for small length2
ruby/did_you_mean@cb518e251a
1 parent affbc79 commit f168240

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

lib/did_you_mean/jaro_winkler.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ def distance(str1, str2)
88

99
m = 0.0
1010
t = 0.0
11-
range = length2 / 2 - 1
12-
range = 0 if range < 0
11+
range = length2 > 3 ? length2 / 2 - 1 : 0
1312
flags1 = 0
1413
flags2 = 0
1514

0 commit comments

Comments
 (0)
0