Returns a Boolean value indicating whether this instance is less than the given value.
SDK
- Xcode 8.0+
Framework
- Swift Standard Library
Declaration
Parameters
otherThe value to compare with this value.
Return Value
true if other is less than this value; otherwise, false.
Discussion
This method serves as the basis for the less-than operator (<) for floating-point values. Some special cases apply:
Because NaN compares not less than nor greater than any value, this method returns
falsewhen called on NaN or when NaN is passed asother.-infinitycompares less than all values except for itself and NaN.Every value except for NaN and
+infinitycompares less than+infinity.let x = 15.0 x.isLess(than: 20.0) // true x.isLess(than: .nan) // false Double.nan.isLess(than: x) // false
The is method implements the less-than predicate defined by the IEEE 754 specification.