A floating-point value to convert to an integer. source must be representable in this type after rounding toward zero.
整数へと変換する浮動小数点値.sourceは、ゼロへの丸め後にこの型において表現可能でなければなりません。
Discussion
解説
Any fractional part of the value passed as source is removed, rounding the value toward zero.sourceとして渡される値の小数部分は何であれ取り除かれます、値はゼロへと丸められます。
let x =Int(21.5)// x == 21let y =Int(-21.5)// y == -21
If source is outside the bounds of this type after rounding toward zero, a runtime error may occur.sourceがゼロへの丸め後にこの型の境界の外側ならば、実行時エラーが起こるかもしれません。
let z =UInt(-21.5)// Error: ...the result would be less than UInt.min
Creates an integer from the given floating-point value, rounding toward zero. Any fractional part of the value passed as source is removed.
与えられた浮動小数点値から整数を作成します、ゼロへの丸めを行います。sourceとして渡される値の小数部分は何であれ取り除かれます。