Procs
proc `%`(a, b: PyIntObject): PyObject {.cdecl, ...raises: [], tags: [RootEffect], forbids: [].}
-
Note: this returns ZeroDivisionError when b is zeroSource Edit
proc `//`(a, b: PyIntObject): PyObject {.cdecl, ...raises: [], tags: [RootEffect], forbids: [].}
-
Note: this returns ZeroDivisionError when b is zeroSource Edit
proc `div`(a, b: PyIntObject): PyIntObject {....raises: [], tags: [RootEffect], forbids: [].}
-
Note: this raises DivByZeroDefect when b is zeroSource Edit
proc divmod(x, y: PyIntObject): PyObject {....raises: [], tags: [RootEffect], forbids: [].}
- long_divmod. which returns ZeroDivisionError when y is zero Source Edit
proc divmodNonZero(a, b: PyIntObject): tuple[d, m: PyIntObject] {....raises: [], tags: [RootEffect], forbids: [].}
- export for builtins.divmod Source Edit
proc divrem(a, b: PyIntObject): tuple[d, r: PyIntObject] {....raises: [], tags: [RootEffect], forbids: [].}
-
Hint: this raises DivByZeroDefect when b is zeroSource Edit
proc floordiv(a, b: PyIntObject): PyIntObject {.inline, ...raises: [], tags: [RootEffect], forbids: [].}
- Source Edit
proc floordivNonZero(a, b: PyIntObject): PyIntObject {....raises: [], tags: [RootEffect], forbids: [].}
-
Integer division
assuming b is non-zero
Source Edit proc floormod(a, b: PyIntObject): PyIntObject {.inline, ...raises: [], tags: [RootEffect], forbids: [].}
- Source Edit
proc floormodNonZero(a, b: PyIntObject): PyIntObject {....raises: [], tags: [RootEffect], forbids: [].}
-
Integer division
assuming b is non-zero
Source Edit proc format(i: PyIntObject; base: uint8; s: var string): PyBaseErrorObject {. ...raises: [], tags: [RootEffect], forbids: [].}
- Source Edit
proc format_binary(a: PyIntObject; base: uint8; alternate: bool; v: var string): PyBaseErrorObject {. ...raises: [], tags: [RootEffect], forbids: [].}
- long_format_binary Source Edit
proc fromStr[C: char](res: var PyIntObject; s: openArray[C]; nParsed: var int; base: int = 10): PyBaseErrorObject
- Source Edit
proc `mod`(a, b: PyIntObject): PyIntObject {....raises: [], tags: [RootEffect], forbids: [].}
-
Note: this raises DivByZeroDefect when b is zeroSource Edit
proc `mod`(a: PyIntObject; n: TwoDigits | SomeUnsignedIntSmallerThanTwoDigits): PyIntObject
-
Get the remainder of an integer divided by a fixed-width integer. The sign of a is ignored; n should not be zero.Hint: Other mixin ops against fixed-width integer are implemented in ops_mix_nim.nim<./ops_mix_nim.html>_Source Edit
proc n_divmod(a, b: PyIntObject): tuple[d, m: PyIntObject] {....raises: [], tags: [RootEffect], forbids: [].}
-
Hint: this raises DivByZeroDefect when b is zeroSource Edit
proc newPyInt[C: char](smallInt: C): PyIntObject
- Source Edit
proc newPyInt[C: Rune | char](str: openArray[C]): PyIntObject
- Source Edit
proc newPyIntFromStr[C: char | Rune](s: openArray[C]): PyIntObject {. ...raises: [ValueError].}
- This ignores sys.flags.int_max_str_digits Source Edit
proc parseInt[C: char | Rune](s: openArray[C]; res: var PyIntObject): int
- with base = 0 (a.k.a. support prefix like 0b) and ignore sys.flags.int_max_str_digits Source Edit
proc pow(a, b, c: PyIntObject): PyObject {....raises: [], tags: [RootEffect], forbids: [].}
- Source Edit
proc pow(a, b: PyIntObject): PyObject {....raises: [], tags: [RootEffect], forbids: [].}
-
returns:
- int if b >= 0
- float if b < 0
proc powNeg(a, b: PyIntObject): PyObject {....raises: [], tags: [RootEffect], forbids: [].}
- Source Edit
proc powPos(a, b: PyIntObject): PyIntObject {.inline, ...raises: [], tags: [RootEffect], forbids: [].}
- Source Edit
proc PyLong_FromString[C: char](s: openArray[C]; nParsed: var int; base: int = 10): PyObject
- Source Edit
proc round(x: PyIntObject; n: PyIntObject): PyIntObject {....raises: [], tags: [RootEffect], forbids: [].}
- long_round Source Edit
proc toStringCheckThreshold(a: PyIntObject; v: var string): PyBaseErrorObject {. ...raises: [], tags: [RootEffect], forbids: [].}
- this respects sys.flags.int_max_str_digits Source Edit
Methods
method `$`(i: PyIntObject): string {....raises: [], tags: [], forbids: [].}
- this ignores sys.flags.int_max_str_digits, and may raises OverflowDefect if i contains too many digits Source Edit
Templates
template get_max_str_digits(): int
- Source Edit
template retInvIntCall(strObj: PyObject; base: SomeInteger) {.dirty.}
- inner Source Edit
Exports
-
newPyIntSimple, digitPyLong_DECIMAL_BASE, toFloat, toFloat, PyIntObject, negate, ofPyIntObject, frexp, sign, newPyInt, newPyInt, newPyIntFromPtr, setSignNegative, newPyInt, newPyInt, negative, toFloat, pyIntObjectType, zero, newPyInt, newPyIntFromPtr, ofExactPyIntObject, toFloat, positive, flipSign, numbits, bit_count, bit_length, digitCount, flipSign, setSignNegative, positive, zero, negative, negate, ==, abs, *, +, -, -, <, PyLong_AsSsize_t, toFloat, newPyIntFromPtr, absToUInt, toIntOrRetOF, hash, pyIntObjectType, toFloat, zero, newPyInt, flipSign, bit_count, toInt, digitPyLong_DECIMAL_BASE, toUInt, newPyIntFromPtr, newPyInt, PyIntObject, ofExactPyIntObject, positive, toInt, newPyIntSimple, numbits, frexp, PyLong_AsSize_t, negate, newPyInt, toSomeSignedInt, PyInt_OverflowCType, bit_length, toUInt, PyLong_AsSize_t, toFloat, sign, ofPyIntObject, toFloat, asLongAndOverflow, toSomeUnsignedInt, newPyInt, PyLong_AsSsize_t, setSignNegative, digitCount, newPyInt, toSomeSignedIntUnsafe, negative, pyIntZero, pyIntOne, pyIntTen