src/intobject/ops

Source   Edit  

Types

IntObjectFromStrError {.pure.} = enum
  Ok, InvalidBase = "int() arg 2 must be >= 2 and <= 36",
  InvalidLiteral = "invalid literal for int() with base", ExceedsMaxStrDigits = "exceeds maximum string digits allowed in int() conversion"
Source   Edit  

Consts

PyLongBaseSet = {0, 2..36}
Source   Edit  

Procs

proc `'iobj`[C: Rune | char](str: openArray[C]): IntObject
Source   Edit  
proc fromStr[C: char](res: var IntObject; s: openArray[C]; nParsed: var int): IntObjectFromStrError
Source   Edit  
proc fromStr[C: char](res: var IntObject; s: openArray[C]; nParsed: var int;
                      base: int): IntObjectFromStrError
Source   Edit  
proc fromStrWithValidBase[C: char](res: var IntObject; s: openArray[C];
                                   nParsed: var int; base: int): IntObjectFromStrError
Source   Edit  
proc newInt[C: char](smallInt: C): IntObject
Source   Edit  
proc newInt[C: Rune | char](str: openArray[C]): IntObject
Source   Edit  
proc newIntFromNormalFloat(dval: float): IntObject {....raises: [], tags: [],
    forbids: [].}
PyLong_FromDouble, but assumes dval is normal (not inf or nan) Source   Edit  
proc parseInt[C: char | Rune](s: openArray[C]; res: var IntObject): int
with base = 0 (a.k.a. support prefix like 0b) and ignore get_intobject_state().max_str_digits Source   Edit  
proc parseIntObject[C: char | Rune](s: openArray[C]): IntObject {.
    ...raises: [ValueError].}
This ignores get_intobject_state().max_str_digits Source   Edit