aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/number_helper/number_to_rounded_converter.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/lib/active_support/number_helper/number_to_rounded_converter.rb')
-rw-r--r--activesupport/lib/active_support/number_helper/number_to_rounded_converter.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/number_helper/number_to_rounded_converter.rb b/activesupport/lib/active_support/number_helper/number_to_rounded_converter.rb
index df316a08e6..981c562551 100644
--- a/activesupport/lib/active_support/number_helper/number_to_rounded_converter.rb
+++ b/activesupport/lib/active_support/number_helper/number_to_rounded_converter.rb
@@ -23,7 +23,7 @@ module ActiveSupport
precision = 0 if precision < 0 # don't let it be negative
else
rounded_number = number.round(precision)
- rounded_number = rounded_number.to_i if precision == 0
+ rounded_number = rounded_number.to_i if precision == 0 && rounded_number.finite?
rounded_number = rounded_number.abs if rounded_number.zero? # prevent showing negative zeros
end