Returns the value with lesser magnitude.
SDK
- Xcode 9.0+
Framework
- Swift Standard Library
Declaration
Parameters
x
A floating-point value.
y
Another floating-point value.
Return Value
Whichever of x
or y
has lesser magnitude, or whichever is a number if the other is 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 minimum
is x
if x
, y
if y
, 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.
The minimum
method implements the min
operation defined by the IEEE 754 specification.