Class: Float
- Inherits:
-
Object
- Object
- Float
- Defined in:
- lib/overloading/float.rb
Overview
Overloading operators for Float. Operations that are oveloaded are:
-
overloaded_plusfor ‘+` -
overloaded_minusfor- -
overloaded_mulfor ‘*` -
overloaded_divfor/ -
overloaded_powfor ‘**`
Instance Method Summary collapse
-
#*(a) ⇒ Object
If
ais aCAS::Optransform self in aCAS::Constand return a symbolic operation. -
#**(a) ⇒ Object
If
ais aCAS::Optransform self in aCAS::Constand return a symbolic operation. -
#+(a) ⇒ Object
If
ais aCAS::Optransform self in aCAS::Constand return a symbolic operation. -
#-(a) ⇒ Object
If
ais aCAS::Optransform self in aCAS::Constand return a symbolic operation. -
#/(a) ⇒ Object
If
ais aCAS::Optransform self in aCAS::Constand return a symbolic operation. - #overloaded_div ⇒ Object
- #overloaded_minus ⇒ Object
- #overloaded_mul ⇒ Object
-
#overloaded_plus ⇒ Object
Setting aliases.
- #overloaded_pow ⇒ Object
Instance Method Details
#*(a) ⇒ Object
If a is a CAS::Op transform self in a CAS::Const and return a symbolic operation
41 42 43 44 |
# File 'lib/overloading/float.rb', line 41 def *(a) return (CAS::const(self) * a) if a.is_a? CAS::Op self.overloaded_mul a end |
#**(a) ⇒ Object
If a is a CAS::Op transform self in a CAS::Const and return a symbolic operation
57 58 59 60 |
# File 'lib/overloading/float.rb', line 57 def **(a) return (CAS::const(self) ** a) if a.is_a? CAS::Op self.overloaded_pow a end |
#+(a) ⇒ Object
If a is a CAS::Op transform self in a CAS::Const and return a symbolic operation. If
25 26 27 28 |
# File 'lib/overloading/float.rb', line 25 def +(a) return (CAS::const(self) + a) if a.is_a? CAS::Op self.overloaded_plus a end |
#-(a) ⇒ Object
If a is a CAS::Op transform self in a CAS::Const and return a symbolic operation
33 34 35 36 |
# File 'lib/overloading/float.rb', line 33 def -(a) return (CAS::const(self) - a) if a.is_a? CAS::Op self.overloaded_minus a end |
#/(a) ⇒ Object
If a is a CAS::Op transform self in a CAS::Const and return a symbolic operation
49 50 51 52 |
# File 'lib/overloading/float.rb', line 49 def /(a) return (CAS::const(self) / a) if a.is_a? CAS::Op self.overloaded_div a end |
#overloaded_div ⇒ Object
17 |
# File 'lib/overloading/float.rb', line 17 alias :overloaded_div :/ |
#overloaded_minus ⇒ Object
15 |
# File 'lib/overloading/float.rb', line 15 alias :overloaded_minus :- |
#overloaded_mul ⇒ Object
16 |
# File 'lib/overloading/float.rb', line 16 alias :overloaded_mul :* |
#overloaded_plus ⇒ Object
Setting aliases
14 |
# File 'lib/overloading/float.rb', line 14 alias :overloaded_plus :+ |
#overloaded_pow ⇒ Object
18 |
# File 'lib/overloading/float.rb', line 18 alias :overloaded_pow :** |