Instance Method
インスタンスメソッド
quotientAndRemainder(dividingBy:)
Returns the quotient and remainder of this value divided by the given value.
与えられた値で除算されたこの値の商と余りを返します。
Technology
- Swift Standard Library
Swift標準ライブラリ
Declaration
宣言
func quotientAndRemainder(dividingBy rhs: Int
) -> (quotient: Int
, remainder: Int
)
Parameters
パラメータ
rhs
The value to divide this value by.
この値を除算するための値。
Return Value
戻り値
A tuple containing the quotient and remainder of this value divided by rhs
.
rhs
によって除算されたこの値の商と余りを含んでいるタプル。
Discussion
解説
Use this method to calculate the quotient and remainder of a division at the same time.
このメソッドを使って、除算の商と余りを同時に計算してください。
let x = 1_000_000
let (q, r) = x.quotientAndRemainder(dividingBy: 933)
See Also
参照
Performing Calculations
計算の実行
Integer Operators
整数演算子
Perform arithmetic and bitwise operations or compare values.
算術およびビット単位の演算を実行します、または値を比較します。
func negate()
Replaces this value with its additive inverse.
この値をそれの加法の逆元で置き換えます。
func isMultiple(of: Int) -> Bool
Returns true
if this value is a multiple of the given value, and false
otherwise.
true
をもしこの値がその与えられた値の倍数ならば、そしてfalse
をそうでないならば返します。