Classes | |
| class | CASNumeric |
Base class for providing an interface to numeric CASObject. More... | |
| class | LongInt |
| Implements a arbitrary precision integer. More... | |
Enumerations | |
| enum | signedness { Positive = 0, Negative = 1 } |
| Indicates the signedness of the numerical value. More... | |
Functions | |
| CASObject * | LongInt::Absolute () const |
| Returns the absolute value. | |
| CASObject * | LongInt::Add (const CASObject *addend) const |
Adds another CASObject to the LongInt. | |
| CASObject * | LongInt::Clone () const |
Clones the LongInt. | |
| CASObject * | LongInt::Divide (const CASObject *divisor) const |
Divides the LongInt by another CASObject. | |
| CASObject * | LongInt::Evaluate () const |
Evaluates the LongInt. | |
| LongInt | LongInt::FractionalPart (signed long r) const |
| Returns the fractional part of the division. | |
| LongInt | LongInt::FractionalPart (const LongInt &r) const |
| Returns the fractional part of the division. | |
| unsigned long | LongInt::frontpartlength () const |
| Returns the lenght in string representation of the front group. | |
| CASObject * | LongInt::GCD (const CASObject *i) const |
Computes the GCD of the LongInt and another CASObject. | |
| void | LongInt::Get (std::string &s) const |
| Returns the LongInt as std::string. | |
| void | LongInt::Get (char *s, unsigned long size) const |
| Returns the LongInt as string. | |
| void | LongInt::Get (char **s) const throw ( EInvArg, EUninitializedPtr ) |
| Returns the LongInt in string representation. | |
| signedness | CASNumeric::GetSign () const |
| Returns the sign. | |
| CASObject * | LongInt::Invert () const |
| Returns the value with inverted sign. | |
| bool | LongInt::IsEqual (const CASObject *o) const |
Indicates whether or not the LongInt is equal to another CASObject. | |
| bool | LongInt::IsGT (const CASObject *o) const |
Indicates whether or not the LongInt is greater than another CASObject. | |
| bool | LongInt::IsLT (const CASObject *o) const |
Indicates whether or not the LongInt is less than another CASObject. | |
| bool | LongInt::IsOne () const |
| Indicates whether or not it is one. | |
| bool | LongInt::IsSimilar (const CASObject *o) const |
Indicates whether or not the LongInt is similar to another CASObject. | |
| bool | LongInt::IsZero () const |
| Indicates whether or not it is zero. | |
| unsigned long | LongInt::Length () const |
| Returns the length of the LongInt in terms of digits. | |
| LongInt::LongInt (const LongInt &r) | |
| Copy constructor. | |
| LongInt::LongInt (const std::string &s) | |
| Constructor. | |
| LongInt::LongInt (const char *s) | |
| Constructor. | |
| LongInt::LongInt (signed long l=0) | |
| Constructor. | |
| void | LongInt::longint2str (char *s, unsigned long size) const |
Converts the LongInt to a C-string. | |
| CASObject * | LongInt::Modulo (const CASObject *divisor) const |
| Calculates the modulus. | |
| CASObject * | LongInt::Multiply (const CASObject *fact) const |
Multiplies the LongInt by another CASObject. | |
| void | LongInt::num2longint (const signed long num) |
Converts an integer to a LongInt. | |
| const LongInt | LongInt::operator * (const long &r) const |
| Multiplication operator. | |
| const LongInt | LongInt::operator * (const LongInt &r) const |
| Multiplication operator. | |
| LongInt & | LongInt::operator *= (const signed long &r) |
| Multiplication assignment operator. | |
| LongInt & | LongInt::operator *= (const LongInt &r) |
| Multiplication assignment operator. | |
| const bool | LongInt::operator!= (const long &r) const |
| Not equal operator. | |
| const bool | LongInt::operator!= (const LongInt &r) const |
| Not equal operator. | |
| const LongInt | LongInt::operator% (const long &r) const |
| Modulo operator. | |
| const LongInt | LongInt::operator% (const LongInt &r) const |
| Modulo operator. | |
| LongInt & | LongInt::operator%= (const signed long &r) |
| Modulus assignment operator. | |
| LongInt & | LongInt::operator%= (const LongInt &r) |
| Modulus assignment operator. | |
| const LongInt | LongInt::operator+ (const long &r) const |
| Addition operator. | |
| const LongInt | LongInt::operator+ (const LongInt &r) const |
| Addition operator. | |
| const LongInt | LongInt::operator++ (int) |
| Increment operator. | |
| const LongInt | LongInt::operator++ () |
| Increment operator. | |
| LongInt & | LongInt::operator+= (const signed long &r) |
| Addition assignment operator. | |
| LongInt & | LongInt::operator+= (const LongInt &r) |
| Addition assignment operator. | |
| const LongInt | LongInt::operator- (const long &r) const |
| Subtraction operator. | |
| const LongInt | LongInt::operator- (const LongInt &r) const |
| Subtraction operator. | |
| const LongInt | LongInt::operator-- (int) |
| Decrement operator. | |
| const LongInt | LongInt::operator-- () |
| Decrement operator. | |
| LongInt & | LongInt::operator-= (const signed long &r) |
| Subtraction assignment operator. | |
| LongInt & | LongInt::operator-= (const LongInt &r) |
| Subtraction assignment operator. | |
| const LongInt | LongInt::operator/ (const long &r) const |
| Division operator. | |
| const LongInt | LongInt::operator/ (const LongInt &r) const |
| Division operator. | |
| LongInt & | LongInt::operator/= (const signed long &r) |
| Division assignment operator. | |
| LongInt & | LongInt::operator/= (const LongInt &r) |
| Division assignment operator. | |
| const bool | LongInt::operator< (const long &r) const |
| Less than operator. | |
| const bool | LongInt::operator< (const LongInt &r) const |
| Less than operator. | |
| const LongInt | LongInt::operator<< (const signed long &r) const |
| Left shift operator. | |
| const bool | LongInt::operator<= (const long &r) const |
| Greater or equal operator. | |
| const bool | LongInt::operator<= (const LongInt &r) const |
| Less than or equal operator. | |
| LongInt & | LongInt::operator= (const signed long &r) |
| Assignment operator. | |
| LongInt & | LongInt::operator= (const LongInt &r) |
| Assignment operator. | |
| const bool | LongInt::operator== (const long &r) const |
| Equal operator. | |
| const bool | LongInt::operator== (const LongInt &r) const |
| Equal operator. | |
| const bool | LongInt::operator> (const long &r) const |
| Greater than operator. | |
| const bool | LongInt::operator> (const LongInt &r) const |
| Greater than operator. | |
| const bool | LongInt::operator>= (const long &r) const |
| Greater or equal operator. | |
| const bool | LongInt::operator>= (const LongInt &r) const |
| Greater or equal operator. | |
| LongInt | LongInt::Pow (unsigned long exp) const |
Raises the LongInt to the x-th power. | |
| LongInt | LongInt::Pow (const LongInt &exp) const |
Raises the LongInt to the x-th power. | |
| CASObject * | LongInt::Power (const CASObject *exp) const |
Raises the LongInt to the x-th power. | |
| void | LongInt::Print () const |
| Prints the LongInt to stdout. | |
| void | CASNumeric::SetSign (signedness s) |
| Sets the sign explicitly. | |
| void | LongInt::setzero () |
Sets the LongInt to zero. | |
| void | LongInt::str2longint (const char *str_num) |
Converts a C-string to a LongInt. | |
| void | LongInt::stripzeros () |
| Strips off unneeded zeros. | |
| CASObject * | LongInt::Subtract (const CASObject *sub) const |
Subtracts another CASObject from the LongInt. | |
| LongInt::~LongInt () | |
| Destructor. | |
| enum signedness |
Indicates the signedness of the numerical value.
Definition at line 57 of file casnumeric.h.
| CASObject * LongInt::Absolute | ( | ) | const [virtual, inherited] |
Adds another CASObject to this LongInt. If the CASObject is of the type CT_LONGINT, the sum is a LongInt. Else it is of the type CT_SUM, hence a Sum object.
CASObject returned has to be freed by the caller.CT_LONGINT, a LongInt representing the sum, else it returns a pointer to a Sum object. Implements CASObject.
Definition at line 723 of file longint.cc.
| CASObject * LongInt::Clone | ( | ) | const [virtual, inherited] |
| CASObject * LongInt::Evaluate | ( | ) | const [virtual, inherited] |
Evaluates the LongInt, which is cloning it, and setting all necessary flags to true in CASMetaInfo. A LongInt basically cannot be evaluated.
CASObject returned has to be freed by the caller.CASObject representing the evaluated form. Implements CASObject.
Definition at line 1024 of file longint.cc.
| LongInt LongInt::FractionalPart | ( | signed long | r | ) | const [inherited] |
LongInt and the signed long integer provided as argument. It depends on the value of div_depth to determine how many decimal places after the period it has to compute.
| r | Signed long integer which is the divisor. |
LongInt indicating the fractional part of the division. Definition at line 705 of file longint.cc.
LongInt and the one provided as argument. It depends on the value of div_depth to determine how many decimal places after the period it has to compute.
| r | Reference to a LongInt which is the divisor. |
LongInt indicating the fractional part of the division. Definition at line 610 of file longint.cc.
| unsigned long LongInt::frontpartlength | ( | ) | const [private, inherited] |
Returns the lenght in string representation of the front group.
Definition at line 68 of file longint.cc.
It computes the greatest common divisor of this LongInt and the CASObject passed as argument. If the argument is not a LongInt it returns a LongInt of the value one.
LongInt returned has to be freed by the caller.| i | Pointer to a CASObject. |
i is of type CT_LONGINT, it returns the gcd as LongInt, else it returns one in any case. Implements CASObject.
Definition at line 531 of file longint.cc.
| void LongInt::Get | ( | std::string & | s | ) | const [virtual, inherited] |
Returns the string representation of the LongInt as std::string.
| s | Reference to a std::string. |
Implements CASObject.
Definition at line 422 of file longint.cc.
| void LongInt::Get | ( | char * | s, | |
| unsigned long | size | |||
| ) | const [virtual, inherited] |
Returns the string representation of the LongInt in s. The buffer has to be large enough to hold the string representation, else a EBufToSmall exception is thrown.
| s | Pointer to the buffer receiving the string representation. | |
| size | Size of the buffer. |
Implements CASObject.
Definition at line 409 of file longint.cc.
| void LongInt::Get | ( | char ** | s | ) | const throw ( EInvArg, EUninitializedPtr ) [inherited] |
Returns the string representation of the LongInt. The buffer is allocated by the method and large enough to hold the string representation of the LongInt. The argument s is expected to be initialized to NULL.
| s | Pointer to char pointer which has to be initialized to NULL. |
LongInt. Definition at line 384 of file longint.cc.
| signedness CASNumeric::GetSign | ( | ) | const [inherited] |
Returns the sign in terms of Negative or Positive as defined in signedness.
signedness. Definition at line 65 of file casnumeric.cc.
| CASObject * LongInt::Invert | ( | ) | const [virtual, inherited] |
| bool LongInt::IsEqual | ( | const CASObject * | o | ) | const [virtual, inherited] |
| bool LongInt::IsGT | ( | const CASObject * | o | ) | const [virtual, inherited] |
| bool LongInt::IsLT | ( | const CASObject * | o | ) | const [virtual, inherited] |
| bool LongInt::IsOne | ( | ) | const [virtual, inherited] |
Indicates whether or not the LongInt is one.
true if it is one, false otherwise. Implements CASObject.
Definition at line 514 of file longint.cc.
| bool LongInt::IsSimilar | ( | const CASObject * | o | ) | const [virtual, inherited] |
Indicates whether or not this LongInt is similar to another CASObject. The test is done by comparing the type of the objects. They are assumed to be similar, if the have the same type, hence CT_LONGINT.
| o | Pointer to a CASObject which is tested for similarity. |
true if this object and the other are similar, false otherwise. Implements CASObject.
Definition at line 1004 of file longint.cc.
| bool LongInt::IsZero | ( | ) | const [virtual, inherited] |
Indicates whether or not the LongInt is zero.
true if it is zero, false otherwise. Implements CASObject.
Definition at line 504 of file longint.cc.
| unsigned long LongInt::Length | ( | ) | const [virtual, inherited] |
Returns the length of the LongInt in terms of digits including the negative sign, if applicable.
LongInt in terms of digits including the negative sign, if applicable. Implements CASObject.
Definition at line 439 of file longint.cc.
| LongInt::LongInt | ( | const LongInt & | r | ) | [inherited] |
| LongInt::LongInt | ( | const std::string & | s | ) | [inherited] |
Constructor. Initializes the LongInt to the number provided in the std::string.
| s | Reference to a std::string representing the number the LongInt has to be initialized to. |
Definition at line 304 of file longint.cc.
| LongInt::LongInt | ( | const char * | s | ) | [inherited] |
Constructor. Initializes the LongInt to the number provided in the C-string.
| s | C-String representing the number the LongInt has to be initialized to. |
Definition at line 288 of file longint.cc.
| LongInt::LongInt | ( | signed long | l = 0 |
) | [inherited] |
Constructor. Initializes the LongInt to the provided signed long integer.
| l | Signed long integer to which the LongInt is initialized. |
Definition at line 272 of file longint.cc.
| void LongInt::longint2str | ( | char * | s, | |
| unsigned long | size | |||
| ) | const [private, inherited] |
Converts the LongInt to a C-string.
LongInt. If the buffer is too small, a EBufTooSmall exception is thrown. Further, the buffer has to be freed by the caller.| s | Pointer to the buffer holding the converted LongInt. | |
| size | Size of the buffer. It has to be of appropriate size to hold the string representation. |
Definition at line 185 of file longint.cc.
Calculates the modulus of the LongInt and a CASObject. The modulus is always zero if the CASObject is not of type CT_LONGINT.
CASObject returned has to be freed by the caller.| divisor | Pointer to a CASObject. |
CASObject. Implements CASObject.
Definition at line 901 of file longint.cc.
Multiplies this LongInt by another CASObject. If the CASObject is of the type CT_LONGINT, the product is a LongInt. Else it is of the type CT_PRODUCT, hence a Product object.
CASObject returned has to be freed by the caller.CT_LONGINT, a LongInt representing the product, else it returns a pointer to a Product object. Implements CASObject.
Definition at line 802 of file longint.cc.
| void LongInt::num2longint | ( | const signed long | num | ) | [private, inherited] |
Converts a signed long integer to a LongInt.
| num | The signed long integer to be converted. |
Definition at line 152 of file longint.cc.
| const LongInt LongInt::operator * | ( | const long & | r | ) | const [inherited] |
Multiplication operator. Multiplies the LongInt by a signed long integer.
| r | Reference to a signed long integer. |
LongInt. Definition at line 1387 of file longint.cc.
Multiplication operator. Multiplies two LongInt.
| r | Reference to a LongInt. |
LongInt. Definition at line 1327 of file longint.cc.
| LongInt & LongInt::operator *= | ( | const signed long & | r | ) | [inherited] |
Multiplication assignment operator.
| r | Reference to a signed long integer. |
LongInt. Definition at line 1175 of file longint.cc.
Multiplication assignment operator.
| r | Reference to a LongInt. |
LongInt. Definition at line 1163 of file longint.cc.
| const bool LongInt::operator!= | ( | const long & | r | ) | const [inherited] |
Not equal operator. Compares this LongInt with a signed long integer.
| r | Reference to a signed long integer. |
true if values are not equal, false otherwise. Definition at line 1735 of file longint.cc.
| const bool LongInt::operator!= | ( | const LongInt & | r | ) | const [inherited] |
| const LongInt LongInt::operator% | ( | const long & | r | ) | const [inherited] |
Modulo operator. Computes the modulus of this LongInt divided by a signed long integer.
| r | Reference to a signed long integer. |
LongInt. Definition at line 1658 of file longint.cc.
| LongInt & LongInt::operator%= | ( | const signed long & | r | ) | [inherited] |
Modulo assignment operator.
| r | Reference to a signed long integer. |
LongInt. Definition at line 1223 of file longint.cc.
Modulo assignment operator.
| r | Reference to a LongInt. |
LongInt. Definition at line 1211 of file longint.cc.
| const LongInt LongInt::operator+ | ( | const long & | r | ) | const [inherited] |
Addition operator. Adds a signed long integer to the LongInt.
| r | Reference to a signed long integer. |
LongInt. Definition at line 1315 of file longint.cc.
Addition operator. Adds two LongInt.
| r | Reference to a LongInt. |
LongInt. Definition at line 1235 of file longint.cc.
| const LongInt LongInt::operator++ | ( | int | ) | [inherited] |
Prefix increment operator. Increments the LongInt by one.
LongInt. Definition at line 1978 of file longint.cc.
| const LongInt LongInt::operator++ | ( | ) | [inherited] |
Postfix increment operator. Increments the LongInt by one.
LongInt. Definition at line 1968 of file longint.cc.
| LongInt & LongInt::operator+= | ( | const signed long & | r | ) | [inherited] |
Addition assignment operator.
| r | Reference to a signed long integer. |
LongInt. Definition at line 1127 of file longint.cc.
Addition assignment operator.
| r | Reference to a LongInt. |
LongInt. Definition at line 1115 of file longint.cc.
| const LongInt LongInt::operator- | ( | const long & | r | ) | const [inherited] |
Subtraction operator. Subtracts a signed long integer from this LongInt
| r | Reference to a signed long integer. |
LongInt. Definition at line 1495 of file longint.cc.
| const LongInt LongInt::operator-- | ( | int | ) | [inherited] |
Prefix decrement operator. Decrements the LongInt by one.
LongInt. Definition at line 2001 of file longint.cc.
| const LongInt LongInt::operator-- | ( | ) | [inherited] |
Postfix decrement operator. Decrements the LongInt by one.
LongInt. Definition at line 1991 of file longint.cc.
| LongInt & LongInt::operator-= | ( | const signed long & | r | ) | [inherited] |
Subtraction assignment operator.
| r | Reference to a signed long integer. |
LongInt. Definition at line 1151 of file longint.cc.
Subtraction assignment operator.
| r | Reference to a LongInt. |
LongInt. Definition at line 1139 of file longint.cc.
| const LongInt LongInt::operator/ | ( | const long & | r | ) | const [inherited] |
Division operator. Divides this LongInt by a signed long integer.
| r | Reference to a signed long integer. |
LongInt. Definition at line 1606 of file longint.cc.
| LongInt & LongInt::operator/= | ( | const signed long & | r | ) | [inherited] |
Division assignment operator.
| r | Reference to a signed long integer. |
LongInt. Definition at line 1199 of file longint.cc.
Division assignment operator.
| r | Reference to a LongInt. |
LongInt. Definition at line 1187 of file longint.cc.
| const bool LongInt::operator< | ( | const long & | r | ) | const [inherited] |
Less than operator. Compares this LongInt with a unsigned long integer.
| r | Reference to a LongInt. |
true if this LongInt is less than r, false otherwise. Definition at line 1799 of file longint.cc.
| const bool LongInt::operator< | ( | const LongInt & | r | ) | const [inherited] |
| const LongInt LongInt::operator<< | ( | const signed long & | r | ) | const [inherited] |
Left shift operator. Shifts the LongInt to the left by appending groups of zeros to the right.
| r | Reference to a signed long integer. |
LongInt. Definition at line 1948 of file longint.cc.
| const bool LongInt::operator<= | ( | const long & | r | ) | const [inherited] |
Less than or equal operator. Compares this LongInt with a unsigned long integer.
| r | Reference to a LongInt. |
true if this LongInt is less than or equal r, false otherwise. Definition at line 1935 of file longint.cc.
| const bool LongInt::operator<= | ( | const LongInt & | r | ) | const [inherited] |
| LongInt & LongInt::operator= | ( | const signed long & | r | ) | [inherited] |
Assignment operator.
| r | Reference to a signed long integer. |
LongInt. Definition at line 1087 of file longint.cc.
Assignment operator.
| r | Reference to a LongInt. |
LongInt. Definition at line 1046 of file longint.cc.
| const bool LongInt::operator== | ( | const long & | r | ) | const [inherited] |
Equal operator. Compares this LongInt with a signed long integer.
| r | Reference to a signed long integer. |
true if values are equal, false otherwise. Definition at line 1708 of file longint.cc.
| const bool LongInt::operator== | ( | const LongInt & | r | ) | const [inherited] |
| const bool LongInt::operator> | ( | const long & | r | ) | const [inherited] |
Greater than operator. Compares this LongInt with a unsigned long integer.
| r | Reference to a LongInt. |
true if this LongInt is greater than r, false otherwise. Definition at line 1863 of file longint.cc.
| const bool LongInt::operator> | ( | const LongInt & | r | ) | const [inherited] |
| const bool LongInt::operator>= | ( | const long & | r | ) | const [inherited] |
Greater than or equal operator. Compares this LongInt with a unsigned long integer.
| r | Reference to a LongInt. |
true if this LongInt is greater than or equal r, false otherwise. Definition at line 1899 of file longint.cc.
| const bool LongInt::operator>= | ( | const LongInt & | r | ) | const [inherited] |
| LongInt LongInt::Pow | ( | unsigned long | exp | ) | const [inline, inherited] |
LongInt to the power given as argument.
| exp | unsigned long which is the power. |
LongInt which is raised to the given power. Definition at line 589 of file longint.cc.
LongInt to the power given as argument.
| exp | Reference to a LongInt which is the power. |
LongInt which is raised to the given power. Definition at line 569 of file longint.cc.
LongInt to the power indicated by the argument.
| exp | Pointer to a CASObject indicating the power. |
Implements CASObject.
Definition at line 864 of file longint.cc.
| void LongInt::Print | ( | ) | const [virtual, inherited] |
Prints the string representation of the LongInt to stdout.
Implements CASObject.
Definition at line 457 of file longint.cc.
| void CASNumeric::SetSign | ( | signedness | s | ) | [inherited] |
Sets the sign explicitly to a value specified in signedness.
| s | The signedness to be set. |
Definition at line 47 of file casnumeric.cc.
| void LongInt::setzero | ( | ) | [private, inherited] |
| void LongInt::str2longint | ( | const char * | str_num | ) | [private, inherited] |
Converts a C-string to a LongInt. strtol() is used to convert the digits. However, the method takes care of interpreting '+' and '-' in front of the number itself.
| str_num | Pointer to the C-String holding the number to be converted. |
Definition at line 93 of file longint.cc.
| void LongInt::stripzeros | ( | ) | [private, inherited] |
Removes zeros from the front of the LongInt.
Definition at line 245 of file longint.cc.
Subtracts another CASObject from this LongInt. If the CASObject is of the type CT_LONGINT, the difference is a LongInt. Else it is of the type CT_SUM, hence a Sum object.
CASObject returned has to be freed by the caller.CT_LONGINT, a LongInt representing the difference, else it returns a pointer to a Sum object. Implements CASObject.
Definition at line 761 of file longint.cc.
| LongInt::~LongInt | ( | ) | [inherited] |
Destructor.
Definition at line 341 of file longint.cc.
1.4.7