1 #ifndef POINCARE_INTEGER_H 2 #define POINCARE_INTEGER_H 13 struct IntegerDivision;
31 Integer(
const char * digits,
bool negative =
false);
32 static Integer exponent(
int fractionalPartLength,
const char *
exponent,
int exponentLength,
bool exponentNegative);
33 static Integer numerator(
const char * integralPart,
int integralPartLength,
const char * fractionalPart,
int fractionalPartLength,
bool negative,
Integer *
exponent);
68 bool isOne()
const {
return (m_numberOfDigits == 1 && digit(0) == 1 && !m_negative); };
69 bool isTwo()
const {
return (m_numberOfDigits == 1 && digit(0) == 2 && !m_negative); };
70 bool isTen()
const {
return (m_numberOfDigits == 1 && digit(0) == 10 && !m_negative); };
71 bool isMinusOne()
const {
return (m_numberOfDigits == 1 && digit(0) == 1 && m_negative); };
72 bool isZero()
const {
return (m_numberOfDigits == 1 && digit(0) == 0); };
78 void releaseDynamicIvars();
83 bool usesImmediateDigit()
const {
return m_numberOfDigits == 1; }
85 assert(i >= 0 && i < m_numberOfDigits);
88 uint16_t numberOfHalfDigits()
const {
91 return (d >= halfBase ? 2*m_numberOfDigits : 2*m_numberOfDigits-1);
95 if (i >= numberOfHalfDigits()) {
108 static_assert(
sizeof(
native_int_t) <=
sizeof(
native_uint_t),
"native_uint_t should be able to contain native_int_t data");
static Integer Power(const Integer &i, const Integer &j)
int writeTextInBuffer(char *buffer, int bufferSize) const
uint64_t double_native_uint_t
bool isEqualTo(const Integer &other) const
Integer & operator=(Integer &&other)
bool isLowerThan(const Integer &other) const
const native_uint_t * m_digits
static Integer Factorial(const Integer &i)
void setNegative(bool negative)
static constexpr int k_maxExtractableInteger
unsigned long long uint64_t
static Integer Addition(const Integer &i, const Integer &j)
static Integer exponent(int fractionalPartLength, const char *exponent, int exponentLength, bool exponentNegative)
static int NaturalOrder(const Integer &i, const Integer &j)
static Integer numerator(const char *integralPart, int integralPartLength, const char *fractionalPart, int fractionalPartLength, bool negative, Integer *exponent)
static Integer Subtraction(const Integer &i, const Integer &j)
uint16_t half_native_uint_t
Integer(native_int_t i=0)
ExpressionLayout * createLayout() const
static Integer Multiplication(const Integer &i, const Integer &j)
static Integer denominator(Integer *exponent)
static IntegerDivision Division(const Integer &numerator, const Integer &denominator)
int64_t double_native_int_t