Instance Method

# isLess(than:)

Returns a Boolean value indicating whether this instance is less than the given value.

## Parameters

`other`

The value to compare with this value.

## Return Value

`true` if this value is less than `other`; otherwise, `false`. If either this value or `other` is NaN, the result of this method is `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 `false` when called on NaN or when NaN is passed as `other`.

• `-infinity` compares less than all values except for itself and NaN.

• Every value except for NaN and `+infinity` compares 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 `isLess(than:)` method implements the less-than predicate defined by the IEEE 754 specification.

## Relationships

### Comparing Values

Floating-Point Operators for Float

Perform arithmetic and bitwise operations or compare values.

`func isEqual(to: Float) -> Bool`

Returns a Boolean value indicating whether this instance is equal to the given value.

`func isLessThanOrEqualTo(Float) -> Bool`

Returns a Boolean value indicating whether this instance is less than or equal to the given value.

`func isTotallyOrdered(belowOrEqualTo: Float) -> Bool`

Returns a Boolean value indicating whether this instance should precede or tie positions with the given value in an ascending sort.

`static func maximum(Float, Float) -> Float`

Returns the greater of the two given values.

`static func minimum(Float, Float) -> Float`

Returns the lesser of the two given values.