/biginteger-for-eosio

Integer library with unlimited precision for EOS.IO Smart Contract

Primary LanguageC++

BigInteger for EOS.IO

BigInteger library for EOS Smart Contract

Table of contents

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 4.x . See EOSIO github.

Original author

Matt McCutchen ( C++ Big Integer Library )

Example


 #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.

Operators


arithmetic : +, -, *, /, %, ++(pre, post), --(pre, post), +=, -=, *=, /=, %=, etc.. ( see header for more details )
bit : &, |, ^, <<=, >>= , etc.. ( see header for more details ) 

Build

`eosio-cpp -o <wastOutput.wast> <yourContractSrc.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;