diff --git a/spec/ameba/rule/large_numbers_spec.cr b/spec/ameba/rule/large_numbers_spec.cr index 8e1390b8..89c619ad 100644 --- a/spec/ameba/rule/large_numbers_spec.cr +++ b/spec/ameba/rule/large_numbers_spec.cr @@ -69,6 +69,10 @@ module Ameba 11_234e10_f32 +1.123 -0.000_5 + + 1200.0 + 1200.01 + 1200.012 ) subject.catch(s).should be_valid end diff --git a/src/ameba/rule/large_numbers.cr b/src/ameba/rule/large_numbers.cr index fc8c9317..3e15ac70 100644 --- a/src/ameba/rule/large_numbers.cr +++ b/src/ameba/rule/large_numbers.cr @@ -52,7 +52,7 @@ module Ameba::Rule end private def allowed?(_sign, value, fraction, _suffix) - return true unless fraction.nil? + return true if !fraction.nil? && fraction.size > 3 digits = value.chars.select &.to_s.=~ /[0-9]/ digits.size >= int_min_digits