lib/money/currency.rb
# If we need to figure out how many decimal places we need we
# use repeated integer division.
If we need to figure out how many decimal places we need we
use repeated integer division.
If we need to figure out how many decimal places we need we use repeated integer division .
def calculate_decimal_places(num)
      i = 1
      while num >= 10
        num /= 10
        i += 1 if num >= 10
      end
      i
    end
def calculate_decimal_places ( num ) i = 1 while num >= 10 num /= 10 i += 1 if num >= 10 end i end
If we need to figure out how many decimal places we need we
use repeated integer division.
If we need to figure out how many decimal places we need we use repeated integer division .
num
<not_specific>