Module: Polyfill::V2_2::Math::ClassMethods

Defined in:
lib/polyfill/v2_2/math.rb

Instance Method Summary collapse

Instance Method Details

#log(*args) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/polyfill/v2_2/math.rb', line 5

def log(*args)
  if (base = args[1])
    base = InternalUtils.to_f(base)
    raise ::Math::DomainError, 'Numerical argument is out of domain - "log"' if base < 0

    x = args[0]
    return 0 / 0.0 if base == 0 && InternalUtils.to_f(x) == 0
  end

  super
end