Skip to main content

C++ port of the C# BigInteger class

Project description

BigIntegerCpp

CircleCI

A C++ port of the C# BigInteger class, with bindings for Python.

Building

The default configuration builds a shared library

mkdir build
cd build
cmake ..
cmake --build .

Build options

You can define various options during the configure stage to control the output

Var Default Comment
BIGINTEGER_BUILD_SHARED_LIB ON
BIGINTEGER_BUILD_STATIC_LIB OFF
BIGINTEGER_BUILD_TESTING OFF

Building the bindings

Read here.

Running the tests

Test can be ran as follows

cmake -D BUILD_TESTING=ON ..
cmake --build .
./tests/unit_tests

The output should be similar to

...

[ RUN      ] properties.RunMinusOneTests
[       OK ] properties.RunMinusOneTests (2 ms)
[----------] 3 tests from properties (7 ms total)
[----------] Global test environment tear-down
[==========] 117 tests from 22 test suites ran. (17481 ms total)
[  PASSED  ] 117 tests.

Including in your CMake project

The project can be included in 2 ways

add_subdirectory(BigIntegerCpp)

or if it has been installed via make install you can use

find_library(bigintegercpp)

It is possible to build both a SHARED and STATIC library simultaneously, as such 2 link targets exists to differentiate between them, respectively

BigIntegerCpp::BigIntegerCpp
BigIntegerCpp::BigIntegerCpp-static

To use in your target add

target_include_directories(your_target PUBLIC ${bigintegercpp_INCLUDE_DIRS})
target_link_libraries(your_target PRIVATE BigIntegerCpp::BigIntegerCpp)

Source.cpp

#include <bigintegercpp/BigInteger.h>

FAQ

  1. Why this project?

    It is purpose build for use in relationship to the NEO blockchain project. In order to create a compliant port of their virtual machine a need for a compliant BigInteger implementation exists. Any difference, in for example the modulo implementation, can result in VM execution deviation. This is just one of the many problems we've encountered after attemping to wrap Python's native int to produce identical behaviour.

  2. Should I use this project?

    If you have to ask this question, then no.

  3. How fast is it?

    We don't know. The focus has been on conformity to the C# BigInteger class, not on speed. If you want speed you might want to look at https://gmplib.org/

  4. Are there any known behavioural deviations from the C# implementation?

    The only known deviations are in the string parsing and conversion to string methods. Specifically, the overloads with IFormatProvider are not supported. Only base10 parsing is supported. String input may be prepended with + or -. Any whitespace is considered the end of the input.

    Deviations in any other parts are considered bugs. Please report them.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pybiginteger-1.2.7-cp310-cp310-win_amd64.whl (123.3 kB view details)

Uploaded CPython 3.10Windows x86-64

