Instance Method インスタンスメソッド

isLess(than:)

Returns a Boolean value indicating whether this instance is less than the given value. このインスタンスが与えられた値より小さいかどうかを指し示すブール値を返します。

Declaration 宣言

func isLess(than other: Float) -> Bool

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. true、もしこの値がotherより少ないならば;そうでなければ、false。この値またはotherのどちらかがNaNならば、このメソッドの結果は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. NaNはあらゆる値より少なくもないし大きくもないと比較されるので、このメソッドは、NaN上で呼ばれた時またはNaNがotherとして渡された時にfalseを返します。

  • -infinity compares less than all values except for itself and NaN. -infinityは、それ自身とNaNを除くすべての値より少ないと比較されます。

  • Every value except for NaN and +infinity compares less than +infinity. NaNと+infinityを除くあらゆる値は、+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. isLess(than:)メソッドは、IEEE 754仕様によって定義される「より少ない」述部を実装します。

Relationships 関係

From Protocol 由来プロトコル

See Also 参照

Comparing Values 値の比較