Type Method 型メソッド

minimumMagnitude(_:_:)

Returns the value with lesser magnitude. より小さい規模を持つ値を返します。

Declaration 宣言

static func minimumMagnitude(_ x: Float, _ y: Float) -> Float

Parameters パラメータ

x

A floating-point value. ある浮動小数点値。

y

Another floating-point value. もう1つの浮動小数点値。

Return Value 戻り値

Whichever of x or y has lesser magnitude, or whichever is a number if the other is NaN. xyのどちらがより小さい規模を持つか、または他方がNaNならば数である方。

Discussion 解説

This method returns the value with lesser magnitude of the two given values, preserving order and eliminating NaN when possible. For two values x and y, the result of minimumMagnitude(x, y) is x if x.magnitude <= y.magnitude, y if y.magnitude < x.magnitude, or whichever of x or y is a number if the other is a quiet NaN. If both x and y are NaN, or either x or y is a signaling NaN, the result is NaN. このメソッドは、2つの与えられた値のうちより小さい規模を持つ値を返します、可能な場合は桁数の保全およびNaNの排除をします。2つの値xyに対して、minimumMagnitude(x, y)の結果はx.magnitude <= y.magnitudeならばxy.magnitude < x.magnitudeならばy、または他のものがクワイエットNaNならばxyどちらか数である方です。xyの両方がNaN、またはxまたはyのどちらかがシグナルNaNならば、結果はNaNです。


Double.minimumMagnitude(10.0, -25.0)
// 10.0
Double.minimumMagnitude(10.0, .nan)
// 10.0
Double.minimumMagnitude(.nan, -25.0)
// -25.0
Double.minimumMagnitude(.nan, .nan)
// nan

The minimumMagnitude method implements the minNumMag operation defined by the IEEE 754 specification. minimumMagnitudeメソッドは、IEEE 754仕様によって定義されるminNumMag演算を実装します。

See Also 参照

Comparing Values 値の比較