Class: Float
- Inherits:
-
Object
- Object
- Float
- Defined in:
- lib/overloading/float.rb
Overview
Overloading operators for Float. Operations that are oveloaded are:
-
‘overloaded_plus` for `+`
-
‘overloaded_minus` for `-`
-
‘overloaded_mul` for `*`
-
‘overloaded_div` for `/`
-
‘overloaded_pow` for `**`
Instance Method Summary collapse
-
#*(a) ⇒ Object
If ‘a` is a `CAS::Op` transform self in a `CAS::Const` and return a symbolic operation.
-
#**(a) ⇒ Object
If ‘a` is a `CAS::Op` transform self in a `CAS::Const` and return a symbolic operation.
-
#+(a) ⇒ Object
If ‘a` is a `CAS::Op` transform self in a `CAS::Const` and return a symbolic operation.
-
#-(a) ⇒ Object
If ‘a` is a `CAS::Op` transform self in a `CAS::Const` and return a symbolic operation.
-
#/(a) ⇒ Object
If ‘a` is a `CAS::Op` transform self in a `CAS::Const` and 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
64 65 66 67 |
# File 'lib/overloading/float.rb', line 64 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
80 81 82 83 |
# File 'lib/overloading/float.rb', line 80 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
48 49 50 51 |
# File 'lib/overloading/float.rb', line 48 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
56 57 58 59 |
# File 'lib/overloading/float.rb', line 56 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
72 73 74 75 |
# File 'lib/overloading/float.rb', line 72 def /(a) return (CAS::const(self) / a) if a.is_a? CAS::Op self.overloaded_div a end |
#overloaded_div ⇒ Object
40 |
# File 'lib/overloading/float.rb', line 40 alias :overloaded_div :/ |
#overloaded_minus ⇒ Object
38 |
# File 'lib/overloading/float.rb', line 38 alias :overloaded_minus :- |
#overloaded_mul ⇒ Object
39 |
# File 'lib/overloading/float.rb', line 39 alias :overloaded_mul :* |
#overloaded_plus ⇒ Object
Setting aliases
37 |
# File 'lib/overloading/float.rb', line 37 alias :overloaded_plus :+ |
#overloaded_pow ⇒ Object
41 |
# File 'lib/overloading/float.rb', line 41 alias :overloaded_pow :** |