Generic Initializer
init(_:)
Creates an integer from the given floating-point value, rounding toward zero. Any fractional part of the value passed as source
is removed.
Parameters
source
A floating-point value to convert to an integer. source
must be representable in this type after rounding toward zero.
Discussion
If source
is outside the bounds of this type after rounding toward zero, a runtime error may occur.
See Also
Converting Floating-Point Values
init?<T>(exactly: T)
Creates an integer from the given floating-point value, if it can be represented exactly.
init(Double)
Creates an integer from the given floating-point value, rounding toward zero.
init(Float)
Creates an integer from the given floating-point value, rounding toward zero.
init(CGFloat)
Creates an integer from the given floating-point value, rounding toward zero.
init(Float80)
Creates an integer from the given floating-point value, rounding toward zero.
init?(exactly: Double)
Creates an integer from the given floating-point value, if it can be represented exactly.
init?(exactly: Float)
Creates an integer from the given floating-point value, if it can be represented exactly.