Sha256: e4603232dd74ab105e277ef7191745e3c48befef6c6164a32a26928c413b6491
Contents?: true
Size: 517 Bytes
Versions: 4
Compression:
Stored size: 517 Bytes
Contents
require 'mathn' class Numeric # Squares the number def square self * self end # Cube the number def cube self.square * self end # Finds the square root of the number def sqrt Math.sqrt(self) end # Do some other roots def root(n = 2) return self if 1 == n return self.sqrt if 2 == n self ** (1 / n.to_f) end # Finds the log base e of the number def ln Math::log(self) end # Finds the log base 10 of the number def log Math::log10(self) end end
Version data entries
4 entries across 4 versions & 2 rubygems
Version | Path |
---|---|
darkhelmet-darkext-0.11.1 | lib/darkext/numeric.rb |
darkhelmet-darkext-0.11.2 | lib/darkext/numeric.rb |
darkhelmet-darkext-0.12.0 | lib/darkext/numeric.rb |
darkext-0.12.0 | lib/darkext/numeric.rb |