Class: Fixnum
- Inherits:
-
Object
- Object
- Fixnum
- Defined in:
- lib/mathn.rb
Overview
When mathn is required, Fixnum’s division and exponentiation are enhanced to return more precise values from mathematical expressions.
2/3*3 # => 0
require 'mathn'
2/3*3 # => 2
Instance Method Summary collapse
-
#**(other) ⇒ Object
Exponentiate by
other
. - #power! ⇒ Object
Instance Method Details
#**(other) ⇒ Object
Exponentiate by other
78 79 80 81 82 83 84 |
# File 'lib/mathn.rb', line 78 def ** (other) if self < 0 && other.round != other Complex(self, 0.0) ** other else power!(other) end end |
#power! ⇒ Object
73 |
# File 'lib/mathn.rb', line 73 alias power! ** |