RationalArithmetic

public protocol RationalArithmetic : ExpressibleByFloatLiteral, IntegralArithmetic

A type that can be used for rational arithmetic.

Conformance Requirements:

  • IntegralArithmetic
  • ExpressibleByFloatLiteral
  • static func ÷= (lhs: inout Self, rhs: Self)
  • ÷(_:_:) Default implementation

    Returns the (rational) quotient of the left divided by the right.

    Mutating variant

    ×

    Default Implementation

    Returns the (rational) quotient of the left divided by the right.

    Mutating variant

    ×

    Declaration

    Swift

    static func ÷ (lhs: Self, rhs: Self) -> Self

    Parameters

    lhs

    The dividend.

    rhs

    The divisor.

  • ÷=(_:_:) Default implementation

    Modifies the left by dividing it by the right.

    Nonmutating variant

    ÷

    Default Implementation

    Modifies the left by dividing it by the right.

    Nonmutating variant

    ÷

    Declaration

    Swift

    static func ÷= (lhs: inout Self, rhs: Self)

    Parameters

    lhs

    The value to modify.

    rhs

    The divisor.

  • init(randomInRange:) Default implementation

    Creates 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

    range

    The allowed range for the random value.

  • init(randomInRange:fromRandomizer:) Default implementation

    Creates 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

    range

    The allowed range for the random value.

    randomizer

    The randomizer to use to generate the random value.