pybiginteger-1.2.7-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (153.9 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

pybiginteger-1.2.7-cp310-cp310-macosx_11_0_arm64.whl (117.8 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pybiginteger-1.2.7-cp310-cp310-macosx_10_9_x86_64.whl (130.2 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

pybiginteger-1.2.7-cp39-cp39-win_amd64.whl (120.2 kB view details)

Uploaded CPython 3.9Windows x86-64

pybiginteger-1.2.7-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (151.2 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.12+ x86-64

pybiginteger-1.2.7-cp39-cp39-macosx_10_9_x86_64.whl (131.9 kB view details)

Uploaded CPython 3.9macOS 10.9+ x86-64

pybiginteger-1.2.7-cp38-cp38-win_amd64.whl (123.3 kB view details)

Uploaded CPython 3.8Windows x86-64

pybiginteger-1.2.7-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (150.9 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.12+ x86-64

pybiginteger-1.2.7-cp38-cp38-macosx_10_9_x86_64.whl (131.8 kB view details)

Uploaded CPython 3.8macOS 10.9+ x86-64

File details

Details for the file pybiginteger-1.2.7-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pybiginteger-1.2.7-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 f1d173fabcbf2903404a3956dbf81474a974e205a54bb76b7230c9762fdab8e8
MD5 09d09bf8807a035d38a46211511f6083
BLAKE2b-256 291e6803b1918a9cb51894ba5aca4cdc66d567b56933ef9ab2e945e1d92b01dd

See more details on using hashes here.

File details

Details for the file pybiginteger-1.2.7-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pybiginteger-1.2.7-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e744c4d028be1e2a52bb3b88f2c414dad5f2793e50371c9e379b67c73884b047
MD5 cb07f97b3257104b2c4894e112f0a3f5
BLAKE2b-256 a3d3a27e932c1d2616a7125970a7b232c30202748e36f8af038d753eafcb7fd7

See more details on using hashes here.

File details

Details for the file pybiginteger-1.2.7-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pybiginteger-1.2.7-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cc89b1a7eec7fc4a438c9ce6e5a08b64e22122e1c727b9f744854e31a32f7c5a
MD5 6d7d252a31240832748e8dfeae7ea41c
BLAKE2b-256 ef943118e0e010d24ef57c7a944d7250648498b8b622846da7bc6833ebe74dcc

See more details on using hashes here.

File details

Details for the file pybiginteger-1.2.7-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pybiginteger-1.2.7-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f658ce9635edbc78224e6465a1d6c9ddcc9e11bdaef78ad85895498dc43eaa90
MD5 09f7112a2e3f4f2aaa850280497675dc
BLAKE2b-256 ed2fa54e76b28317a229e4a048ab6ef42f70a054cd7e6ecccb49b706c5aa4760

See more details on using hashes here.

File details

Details for the file pybiginteger-1.2.7-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: pybiginteger-1.2.7-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 120.2 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.9

File hashes

Hashes for pybiginteger-1.2.7-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 745194b51d7f903f67a739c156f3ad52bcf9a919f70ecd4898b745280791cc35
MD5 ae9ca127ef4ce92ad013426fee758236
BLAKE2b-256 6c1ac2ccb1ffd1a16dd7a51f5b1b0ce2bdc1637a91202d0a7f3627d5506a657f

See more details on using hashes here.

File details

Details for the file pybiginteger-1.2.7-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for pybiginteger-1.2.7-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 71534e35ea3556637194b189767e5fc986241e58f5b5fa33f9c9e5c0e9bd335a
MD5 d0fea6dc2bdb3baa8609efda2a172d63
BLAKE2b-256 8e4b8e0b946a0b06220ed6700e2b7b02e4d589869dabdac4f6580bafe21de31a

See more details on using hashes here.

File details

Details for the file pybiginteger-1.2.7-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pybiginteger-1.2.7-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 896c63eb1dac33e237c0d3e1b0c4b5dd1777e5afc894f78b5fef939b816c851e
MD5 e08cdf16e7b1ce894a561d23b5fbba0e
BLAKE2b-256 4644a9f056a33d5aab9452ec29785a055b2f56350a0a1f957ea33d672c4251e2

See more details on using hashes here.

File details

Details for the file pybiginteger-1.2.7-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: pybiginteger-1.2.7-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 123.3 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.9

File hashes

Hashes for pybiginteger-1.2.7-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 4d496c0909075538d8dd5df99607580e01a5ee75f807d219db0cd22903fae5f3
MD5 9170ddd6f52f9bd7edfe73dec7474b59
BLAKE2b-256 de3d262dea7c673fffbf2cfac2b1ac5eeb1167843f9ab7b38f8a2c755f7e16a8

See more details on using hashes here.

File details

Details for the file pybiginteger-1.2.7-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for pybiginteger-1.2.7-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 35180e5275ad504ae528678c83473e686d9954c52a9b471cae6916dd1d3320cd
MD5 40dec50007488e6c7f2cd4414dbb46e3
BLAKE2b-256 db801f1040bb4f3eda8ec947d36af12d8b7f45058f3a7711129932df1d0aacf8

See more details on using hashes here.

File details

Details for the file pybiginteger-1.2.7-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pybiginteger-1.2.7-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ebd87c571fbb4ad96e14f339e1a06965e1cd5d35fbe1a7112d5b77d16f3c5f4f
MD5 4381dafc8d3f1d8b1445af68919dda04
BLAKE2b-256 ae2ebeb64e07e725d43b233690c3351b57f4b633cade11d1199b729bd8889f2e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page