diff --git a/activesupport/lib/active_support/number_helper/number_to_currency_converter.rb b/activesupport/lib/active_support/number_helper/number_to_currency_converter.rb index 91e324a478..4b8d267b4e 100644 --- a/activesupport/lib/active_support/number_helper/number_to_currency_converter.rb +++ b/activesupport/lib/active_support/number_helper/number_to_currency_converter.rb @@ -9,12 +9,13 @@ module ActiveSupport def convert number = self.number.to_s.strip + number_f = number.to_f format = options[:format] - if number.to_f.negative? - number = absolute_value(number) + if number_f.negative? + number = number_f.abs - unless options[:precision] == 0 && number.to_f < 0.5 + unless options[:precision] == 0 && number < 0.5 format = options[:negative_format] end end @@ -24,10 +25,6 @@ module ActiveSupport end private - def absolute_value(number) - number.respond_to?(:abs) ? number.abs : number.sub(/\A-/, "") - end - def options @options ||= begin defaults = default_format_options.merge(i18n_opts)