FloatingPoint
protocol FloatingPoint : SignedNumeric, Strideable, Hashable
-
Creates a new floating-point value from the given rational value, after rounding the whole part, the numerator of the fractional part, and the denominator of the fractional part each to the closest possible representation.
If two representable values are equally close, the result of rounding is the value with more trailing zeros in its significand bit pattern.
Declaration
Swift
public init(_ source: Rational<Int>)
Parameters
source
-
The rational value to convert to a floating-point value.
-
Creates a new floating-point value from the given rational value, after rounding the whole part, the numerator of the fractional part, and the denominator of the fractional part each to the closest possible representation.
If two representable values are equally close, the result of rounding is the value with more trailing zeros in its significand bit pattern.
Declaration
Swift
public init(_ source: Rational<Int8>)
Parameters
source
-
The rational value to convert to a floating-point value.
-
Creates a new floating-point value from the given rational value, after rounding the whole part, the numerator of the fractional part, and the denominator of the fractional part each to the closest possible representation.
If two representable values are equally close, the result of rounding is the value with more trailing zeros in its significand bit pattern.
Declaration
Swift
public init(_ source: Rational<Int16>)
Parameters
source
-
The rational value to convert to a floating-point value.
-
Creates a new floating-point value from the given rational value, after rounding the whole part, the numerator of the fractional part, and the denominator of the fractional part each to the closest possible representation.
If two representable values are equally close, the result of rounding is the value with more trailing zeros in its significand bit pattern.
Declaration
Swift
public init(_ source: Rational<Int32>)
Parameters
source
-
The rational value to convert to a floating-point value.
-
Creates a new floating-point value from the given rational value, after rounding the whole part, the numerator of the fractional part, and the denominator of the fractional part each to the closest possible representation.
If two representable values are equally close, the result of rounding is the value with more trailing zeros in its significand bit pattern.
Declaration
Swift
public init(_ source: Rational<Int64>)
Parameters
source
-
The rational value to convert to a floating-point value.