Type Method 型メソッド

maximumMagnitude(_:_:)

Returns the value with greater magnitude. より大きい規模を持つ値を返します。

Declaration 宣言

static func maximumMagnitude(_ 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 greater magnitude, or whichever is a number if the other is NaN. xyのどちらがより大きい規模を持つか、または他方がNaNならば数である方。

Discussion 解説

This method returns the value with greater magnitude of the two given values, preserving order and eliminating NaN when possible. For two values x and y, the result of maximumMagnitude(x, y) is x if x.magnitude > y.magnitude, y if x.magnitude <= y.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に対して、maximumMagnitude(x, y)の結果は、x.magnitude > y.magnitudeならばxx.magnitude <= y.magnitudeならばy、または他のものがクワイエットNaNならばxyどちらか数である方です。xyの両方がNaN、またはxまたはyのどちらかがシグナルNaNならば、結果はNaNです。


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

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

See Also 参照

Comparing Values 値の比較