Logo Search packages:      
Sourcecode: yacas version File versions  Download package

BigNumber Class Reference

#include <numbers.h>

Inheritance diagram for BigNumber:

RefCountedObjectBase

List of all members.


Detailed Description

Main class for multiple-precision arithmetic. All calculations are done at given precision. Integers grow as needed, floats don't grow beyond given precision.

Definition at line 240 of file numbers.h.


Public Types

enum  ENumType { KInt = 0, KFloat }

Public Member Functions

void Add (const BigNumber &aX, const BigNumber &aY, LispInt aPrecision)
 Add two numbers at given precision and return result in *this.
void BecomeFloat (LispInt aPrecision=0)
void BecomeInt ()
 BigNumber (LispInt aPrecision=20)
 BigNumber (const BigNumber &aOther)
 copy constructor
 BigNumber (const LispCharPtr aString, LispInt aPrecision, LispInt aBase=10)
void BitAnd (const BigNumber &aX, const BigNumber &aY)
signed long BitCount () const
 Bit count operation: return the number of significant bits if integer, return the binary exponent if float (shortcut for binary logarithm).
void BitNot (const BigNumber &aX)
void BitOr (const BigNumber &aX, const BigNumber &aY)
void BitXor (const BigNumber &aX, const BigNumber &aY)
ReferenceType DecreaseRefCount ()
void Divide (const BigNumber &aX, const BigNumber &aY, LispInt aPrecision)
 Divide two numbers and return result in *this. Note: if the two arguments are integer, it should return an integer result!
double Double () const
 Give approximate representation as a double number.
void DumpDebugInfo ()
 For debugging purposes, dump internal state of this object into a string.
LispBoolean Equals (const BigNumber &aOther) const
void Floor (const BigNumber &aX)
 assign self to Floor(aX) if possible
LispInt GetPrecision () const
void IncreaseRefCount ()
LispBoolean IsInt () const
LispBoolean IsIntValue () const
LispBoolean IsSmall () const
LispBoolean LessThan (const BigNumber &aOther) const
void Mod (const BigNumber &aY, const BigNumber &aZ)
 integer operation: *this = y mod z
void Multiply (const BigNumber &aX, const BigNumber &aY, LispInt aPrecision)
 Multiply two numbers at given precision and put result in *this.
void MultiplyAdd (const BigNumber &aX, const BigNumber &aY, LispInt aPrecision)
void Negate (const BigNumber &aX)
 Negate the given number, return result in *this.
void operator delete (void *object)
void operator delete[] (void *object)
void * operator new (size_t size)
void * operator new[] (size_t size)
void Precision (LispInt aPrecision)
 set precision (in bits)
ReferenceType ReferenceCount () const
void SetIsInteger (LispBoolean aIsInteger)
 Internal library wrapper starts here.
void SetTo (double value)
void SetTo (LispInt value)
void SetTo (long value)
void SetTo (const LispCharPtr aString, LispInt aPrecision, LispInt aBase=10)
void SetTo (const BigNumber &aOther)
void ShiftLeft (const BigNumber &aX, LispInt aNrToShift)
 Bitwise operations, return result in *this.
void ShiftRight (const BigNumber &aX, LispInt aNrToShift)
LispInt Sign () const
 Give sign (-1, 0, 1).
void ToString (LispString &aResult, LispInt aPrecision, LispInt aBase=10) const
 ToString : return string representation of number in aResult to given precision (base digits).

Static Public Member Functions

static const LispCharPtr NumericLibraryName ()
 Numeric library name.

Public Attributes

ANumber * iNumber
ENumType iType

Private Attributes

LispInt iPrecision

The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index