diff options
Diffstat (limited to 'actionpack/lib/action_view')
-rw-r--r-- | actionpack/lib/action_view/helpers/number_helper.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/actionpack/lib/action_view/helpers/number_helper.rb b/actionpack/lib/action_view/helpers/number_helper.rb index b5de5c3422..326d5c1049 100644 --- a/actionpack/lib/action_view/helpers/number_helper.rb +++ b/actionpack/lib/action_view/helpers/number_helper.rb @@ -261,7 +261,7 @@ module ActionView digits = (Math.log10(number.abs) + 1).floor rounded_number = BigDecimal.new((number / 10 ** (digits - precision)).to_s).round.to_f * 10 ** (digits - precision) end - precision = precision - digits + precision -= digits precision = precision > 0 ? precision : 0 #don't let it be negative else rounded_number = BigDecimal.new((number * (10 ** precision)).to_s).round.to_f / 10 ** precision |