Module: Hornetseye::FLOAT_::Match
- Included in:
- Node
- Defined in:
- lib/multiarray/float.rb
Overview
Namespace containing method for matching elements of type FLOAT_
Instance Method Summary collapse
-
#align(context) ⇒ Object
Perform type alignment.
-
#fit(*values) ⇒ Class
Method for matching elements of type FLOAT_.
Instance Method Details
#align(context) ⇒ Object
Perform type alignment
Align this type to another. This is used to prefer single-precision floating point in certain cases.
203 204 205 206 207 208 209 |
# File 'lib/multiarray/float.rb', line 203 def align( context ) if self < FLOAT_ and context < FLOAT_ context else super context end end |
#fit(*values) ⇒ Class
Method for matching elements of type FLOAT_
183 184 185 186 187 188 189 190 191 192 193 |
# File 'lib/multiarray/float.rb', line 183 def fit( *values ) if values.all? { |value| value.is_a? Float or value.is_a? Integer } if values.any? { |value| value.is_a? Float } DFLOAT else super *values end else super *values end end |