Flowdock
method

digits_and_rounded_number

Importance_0
v4.2.7 - Show latest stable - 0 notes - Class: NumberToRoundedConverter
digits_and_rounded_number(precision) private

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activesupport/lib/active_support/number_helper/number_to_rounded_converter.rb, line 45
        def digits_and_rounded_number(precision)
          if zero?
            [1, 0]
          else
            digits = digit_count(number)
            multiplier = 10 ** (digits - precision)
            rounded_number = calculate_rounded_number(multiplier)
            digits = digit_count(rounded_number) # After rounding, the number of digits may have changed
            [digits, rounded_number]
          end
        end
Register or log in to add new notes.