Module Math
In: lib/backports/1.9.1/math.rb

Methods

Public Class methods

Standard in Ruby 1.9. See official documentation

[Source]

    # File lib/backports/1.9.1/math.rb, line 21
21:     def log2(numeric)
22:       log(numeric, 2)
23:     end

[Source]

    # File lib/backports/1.9.1/math.rb, line 5
 5:       def log_with_optional_base(numeric, base = Backports::Undefined)
 6:         if base.equal?(Backports::Undefined)
 7:           # Math.log(n) in 1.9.1 no longer accepts string arguments as it
 8:           # did on 1.8.x, but we won't risk redefining existing behavior
 9:           # when called with just one argument.
10:           log_without_optional_base(numeric)
11:         else
12:           # Math.log(n, b) in 1.9.1 does not accept string arguments:
13:           raise TypeError, "can't convert String into Float" if numeric.is_a?(String) || base.is_a?(String)
14:           log_without_optional_base(numeric) / log_without_optional_base(base)
15:         end
16:       end

[Validate]