Returns true if this value is a multiple of the given value, and false otherwise.
SDK
- Xcode 10.2+
Framework
- Swift Standard Library
Declaration
Parameters
otherThe value to test.
Discussion
For two integers a and b, a is a multiple of b if there exists a third integer q such that a = q*b. For example, 6 is a multiple of 3 because 6 = 2*3. Zero is a multiple of everything because 0 = 0*x for any integer x.
Two edge cases are worth particular attention:
xis.is Multiple(of: 0) trueifxis zero andfalseotherwise.Tis.min .is Multiple(of: -1) truefor signed integerT, even though the quotientTisn’t representable in type.min / -1 T.
Note
This documentation comment was inherited from Binary.