src/cplib/math/bigint

  Source   Edit

Types

BigInt = object
  sign: int
  digits: seq[uint32]
  Source   Edit

Procs

proc `$`(x: BigInt): string {....raises: [], tags: [].}
符号付き 10 進文字列を返す。   Source   Edit
proc `*=`(x: var BigInt; y: BigInt) {....raises: [], tags: [].}
右辺を掛ける。   Source   Edit
proc `*`(x, y: BigInt): BigInt {....raises: [], tags: [].}
大きな数は NTT、小さな数や NTT の対応範囲外では筆算で積を返す。   Source   Edit
proc `+=`(x: var BigInt; y: BigInt) {....raises: [], tags: [].}
右辺を加える。   Source   Edit
proc `+`(x, y: BigInt): BigInt {....raises: [], tags: [].}
和を返す。   Source   Edit
proc `+`(x: BigInt): BigInt {....raises: [], tags: [].}
元の値を返す。   Source   Edit
proc `-=`(x: var BigInt; y: BigInt) {....raises: [], tags: [].}
右辺を引く。   Source   Edit
proc `-`(x, y: BigInt): BigInt {....raises: [], tags: [].}
差を返す。   Source   Edit
proc `-`(x: BigInt): BigInt {....raises: [], tags: [].}
符号を反転する。   Source   Edit
proc `<=`(x, y: BigInt): bool {....raises: [], tags: [].}
左辺が右辺以下かを返す。   Source   Edit
proc `<`(x, y: BigInt): bool {....raises: [], tags: [].}
左辺が右辺より小さいかを返す。   Source   Edit
proc `==`(x, y: BigInt): bool {....raises: [], tags: [].}
等しいかどうかを返す。   Source   Edit
proc `>=`(x, y: BigInt): bool {....raises: [], tags: [].}
左辺が右辺以上かを返す。   Source   Edit
proc `>`(x, y: BigInt): bool {....raises: [], tags: [].}
左辺が右辺より大きいかを返す。   Source   Edit
proc `div`(x, y: BigInt): BigInt {....raises: [], tags: [].}
0 方向に丸めた商を返す。   Source   Edit
proc `mod`(x, y: BigInt): BigInt {....raises: [], tags: [].}
被除数と同符号の余りを返す。   Source   Edit
proc abs(x: BigInt): BigInt {....raises: [], tags: [].}
絶対値を返す。   Source   Edit
proc cmp(x, y: BigInt): int {....raises: [], tags: [].}
大小関係を -1, 0, 1 のいずれかで返す。   Source   Edit
proc div=(x: var BigInt; y: BigInt) {....raises: [], tags: [].}
右辺で割った商を代入する。   Source   Edit
proc divmod(x, y: BigInt): tuple[quotient, remainder: BigInt] {....raises: [],
    tags: [].}
0 方向に丸めた商と被除数と同符号の余りを返し、0 除算には DivByZeroDefect を送出する。   Source   Edit
proc gcd(x, y: BigInt): BigInt {....raises: [], tags: [].}
非負の最大公約数を返す。gcd(0, 0) は 0。   Source   Edit
proc hash(x: BigInt): Hash {....raises: [], tags: [].}
多倍長整数のハッシュ値を返す。   Source   Edit
proc initBigInt(s: string): BigInt {....raises: [ValueError], tags: [].}
符号付き 10 進文字列から多倍長整数を作る。   Source   Edit
proc initBigInt[T: SomeInteger](x: T): BigInt
組み込み整数から多倍長整数を作る。   Source   Edit
proc isZero(x: BigInt): bool {....raises: [], tags: [].}
0 かどうかを返す。   Source   Edit
proc lcm(x, y: BigInt): BigInt {....raises: [], tags: [].}
非負の最小公倍数を返す。いずれかが 0 なら 0。   Source   Edit
proc mod=(x: var BigInt; y: BigInt) {....raises: [], tags: [].}
右辺で割った余りを代入する。   Source   Edit
proc parseBigInt(s: string): BigInt {....raises: [ValueError], tags: [].}
符号付き 10 進文字列を変換し、空文字列や不正な文字には ValueError を送出する。   Source   Edit
proc pow(x: BigInt; exponent: int): BigInt {....raises: [ValueError], tags: [].}
非負整数乗を繰り返し二乗法で求め、負の指数には ValueError を送出する。0^0 は 1。   Source   Edit
proc sgn(x: BigInt): int {....raises: [], tags: [].}
符号を -1, 0, 1 のいずれかで返す。   Source   Edit
proc toInt(x: BigInt): int {....raises: [], tags: [].}
int に変換し、範囲外なら OverflowDefect を送出する。   Source   Edit

Converters

converter toBigInt(x: SomeInteger): BigInt
組み込み整数を多倍長整数に暗黙変換する。   Source   Edit