GnuCash
5.6-150-g038405b370+
|
provides a 125-bit int as a base class for GncNumeric. More...
Data Structures | |
class | GncInt128 |
Functions | |
GncInt128 | operator+ (GncInt128 a, const GncInt128 &b) noexcept |
GncInt128 | operator- (GncInt128 a, const GncInt128 &b) noexcept |
GncInt128 | operator* (GncInt128 a, const GncInt128 &b) noexcept |
GncInt128 | operator/ (GncInt128 a, const GncInt128 &b) noexcept |
GncInt128 | operator% (GncInt128 a, const GncInt128 &b) noexcept |
GncInt128 | operator & (GncInt128 a, const GncInt128 &b) noexcept |
GncInt128 | operator| (GncInt128 a, const GncInt128 &b) noexcept |
GncInt128 | operator^ (GncInt128 a, const GncInt128 &b) noexcept |
GncInt128 | operator<< (GncInt128 a, unsigned int b) noexcept |
GncInt128 | operator>> (GncInt128 a, unsigned int b) noexcept |
bool | operator== (const GncInt128 &a, const GncInt128 &b) noexcept |
bool | operator!= (const GncInt128 &a, const GncInt128 &b) noexcept |
bool | operator<= (const GncInt128 &a, const GncInt128 &b) noexcept |
bool | operator>= (const GncInt128 &a, const GncInt128 &b) noexcept |
bool | operator< (const GncInt128 &a, const GncInt128 &b) noexcept |
bool | operator> (const GncInt128 &a, const GncInt128 &b) noexcept |
std::ostream & | operator<< (std::ostream &, const GncInt128 &) noexcept |
GncInt128 | gcd (int64_t a, int64_t b) |
Compute the greatest common denominator of two integers. | |
GncInt128 | lcm (int64_t a, int64_t b) |
Compute the least common multiple of two integers. | |
provides a 125-bit int as a base class for GncNumeric.
In order to make space for the status flags the upper leg is limited to 0x1fffffffffffffff. Attempting to construct a GncInt128 with a larger upper leg will throw a std::overflow_error.
All the usual operators are provided. Only the constructors and explicit integer conversions throw; all other errors are indicated by the overflow and NaN ("Not a Number") flags. Note that performing any operation on an overflowed or NaN Gncint128 will yield an overflowed or NaN result, so calling routines need not check until the end of a chained calculation. GncInt128 uses implicit copy and move constructors and implicit destructor.