RationalArithmetic
public protocol RationalArithmetic : ExpressibleByFloatLiteral, IntegralArithmetic
A type that can be used for rational arithmetic.
Conformance Requirements:
IntegralArithmeticExpressibleByFloatLiteralstatic func ÷= (lhs: inout Self, rhs: Self)
-
÷(_:_:)Default implementationReturns the (rational) quotient of the left divided by the right.
Mutating variant
×
Recommended over
/
Default Implementation
Returns the (rational) quotient of the left divided by the right.
Mutating variant
×
Recommended over
/
Declaration
Swift
static func ÷ (lhs: Self, rhs: Self) -> SelfParameters
lhsThe dividend.
rhsThe divisor.
-
÷=(_:_:)Default implementationModifies the left by dividing it by the right.
Nonmutating variant
÷
Recommended over
/=
Default Implementation
Modifies the left by dividing it by the right.
Nonmutating variant
÷
Recommended over
/=
Declaration
Swift
static func ÷= (lhs: inout Self, rhs: Self)Parameters
lhsThe value to modify.
rhsThe divisor.
-
init(randomInRange:)Default implementationCreates a random value within a particular range.
Default Implementation
Creates a random value within a particular range.
Declaration
Swift
init(randomInRange range: Range<Self>)Parameters
rangeThe allowed range for the random value.
-
init(randomInRange:fromRandomizer:)Default implementationCreates a random value within a particular range using the specified randomizer.
Default Implementation
Creates a random value within a particular range using the specified randomizer.
Declaration
Swift
init(randomInRange range: Range<Self>, fromRandomizer randomizer: Randomizer)Parameters
rangeThe allowed range for the random value.
randomizerThe randomizer to use to generate the random value.
View on GitHub
RationalArithmetic Protocol Reference