Instance Method

isLessThanOrEqualTo(_:)

IEEE 754 less-than-or-equal predicate.

Declaration

func isLessThanOrEqualTo(_ other: CGFloat) -> Bool

Discussion

NaN compares not less than or equal to anything, including itself. -infinity compares less than or equal to everything except NaN. Everything except NaN compares less than or equal to +infinity.

Because of the existence of NaN in FloatingPoint types, trichotomy does not hold, which means that x < y and !(y <= x) are not equivalent. This is why isLessThanOrEqualTo(_:) is a separate implementation hook in the protocol.

Note that this predicate does not impose a total order. The isTotallyOrdered predicate refines this relation so that all values are totally ordered.

Relationships

From Protocol