Class: Float
Overview
Instance Method Summary collapse
-
#<(c) ⇒ Object
Special case for comparison with a RangeExtd::Infinity instance.
-
#<=>(c) ⇒ Object
Special case for comparison with a RangeExtd::Infinity instance.
-
#>(c) ⇒ Object
Special case for comparison with a RangeExtd::Infinity instance.
-
#compare_than_float_before_infinity? ⇒ Object
Backup of the original #<=>.
-
#greater_than_float_before_infinity? ⇒ Object
Backup of the original #>.
-
#less_than_float_before_infinity? ⇒ Object
Backup of the original #<.
Instance Method Details
#<(c) ⇒ Object
Special case for comparison with a RangeExtd::Infinity instance.
101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/range_extd/numeric.rb', line 101 def <(c) # Default if self is Complex or something not Integer, Rational, Float or alike # or the special case INFINITY. return less_than_float_before_infinity?(c) if ((abs rescue self) == Float::INFINITY) if RangeExtd::Infinity.infinity? c c.positive? else less_than_float_before_infinity?(c) end end |
#<=>(c) ⇒ Object
Special case for comparison with a RangeExtd::Infinity instance.
75 76 77 78 79 80 81 |
# File 'lib/range_extd/numeric.rb', line 75 def <=>(c) # Default if the special case INFINITY. return compare_than_float_before_infinity?(c) if ((abs rescue self) == Float::INFINITY) return (-(c.send(__method__, self) || return)) if RangeExtd::Infinity.infinity? c compare_than_float_before_infinity?(c) end |
#>(c) ⇒ Object
Special case for comparison with a RangeExtd::Infinity instance.
86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/range_extd/numeric.rb', line 86 def >(c) # Default if self is Complex or something not Integer, Rational, Float or alike # or the special case INFINITY. return greater_than_float_before_infinity?(c) if ((abs rescue self) == Float::INFINITY) if RangeExtd::Infinity.infinity? c c.negative? else greater_than_float_before_infinity?(c) end end |
#compare_than_float_before_infinity? ⇒ Object
Backup of the original #<=>
73 |
# File 'lib/range_extd/numeric.rb', line 73 alias_method :compare_than_float_before_infinity?, :<=> |