ledger-core
|
#include <BigInt.hpp>
Public Member Functions | |
virtual std::shared_ptr< BigInt > | add (const std::shared_ptr< BigInt > &i)=0 |
virtual std::shared_ptr< BigInt > | subtract (const std::shared_ptr< BigInt > &i)=0 |
virtual std::shared_ptr< BigInt > | multiply (const std::shared_ptr< BigInt > &i)=0 |
virtual std::shared_ptr< BigInt > | divide (const std::shared_ptr< BigInt > &i)=0 |
virtual std::vector< std::shared_ptr< BigInt > > | divideAndRemainder (const std::shared_ptr< BigInt > &i)=0 |
virtual std::shared_ptr< BigInt > | pow (int32_t exponent)=0 |
virtual std::string | toDecimalString (int32_t precision, const std::string &decimalSeparator, const std::string &thousandSeparator)=0 |
virtual std::string | toString (int32_t radix)=0 |
virtual int32_t | intValue ()=0 |
virtual int32_t | compare (const std::shared_ptr< BigInt > &i)=0 |
Static Public Member Functions | |
static std::shared_ptr< BigInt > | fromDecimalString (const std::string &s, int32_t precision, const std::string &decimalSeparator) |
static std::shared_ptr< BigInt > | fromIntegerString (const std::string &s, int32_t radix) |
static std::shared_ptr< BigInt > | fromLong (int64_t l) |
Immutable class representing a potentially very long number.
|
pure virtual |
|
static |
Creates a BigInt with a decimal string (e.g. "1.2000"). Note that every non numeric characters (except the decimal separator) are ignored (e.g. "1ledger000" will be equal to "1000").
s | The string with the decimal representation of the BigInt |
precision | The power of ten by which your decimal number must be multiplied in order to get his integer representation decimalSeparator The decimal separator used by this string representation |
|
static |
|
static |
|
pure virtual |
Returns the int representation of this BigInt. Note that if the BigInt is greater than 4 bytes the returned value will be meaningless.
Implemented in ledger::core::api::BigIntImpl.
|
pure virtual |
Raises this BigInt with an interger value. i The exponent to which thi BigInt is raised
Implemented in ledger::core::api::BigIntImpl.
|
pure virtual |
Formats this BigInt to a decimal string (e.g. BigInt("12345").toDecimalString(1, ".", ",") => "1,234.5"). precision The power of ten by wich this BigInt is divided decimalSeparator The separator to use between the integer part and the decimal part thousandSeparator The separator to use between each group of thousand units
Implemented in ledger::core::api::BigIntImpl.
|
pure virtual |
Formats this BigInt to the interger representation of its internal value. radix The radix of the number representation in which to format (right now 10 or 16)
Implemented in ledger::core::api::BigIntImpl.