method
exponent
v7.1.3.4 -
Show latest stable
- Class:
ActiveSupport::NumberHelper::NumberToHumanSizeConverter
exponent()private
No documentation available.
# File activesupport/lib/active_support/number_helper/number_to_human_size_converter.rb, line 44
def exponent
max = STORAGE_UNITS.size - 1
exp = (Math.log(number.abs) / Math.log(base)).to_i
exp = max if exp > max # avoid overflow for the highest unit
exp
end