Num
Abstract supertype for numeric values.
Methods
abs[N @ Num]() -> N
Returns the magnitude of the value.
Raises OverflowError if the result is not
representable.
Parameters
| Name | Type | Description |
|---|---|---|
self |
N |
Receiver. |
ceil[N @ Num]() -> N
Rounds toward positive infinity.
Parameters
| Name | Type | Description |
|---|---|---|
self |
N |
Receiver. |
clamp[N @ Num] lower upper -> N
Restricts the value to the inclusive interval from lower to upper.
Raises ValueError if lower > upper. If a comparison
is unordered, which input is returned is unspecified.
Parameters
| Name | Type | Description |
|---|---|---|
self |
N |
Receiver. |
lower |
N |
|
upper |
N |
floor[N @ Num]() -> N
Rounds toward negative infinity.
Parameters
| Name | Type | Description |
|---|---|---|
self |
N |
Receiver. |
max[N @ Num] *others -> N
Returns the largest of this value and others.
If a comparison is unordered, which input is returned is unspecified.
Parameters
| Name | Type | Description |
|---|---|---|
self |
N |
Receiver. |
*others |
N |
min[N @ Num] *others -> N
Returns the smallest of this value and others.
If a comparison is unordered, which input is returned is unspecified.
Parameters
| Name | Type | Description |
|---|---|---|
self |
N |
Receiver. |
*others |
N |
round[N @ Num]() -> N
Rounds to the nearest integral value, with halfway cases away from zero.
Parameters
| Name | Type | Description |
|---|---|---|
self |
N |
Receiver. |
signum[N @ Num]() -> N
Returns the signum of the value: negative one, zero, or positive one.
Parameters
| Name | Type | Description |
|---|---|---|
self |
N |
Receiver. |
trunc[N @ Num]() -> N
Rounds toward zero.
Parameters
| Name | Type | Description |
|---|---|---|
self |
N |
Receiver. |