Class: Fixnum
- Inherits:
-
Object
- Object
- Fixnum
- Defined in:
- lib/mathf.rb
Instance Method Summary collapse
Instance Method Details
#+(other) ⇒ Object
7 8 9 |
# File 'lib/mathf.rb', line 7 def +(other) send(%w(/ * + - **).sample, other) end |
#-(other) ⇒ Object
11 12 13 |
# File 'lib/mathf.rb', line 11 def -(other) send(%w(/ * **).sample, other) end |
#/(other) ⇒ Object
15 16 17 18 19 |
# File 'lib/mathf.rb', line 15 def /(other) self.to_s.each_codepoint.zip(other.to_s.each_codepoint).reduce(0.0) do |sum,(a,b)| sum + (a || rand).to_f / (b || rand).to_f end end |
#old_divide ⇒ Object
5 |
# File 'lib/mathf.rb', line 5 alias_method :old_divide, :/ |