SignedArithmetic

protocol SignedArithmetic
Inheritance Arithmetic, Equatable, ExpressibleByIntegerLiteral View Protocol Hierarchy →
Associated Types
Magnitude : Equatable, ExpressibleByIntegerLiteral
IntegerLiteralType

A type that represents an integer literal.

The standard library integer and floating-point types are all valid types for IntegerLiteralType.

Import import Swift

Initializers

init(integerLiteral:)

Creates an instance initialized to the specified integer value.

Do not call this initializer directly. Instead, initialize a variable or constant using an integer literal. For example:

let x = 23

In this example, the assignment to the x constant calls this integer literal initializer behind the scenes.

value: The value to create.

Declaration

init(integerLiteral value: Self.IntegerLiteralType)

Declared In

ExpressibleByIntegerLiteral

Instance Variables

var magnitude: Self.Magnitude Required

Declaration

var magnitude: Self.Magnitude { get }

Declared In

Arithmetic

Instance Methods

func ==(_:rhs:) Required

Returns a Boolean value indicating whether two values are equal.

Equality is the inverse of inequality. For any values a and b, a == b implies that a != b is false.

Parameters: lhs: A value to compare. rhs: Another value to compare.

Declaration

func ==(lhs: Self, rhs: Self) -> Bool

Declared In

Equatable
mutating func add(_:) Required

Declaration

mutating func add(_ rhs: Self)

Declared In

Arithmetic
func adding(_:)

Declaration

func adding(_ rhs: Self) -> Self

Declared In

Arithmetic
mutating func divide(by:) Required

Declaration

mutating func divide(by rhs: Self)

Declared In

Arithmetic
func divided(by:)

Declaration

func divided(by rhs: Self) -> Self

Declared In

Arithmetic
func multiplied(by:)

Declaration

func multiplied(by rhs: Self) -> Self

Declared In

Arithmetic
mutating func multiply(by:) Required

Declaration

mutating func multiply(by rhs: Self)

Declared In

Arithmetic
mutating func negate()

Declaration

mutating func negate()
func negated()

Declaration

func negated() -> Self
mutating func subtract(_:) Required

Declaration

mutating func subtract(_ rhs: Self)

Declared In

Arithmetic
func subtracting(_:)

Declaration

func subtracting(_ rhs: Self) -> Self

Declared In

Arithmetic

Default Implementations

init()

Declaration

init()

Declared In

Arithmetic
init(integerLiteral:)

Create an instance initialized to value.

Declaration

init(integerLiteral value: Self)

Declared In

Arithmetic , ExpressibleByIntegerLiteral
func adding(_:)

Declaration

func adding(_ rhs: Self) -> Self

Declared In

Arithmetic
func divided(by:)

Declaration

func divided(by rhs: Self) -> Self

Declared In

Arithmetic
func multiplied(by:)

Declaration

func multiplied(by rhs: Self) -> Self

Declared In

Arithmetic
mutating func negate()

Declaration

mutating func negate()
func negated()

Declaration

func negated() -> Self
func subtracting(_:)

Declaration

func subtracting(_ rhs: Self) -> Self

Declared In

Arithmetic