bigints

Arbitrary-precision integers

Pure Nim score 15/100 · tests present · no docs generated

Summary

Latest Version Unknown
License MIT
CI Status Failing
Downloads 0
Last Indexed 2026-07-21 05:23

Installation

nimble install bigints
choosenim install bigints
git clone https://github.com/nim-lang/bigints

OS Compatibility

Platform Linux macOS Windows FreeBSD OpenBSD NetBSD Android iOS WASM Embedded
bigints - - - - - - -

Source

Repository https://github.com/nim-lang/bigints
Homepage https://github.com/nim-lang/bigints
Registry Source nimble_official

README

Pure BigInts for Nim

test

This library provides a pure implementation for arbitrary precision integers in Nim.

It can be installed through nimble with:

nimble install https://github.com/nim-lang/bigints

bigints provides a BigInt type and related operations with standard Nim syntax:

  • creation of BigInt from all standard integer types (initBigInt)
  • comparisons (<, <=, ==)
  • addition, negation and subtraction (+, -, += -=)
  • multiplication (*, *=)
  • bit shifts (shr, shl)
  • bitwise not, and, or and xor (behave as if negative numbers were represented in 2's complement)
  • integer division and modulo operation (div, mod)
  • conversion of BigInt from/to strings supporting bases from 2 to 36 (initBigInt, $)
  • iteration utilities (inc, dec, countdown, countup, .., ..<)

Current limitations and possible enhancements

  • not expected to work on 32 bit
  • arithmetic operations such as addition, multiplication and division are not optimized for performance (e.g. Karatsuba multiplication is not implemented)

Documentation

The documentation is available at https://nim-lang.github.io/bigints.