Sha256: 23342dba32f2731f07e7597e5ccf2d5a78f21bd7d213e253c4dc5aec1591fd09
Contents?: true
Size: 491 Bytes
Versions: 26
Compression:
Stored size: 491 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.sqrt if n == 2 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
26 entries across 26 versions & 1 rubygems