BigInteger library for EOS Smart Contract
You can use this library in a EOS Smart contract to do arithmetic without any precision limit.
This library has been tested on EOS.IO DAWN 2.x . See EOSIO github.
Matt McCutchen ( C++ Big Integer Library )
#include "eoslib/print.hpp"
#include "BigIntegerLibrary.hpp"
BigInteger a = 65536;
print("a * a * a * a * a * a * a * a: ", ( a * a * a * a * a * a * a * a ) );
then, eosd prints 340282366920938463463374607431768211456.
arithmetic : +, -, *, /, %, ++(pre, post), --(pre, post), +=, -=, *=, /=, %=, etc.. ( see header for more details )
bit : &, |, ^, <<=, >>= , etc.. ( see header for more details )
eoscpp -o <wastOutput.wast> <yourContractSrc.cpp> eos_mem_wrapper.cpp BigInteger.cpp BigIntegerAlgorithms.cpp BigIntegerUtils.cpp BigUnsigned.cpp BigUnsignedInABase.cpp
If linker complains about memory_heap variable, then change as followings:
find memory_heap
variable in memory.hpp
( eoslib )
then, change :
static memory_manager memory_heap;