protocol
SignedNumber
Inheritance |
Comparable, Equatable, ExpressibleByIntegerLiteral
View Protocol Hierarchy →
|
---|---|
Associated Types |
1 inherited item hidden. (Show all) |
Import |
|
Initializers
Create an instance initialized to value
.
Declaration
init
(
integerLiteral
value
:
Self
.
IntegerLiteralType
)
Declared In
ExpressibleByIntegerLiteral
1 inherited item hidden. (Show all)
Instance Methods
Returns a Boolean value indicating whether the value of the first argument is less than that of the second argument.
This function is the only requirement of the Comparable
protocol. The
remainder of the relational operator functions are implemented by the
standard library for any type that conforms to Comparable
.
Parameters: lhs: A value to compare. rhs: Another value to compare.
Declaration
func
<
(
lhs
:
Self
,
rhs
:
Self
) -
>
Bool
Declared In
Comparable
Returns a Boolean value indicating whether the value of the first argument is less than or equal to that of the second argument.
Parameters: lhs: A value to compare. rhs: Another value to compare.
Declaration
func
<
=(
lhs
:
Self
,
rhs
:
Self
) -
>
Bool
Declared In
Comparable
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
Returns a Boolean value indicating whether the value of the first argument is greater than that of the second argument.
Parameters: lhs: A value to compare. rhs: Another value to compare.
Declaration
func
>
(
lhs
:
Self
,
rhs
:
Self
) -
>
Bool
Declared In
Comparable
Returns a Boolean value indicating whether the value of the first argument is greater than or equal to that of the second argument.
Parameters: lhs: A value to compare. rhs: Another value to compare.
Declaration
func
>
=(
lhs
:
Self
,
rhs
:
Self
) -
>
Bool
Declared In
Comparable
Returns the result of negating x
.
Declaration
prefix
func
-(
x
:
Self
) -
>
Self
Returns the difference between lhs
and rhs
.
Declaration
func
-(
lhs
:
Self
,
rhs
:
Self
) -
>
Self
5 inherited items hidden. (Show all)
Instances of conforming types can be subtracted, arithmetically negated, and initialized from
0
.Axioms:
x - 0 == x
-x == 0 - x
-(-x) == x