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.3.5-cp314-cp314-win_amd64.whl (138.8 kB view details)

Uploaded CPython 3.14Windows x86-64

pybiginteger-1.3.5-cp314-cp314-musllinux_1_2_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.14musllinux: musl 1.2+ x86-64

pybiginteger-1.3.5-cp314-cp314-musllinux_1_2_aarch64.whl (1.1 MB view details)

Uploaded CPython 3.14musllinux: musl 1.2+ ARM64

pybiginteger-1.3.5-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (162.6 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pybiginteger-1.3.5-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (147.1 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.26+ ARM64manylinux: glibc 2.28+ ARM64

pybiginteger-1.3.5-cp314-cp314-macosx_11_0_arm64.whl (127.6 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

pybiginteger-1.3.5-cp314-cp314-macosx_10_15_x86_64.whl (145.1 kB view details)

Uploaded CPython 3.14macOS 10.15+ x86-64

pybiginteger-1.3.5-cp313-cp313-win_amd64.whl (135.0 kB view details)

Uploaded CPython 3.13Windows x86-64

pybiginteger-1.3.5-cp313-cp313-musllinux_1_2_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ x86-64

pybiginteger-1.3.5-cp313-cp313-musllinux_1_2_aarch64.whl (1.1 MB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ ARM64

pybiginteger-1.3.5-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (162.3 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pybiginteger-1.3.5-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (146.8 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.26+ ARM64manylinux: glibc 2.28+ ARM64

pybiginteger-1.3.5-cp313-cp313-macosx_11_0_arm64.whl (127.1 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pybiginteger-1.3.5-cp313-cp313-macosx_10_13_x86_64.whl (144.5 kB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

File details

Details for the file pybiginteger-1.3.5-cp314-cp314-win_amd64.whl.

File metadata

File hashes

Hashes for pybiginteger-1.3.5-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 15fa279a2b21e25012ecc169b308ef5292423d85152e5dfc49a922f255b823b3
MD5 3d90c472a5fd3fa222466ffbdef449f7
BLAKE2b-256 1c2a97788ac1cfe628aa3e71da525329a7927c5a090ce6963c5205a29906cf3e

See more details on using hashes here.

File details

Details for the file pybiginteger-1.3.5-cp314-cp314-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pybiginteger-1.3.5-cp314-cp314-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 10c733c43401d640bd7ab94dc9b8b72e40dabbdcd7cff331387daf9b8b71e393
MD5 57517e1cd2093bc49fe4e30022b6aeb3
BLAKE2b-256 746cd15e8bbf71ceec7b921cb79f9db8501cfdfce1e37d77bad949036d85955b

See more details on using hashes here.

File details

Details for the file pybiginteger-1.3.5-cp314-cp314-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for pybiginteger-1.3.5-cp314-cp314-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 6384942ebf74958aa351180018464c1eae84adbc33886c17d731e21c452ca8a0
MD5 5a47244c7b76097fdf0dcacdf02f876a
BLAKE2b-256 3010bb943c3de29bd77052dcbaa1e2a18a1317f631b7257db08e873eccbb895d

See more details on using hashes here.

File details

Details for the file pybiginteger-1.3.5-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pybiginteger-1.3.5-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 43749677c5a104ddc01ae0f1c75f00d1ae6c426a48ec75bb8fa38d0dd91333c9
MD5 5e085641229e51ca922bc00cd5c4248e
BLAKE2b-256 be4a2a3765d149a71ecffe2982a037de2a8ec3df7367daf5fa6bb99426154484

See more details on using hashes here.

File details

Details for the file pybiginteger-1.3.5-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for pybiginteger-1.3.5-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 399a288ba547025d6b91691e33d039ee170d05c1e0a100a291b75ef1b620b1e3
MD5 be5b641bf1035ed27a442dd1d8b186d8
BLAKE2b-256 2eca9341a0827142a3394ebb79e1a6fae760e6dc52d05cc2fd643305127fdf8c

See more details on using hashes here.

File details

Details for the file pybiginteger-1.3.5-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pybiginteger-1.3.5-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ab6d4ac09212f3f61c0bccb8f0f162322508a3824bf71a5c0d0c77165bc97c10
MD5 d5501f12826000109dfc7d6cf597b829
BLAKE2b-256 62e7cb1da9c7aab591adc2863fc7bc5e08be1fb2759c48172baf69f850763c86

See more details on using hashes here.

File details

Details for the file pybiginteger-1.3.5-cp314-cp314-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for pybiginteger-1.3.5-cp314-cp314-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 79f3e73dcb30d8f9598e4c62ddf273ad9354265c1775260482f6752f3b1a447c
MD5 ce746630baa7434d9697b4b78f5d302f
BLAKE2b-256 70a209f71f775a7ab37282ef109b4bc5f30d60226b7dba5a5000bba3b4522069

See more details on using hashes here.

File details

Details for the file pybiginteger-1.3.5-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pybiginteger-1.3.5-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 e67679f763f0bde009d78fe1c833c597847b52b8e4afb7e213793d6372788e98
MD5 e3dd233e6657dcb10bb6e45190dcc18c
BLAKE2b-256 eaef5479c9ec667f117c5ca4b21da2257250e98d1f0978f6142c8006001205ea

See more details on using hashes here.

File details

Details for the file pybiginteger-1.3.5-cp313-cp313-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pybiginteger-1.3.5-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 4a33c7878aac2167fae7b1675855521557654da11708ac611f1ab379a6c9fab0
MD5 b7692c674a088abf94ae7569a48e3ce0
BLAKE2b-256 c3d963add8e1ff89ec6966a85202884c9e931c7f72384bf03caf38e3ca0c5f64

See more details on using hashes here.

File details

Details for the file pybiginteger-1.3.5-cp313-cp313-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for pybiginteger-1.3.5-cp313-cp313-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 296b394d93f57db262050d7be6606ebac9b63555bffdd00912e13008fcf8faaa
MD5 8c7b5bfd2b45ca5a58f834f33b1cf062
BLAKE2b-256 80d528231a183ecb11467e97de5bc1f528980ee46d5d8afbc736740454c16444

See more details on using hashes here.

File details

Details for the file pybiginteger-1.3.5-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pybiginteger-1.3.5-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 29f207e8a6ab8b18d415a8333ce129e805cd29237d7ba832e2d112ca2c102bb8
MD5 93124b24f83437ee125b8a132a29b65c
BLAKE2b-256 188028e765e5f761fef0bff66bf16134eb6f320c64b28fef448c981161e13300

See more details on using hashes here.

File details

Details for the file pybiginteger-1.3.5-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for pybiginteger-1.3.5-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 f4d0fa63831cfd0b73f168c1c5f7cb807ce086f1989c87c113db2d5f7b536f08
MD5 6db2dd6af8ef68606b37706f13998ab3
BLAKE2b-256 0780599ae4b697192ae21f377e911449b42fb65fd1cd7f5e0c5357271d2dfac7

See more details on using hashes here.

File details

Details for the file pybiginteger-1.3.5-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pybiginteger-1.3.5-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d87ca59f636bb5cdd41a061d912d302914a383fb8fb61997db19bc3d23509ab3
MD5 0997b9fcf49148e5c0d3b44b4d359f06
BLAKE2b-256 f49af9b80f5b53296b4bae09fbf020386309483bf9ced46aeed65805311a0c38

See more details on using hashes here.

File details

Details for the file pybiginteger-1.3.5-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for pybiginteger-1.3.5-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 d4cb1e181183963c9291e2135cdc63c846504ba9530baa5010f84441a1302d21
MD5 7f19e6510e98dbf28b7d459bd3d6b9d8
BLAKE2b-256 76fa22bca3665fe647224cfe7fc92299c8e72c13f23218e6bf110dedf8f790e2

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