class Float

class Float

The same as {Numeric#>} and {Numeric#<}. See them for the background.

Public Instance Methods

<(c) click to toggle source

Special case for comparison with a {RangeExtd::Infinity} instance.

# 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) click to toggle source

Special case for comparison with a {RangeExtd::Infinity} instance.

# 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) click to toggle source

Special case for comparison with a {RangeExtd::Infinity} instance.

# 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?(c)

Backup of the original {Float#<=>}

Alias for: <=>
greater_than_float_before_infinity?(c)

Backup of the original {Float#>}

Alias for: >
less_than_float_before_infinity?(c)

Backup of the original {Float#<}

Alias for: <