Regina Calculation Engine
Public Member Functions | Static Public Member Functions | Static Public Attributes | Friends | List of all members
regina::NIntegerBase< supportInfinity > Singleton Reference

Represents an arbitrary precision integer. More...

#include <maths/ninteger.h>

Inheritance diagram for regina::NIntegerBase< supportInfinity >:
regina::InfinityBase< supportInfinity >

Public Member Functions

 NIntegerBase ()
 Initialises this integer to zero. More...
 
 NIntegerBase (int value)
 Initialises this integer to the given value. More...
 
 NIntegerBase (unsigned value)
 Initialises this integer to the given value. More...
 
 NIntegerBase (long value)
 Initialises this integer to the given value. More...
 
 NIntegerBase (unsigned long value)
 Initialises this integer to the given value. More...
 
 NIntegerBase (const NIntegerBase< supportInfinity > &value)
 Initialises this integer to the given value. More...
 
 NIntegerBase (const NIntegerBase<!supportInfinity > &value)
 Initialises this integer to the given value. More...
 
template<int bytes>
 NIntegerBase (const NNativeInteger< bytes > &value)
 Initialises this integer to the given value. More...
 
 NIntegerBase (const char *value, int base=10, bool *valid=0)
 Initialises this integer to the given value which is represented as a string of digits in a given base. More...
 
 NIntegerBase (const std::string &value, int base=10, bool *valid=0)
 Initialises this integer to the given value which is represented as a string of digits in a given base. More...
 
 ~NIntegerBase ()
 Destroys this integer. More...
 
bool isNative () const
 Returns whether we are currently working with a native C/C++ long, or whether we have switched to GMP large integer arithmetic for this integer. More...
 
bool isZero () const
 Returns whether or not this integer is zero. More...
 
int sign () const
 Returns the sign of this integer. More...
 
bool isInfinite () const
 Returns whether this integer is infinity. More...
 
void makeInfinite ()
 Sets this integer to be infinity. More...
 
long longValue () const
 Returns the value of this integer as a long. More...
 
template<int bytes>
IntOfSize< bytes >::type nativeValue () const
 Returns the value of this integer as a native integer of some fixed byte length. More...
 
std::string stringValue (int base=10) const
 Returns the value of this integer as a string in the given base. More...
 
NIntegerBaseoperator= (const NIntegerBase &value)
 Sets this integer to the given value. More...
 
NIntegerBaseoperator= (const NIntegerBase<!supportInfinity > &value)
 Sets this integer to the given value. More...
 
NIntegerBaseoperator= (int value)
 Sets this integer to the given value. More...
 
NIntegerBaseoperator= (unsigned value)
 Sets this integer to the given value. More...
 
NIntegerBaseoperator= (long value)
 Sets this integer to the given value. More...
 
NIntegerBaseoperator= (unsigned long value)
 Sets this integer to the given value. More...
 
NIntegerBaseoperator= (const char *value)
 Sets this integer to the given value which is represented as a string of digits in base 10. More...
 
NIntegerBaseoperator= (const std::string &value)
 Sets this integer to the given value which is represented as a string of digits in base 10. More...
 
void swap (NIntegerBase &other)
 Swaps the values of this and the given integer. More...
 
bool operator== (const NIntegerBase &rhs) const
 Determines if this is equal to the given integer. More...
 
bool operator== (const NIntegerBase<!supportInfinity > &rhs) const
 Determines if this is equal to the given integer. More...
 
bool operator== (long rhs) const
 Determines if this is equal to the given integer. More...
 
bool operator!= (const NIntegerBase &rhs) const
 Determines if this is not equal to the given integer. More...
 
bool operator!= (const NIntegerBase<!supportInfinity > &rhs) const
 Determines if this is not equal to the given integer. More...
 
bool operator!= (long rhs) const
 Determines if this is not equal to the given integer. More...
 
bool operator< (const NIntegerBase &rhs) const
 Determines if this is less than the given integer. More...
 
bool operator< (long rhs) const
 Determines if this is less than the given integer. More...
 
bool operator> (const NIntegerBase &rhs) const
 Determines if this is greater than the given integer. More...
 
bool operator> (long rhs) const
 Determines if this is greater than the given integer. More...
 
bool operator<= (const NIntegerBase &rhs) const
 Determines if this is less than or equal to the given integer. More...
 
bool operator<= (long rhs) const
 Determines if this is less than or equal to the given integer. More...
 
bool operator>= (const NIntegerBase &rhs) const
 Determines if this is greater than or equal to the given integer. More...
 
bool operator>= (long rhs) const
 Determines if this is greater than or equal to the given integer. More...
 
NIntegerBaseoperator++ ()
 The preincrement operator. More...
 
NIntegerBase operator++ (int)
 The postincrement operator. More...
 
NIntegerBaseoperator-- ()
 The predecrement operator. More...
 
NIntegerBase operator-- (int)
 The postdecrement operator. More...
 
NIntegerBase operator+ (const NIntegerBase &other) const
 Adds this to the given integer and returns the result. More...
 
NIntegerBase operator+ (long other) const
 Adds this to the given integer and returns the result. More...
 
NIntegerBase operator- (const NIntegerBase &other) const
 Subtracts the given integer from this and returns the result. More...
 
NIntegerBase operator- (long other) const
 Subtracts the given integer from this and returns the result. More...
 
NIntegerBase operator* (const NIntegerBase &other) const
 Multiplies this by the given integer and returns the result. More...
 
NIntegerBase operator* (long other) const
 Multiplies this by the given integer and returns the result. More...
 
NIntegerBase operator/ (const NIntegerBase &other) const
 Divides this by the given integer and returns the result. More...
 
NIntegerBase operator/ (long other) const
 Divides this by the given integer and returns the result. More...
 
NIntegerBase divExact (const NIntegerBase &other) const
 Divides this by the given integer and returns the result. More...
 
NIntegerBase divExact (long other) const
 Divides this by the given integer and returns the result. More...
 
NIntegerBase operator% (const NIntegerBase &other) const
 Determines the remainder when this integer is divided by the given integer. More...
 
NIntegerBase operator% (long other) const
 Determines the remainder when this integer is divided by the given integer. More...
 
NIntegerBase< supportInfinity > divisionAlg (const NIntegerBase< supportInfinity > &divisor, NIntegerBase< supportInfinity > &remainder) const
 Uses the division algorithm to obtain a quotient and remainder when dividing by the given integer. More...
 
NIntegerBase operator- () const
 Determines the negative of this integer. More...
 
NIntegerBaseoperator+= (const NIntegerBase &other)
 Adds the given integer to this. More...
 
NIntegerBaseoperator+= (long other)
 Adds the given integer to this. More...
 
NIntegerBaseoperator-= (const NIntegerBase &other)
 Subtracts the given integer from this. More...
 
NIntegerBaseoperator-= (long other)
 Subtracts the given integer from this. More...
 
NIntegerBaseoperator*= (const NIntegerBase &other)
 Multiplies the given integer by this. More...
 
NIntegerBaseoperator*= (long other)
 Multiplies the given integer by this. More...
 
NIntegerBaseoperator/= (const NIntegerBase &other)
 Divides this by the given integer. More...
 
NIntegerBaseoperator/= (long other)
 Divides this by the given integer. More...
 
NIntegerBasedivByExact (const NIntegerBase &other)
 Divides this by the given integer. More...
 
NIntegerBasedivByExact (long other)
 Divides this by the given integer. More...
 
NIntegerBaseoperator%= (const NIntegerBase &other)
 Reduces this integer modulo the given integer. More...
 
NIntegerBaseoperator%= (long other)
 Reduces this integer modulo the given integer. More...
 
void negate ()
 Negates this integer. More...
 
void raiseToPower (unsigned long exp)
 Raises this integer to the power of the given exponent. More...
 
NIntegerBase abs () const
 Determines the absolute value of this integer. More...
 
void gcdWith (const NIntegerBase &other)
 Sets this integer to be the greatest common divisor of this and the given integer. More...
 
NIntegerBase gcd (const NIntegerBase &other) const
 Determines the greatest common divisor of this and the given integer. More...
 
void lcmWith (const NIntegerBase &other)
 Sets this integer to be the lowest common multiple of this and the given integer. More...
 
NIntegerBase lcm (const NIntegerBase &other) const
 Determines the lowest common multiple of this and the given integer. More...
 
NIntegerBase< supportInfinity > gcdWithCoeffs (const NIntegerBase< supportInfinity > &other, NIntegerBase< supportInfinity > &u, NIntegerBase< supportInfinity > &v) const
 Determines the greatest common divisor of this and the given integer and finds the smallest coefficients with which these integers combine to give their gcd. More...
 
int legendre (const NIntegerBase< supportInfinity > &p) const
 Returns the Legendre symbol (a/p), where a is this integer and p is an odd prime. More...
 
NIntegerBase< supportInfinity > randomBoundedByThis () const
 Generate a pseudo-random integer that is uniformly distributed in the interval [0,*this). More...
 
void setRaw (mpz_srcptr fromData)
 Set this to a copy of the given raw GMP integer. More...
 
mpz_srcptr rawData () const
 Returns the raw GMP data that describes this integer. More...
 
mpz_ptr rawData ()
 Returns the raw GMP data that describes this integer. More...
 
void makeLarge ()
 Converts this integer to use a GMP large integer representation, regardless of whether this is actually necessary. More...
 
void tryReduce ()
 Converts this integer to use a native C/C++ long representation, if this is possible. More...
 
template<int bytes>
IntOfSize< bytes >::type nativeValue () const
 
template<>
bool isInfinite () const
 
template<>
bool isInfinite () const
 
template<>
void makeInfinite ()
 
template<>
void makeInfinite ()
 
template<>
void swap (NIntegerBase< true > &other)
 
template<>
void swap (NIntegerBase< false > &other)
 
template<>
 NIntegerBase (bool, bool)
 

Static Public Member Functions

static NIntegerBase
< supportInfinity > 
randomBinary (unsigned long n)
 Generate a pseudo-random integer that is uniformly distributed in the interval [0,2^n). More...
 
static NIntegerBase
< supportInfinity > 
randomCornerBinary (unsigned long n)
 Generate a pseudo-random integer that is distributed in the interval [0,2^n), with a tendency to have long strings of 0s and 1s in its binary expansion. More...
 

Static Public Attributes

static const NIntegerBase
< supportInfinity > 
zero
 Globally available zero. More...
 
static const NIntegerBase
< supportInfinity > 
one
 Globally available one. More...
 
static const NIntegerBase
< supportInfinity > 
infinity
 Globally available infinity. More...
 

Friends

class NIntegerBase<!supportInfinity >
 
template<int bytes>
class NNativeInteger
 
template<bool supportInfinity_>
std::ostream & operator<< (std::ostream &out, const NIntegerBase< supportInfinity_ > &large)
 

Detailed Description

template<bool supportInfinity = false>
singleton regina::NIntegerBase< supportInfinity >

Represents an arbitrary precision integer.

Calculations are always guaranteed to be exact, regardless of how large the integers become.

The current implementation uses fast native integer arithmetic wherever possible, whilst always testing for potential overflow. If a potential overflow is detected, this class switches to using the GNU multiple precision arithmetic library (libgmp) instead.

This class takes a single boolean argument supportInfinity. If this is true, then this class will support infinity as an allowed value. If this is false (the default), then infinity is not supported, and any attempt to work with infinity will lead to undefined behaviour. Supporting infinity is more flexible, but also comes with a slight performance cost (very roughly estimated at around 10%-20%).

For the purposes of comparison, infinity is considered larger than any other integer but equal to itself.

All routines in this class, including random number generation, are thread-safe.

The opportunistic use of native arithmetic where possible was inspired by the (much more complex and powerful) lazy exact arithmetic in CGAL. Thanks to Menelaos Karavelas for encouraging me to take another look at these ideas.

Python:
Both variants of this template are available through Python. For supportInfinity = false (the default), simply use NIntegerBase. For supportInfinity = true, use NLargeInteger.

Constructor & Destructor Documentation

template<bool supportInfinity>
regina::NIntegerBase< supportInfinity >::NIntegerBase ( )
inline

Initialises this integer to zero.

template<bool supportInfinity>
regina::NIntegerBase< supportInfinity >::NIntegerBase ( int  value)
inline

Initialises this integer to the given value.

Python:
In Python, the only native-integer constructor is NIntegerBase(long).
Parameters
valuethe new value of this integer.
template<bool supportInfinity>
regina::NIntegerBase< supportInfinity >::NIntegerBase ( unsigned  value)
inline

Initialises this integer to the given value.

Python:
In Python, the only native-integer constructor is NIntegerBase(long).
Parameters
valuethe new value of this integer.
template<bool supportInfinity>
regina::NIntegerBase< supportInfinity >::NIntegerBase ( long  value)
inline

Initialises this integer to the given value.

Python:
In Python, this is the only native-integer constructor available.
Parameters
valuethe new value of this integer.
template<bool supportInfinity>
regina::NIntegerBase< supportInfinity >::NIntegerBase ( unsigned long  value)
inline

Initialises this integer to the given value.

Python:
In Python, the only native-integer constructor is NIntegerBase(long).
Parameters
valuethe new value of this integer.
template<bool supportInfinity>
regina::NIntegerBase< supportInfinity >::NIntegerBase ( const NIntegerBase< supportInfinity > &  value)
inline

Initialises this integer to the given value.

Parameters
valuethe new value of this integer.
template<bool supportInfinity>
regina::NIntegerBase< supportInfinity >::NIntegerBase ( const NIntegerBase<!supportInfinity > &  value)
inlineexplicit

Initialises this integer to the given value.

This constructor is marked as explicit in the hope of avoiding accidental (and unintentional) mixing of template parameters.

Precondition
The given integer is not infinite.
Parameters
valuethe new value of this integer.
template<bool supportInfinity>
template<int bytes>
regina::NIntegerBase< supportInfinity >::NIntegerBase ( const NNativeInteger< bytes > &  value)
inlineexplicit

Initialises this integer to the given value.

This constructor is marked as explicit in the hope of avoiding accidental (and unintentional) mixing of integer classes.

Precondition
If bytes is larger than sizeof(long), then bytes is a strict multiple of sizeof(long). For instance, if longs are 8 bytes then you can use bytes=16 but not bytes=12. This restriction is enforced through a compile-time assertion, but may be lifted in future versions of Regina.
Python:
Not present.
Parameters
valuethe new value of this integer.
template<bool supportInfinity = false>
regina::NIntegerBase< supportInfinity >::NIntegerBase ( const char *  value,
int  base = 10,
bool *  valid = 0 
)

Initialises this integer to the given value which is represented as a string of digits in a given base.

If not specified, the base defaults to 10. If the given base is zero, the base will be automatically determined. If the given string begins with 0x or 0X, the base will be assumed to be 16. Otherwise, if the string begins with 0, the base will be assumed to be 8. Otherwise it will be taken as base 10.

Whitespace may be present at the beginning or the end of the given string, and will simply be ignored.

Error detection is possible by passing a non-null boolean pointer as the third parameter to this constructor.

For finer details on how the string parsing works, see strtol() from the standard C library (on which this method is based).

Precondition
The given base is zero, or is between 2 and 36 inclusive.
The given string represents a finite integer in the given base, with optional whitespace beforehand.
Python:
The final parameter valid is not present.
Parameters
valuethe new value of this integer, represented as a string of digits in base base.
basethe base in which value is given.
validif this pointer is not null, the boolean referenced will be set to true if the entire given string was a valid large integer representation and false otherwise.
template<bool supportInfinity = false>
regina::NIntegerBase< supportInfinity >::NIntegerBase ( const std::string &  value,
int  base = 10,
bool *  valid = 0 
)

Initialises this integer to the given value which is represented as a string of digits in a given base.

If not specified, the base defaults to 10. If the given base is zero, the base will be automatically determined. If the given string begins with 0x or 0X, the base will be assumed to be 16. Otherwise, if the string begins with 0, the base will be assumed to be 8. Otherwise it will be taken as base 10.

Whitespace may be present at the beginning or the end of the given string, and will simply be ignored.

Error detection is possible by passing a non-null boolean pointer as the third parameter to this constructor.

For finer details on how the string parsing works, see strtol() from the standard C library (on which this method is based).

Precondition
The given base is zero, or is between 2 and 36 inclusive.
The given string represents an integer in the given base, with optional whitespace beforehand.
Python:
The final parameter valid is not present.
Parameters
valuethe new value of this integer, represented as a string of digits in base base.
basethe base in which value is given.
validif this pointer is not null, the boolean referenced will be set to true if the entire given string was a valid large integer representation and false otherwise.
template<bool supportInfinity>
regina::NIntegerBase< supportInfinity >::~NIntegerBase ( )
inline

Destroys this integer.

Member Function Documentation

template<bool supportInfinity>
NIntegerBase< supportInfinity > regina::NIntegerBase< supportInfinity >::abs ( ) const
inline

Determines the absolute value of this integer.

This integer is not changed.

Returns
the absolute value of this integer.
template<bool supportInfinity = false>
NIntegerBase& regina::NIntegerBase< supportInfinity >::divByExact ( const NIntegerBase< supportInfinity > &  other)

Divides this by the given integer.

This can only be used when the given integer divides into this exactly, and for large integers this is much faster than ordinary division. This integer is changed to reflect the result.

Precondition
The given integer divides exactly into this integer, i.e. this divided by other is an integer.
other is not zero.
Neither this nor other is infinite.
Parameters
otherthe integer to divide this by.
Returns
a reference to this integer with its new value.
template<bool supportInfinity = false>
NIntegerBase& regina::NIntegerBase< supportInfinity >::divByExact ( long  other)

Divides this by the given integer.

This can only be used when the given integer divides into this exactly, and for large integers this is much faster than ordinary division. This integer is changed to reflect the result.

Precondition
The given integer divides exactly into this integer, i.e. this divided by other is an integer.
other is not zero.
This integer is not infinite.
Parameters
otherthe integer to divide this by.
Returns
a reference to this integer with its new value.
template<bool supportInfinity>
NIntegerBase< supportInfinity > regina::NIntegerBase< supportInfinity >::divExact ( const NIntegerBase< supportInfinity > &  other) const
inline

Divides this by the given integer and returns the result.

This can only be used when the given integer divides into this exactly, and for large integers can be much faster than ordinary division. This integer is not changed.

Precondition
The given integer divides exactly into this integer, i.e. this divided by other is an integer.
other is not zero.
Neither this nor other is infinite.
Parameters
otherthe integer to divide this by.
Returns
the quotient this divided by other.
template<bool supportInfinity>
NIntegerBase< supportInfinity > regina::NIntegerBase< supportInfinity >::divExact ( long  other) const
inline

Divides this by the given integer and returns the result.

This can only be used when the given integer divides into this exactly, and for large integers can be much faster than ordinary division. This integer is not changed.

Precondition
The given integer divides exactly into this integer, i.e. this divided by other is an integer.
other is not zero.
This integer is not infinite.
Parameters
otherthe integer to divide this by.
Returns
the quotient this divided by other.
template<bool supportInfinity = false>
NIntegerBase<supportInfinity> regina::NIntegerBase< supportInfinity >::divisionAlg ( const NIntegerBase< supportInfinity > &  divisor,
NIntegerBase< supportInfinity > &  remainder 
) const

Uses the division algorithm to obtain a quotient and remainder when dividing by the given integer.

Suppose this integer is n and we pass the divisor d. The division algorithm describes the result of dividing n by d; in particular, it expresses n = qd + r, where q is the quotient and r is the remainder.

The division algorithm is precise about which values of q and r are chosen; in particular it chooses the unique r in the range 0 <= r < |d|.

Note that this differs from other division routines in this class, in that it always rounds to give a non-negative remainder. Thus NIntegerBase(-7).divisionAlg(3) gives quotient -3 and remainder 2, whereas (-7)/3 gives quotient -2 and (-7)%3 gives remainder -1.

The two results are passed back to the caller as follows: The quotient q is passed back as the return value of the function, and the remainder r is stored in the reference argument r.

In the special case where the given divisor is 0 (not allowed by the usual division algorithm), this routine selects quotient 0 and remainder n.

Precondition
Neither this nor the divisor are infinite.
Python:
The argument remainder is missing; instead both the quotient and remainder are passed back through the return value of the function. Specifically, this function returns a (quotient, remainder) pair.
Parameters
divisorthe divisor d.
remainderused to store the remainder r when the functon returns. The initial value of this argument is ignored.
Returns
the quotient q.
Author
Ryan Budney & B.B.
template<bool supportInfinity>
NIntegerBase< supportInfinity > regina::NIntegerBase< supportInfinity >::gcd ( const NIntegerBase< supportInfinity > &  other) const

Determines the greatest common divisor of this and the given integer.

This integer is not changed.

The result is guaranteed to be non-negative. As a special case, gcd(0,0) is considered to be zero.

Precondition
Neither this integer nor other is infinite.
Parameters
otherthe integer whose greatest common divisor with this will be found.
Returns
the greatest common divisor of this and the given integer.
template<bool supportInfinity = false>
void regina::NIntegerBase< supportInfinity >::gcdWith ( const NIntegerBase< supportInfinity > &  other)

Sets this integer to be the greatest common divisor of this and the given integer.

The result is guaranteed to be non-negative. As a special case, gcd(0,0) is considered to be zero.

Precondition
Neither this integer nor other is infinite.
Parameters
otherthe integer whose greatest common divisor with this will be found.
template<bool supportInfinity = false>
NIntegerBase<supportInfinity> regina::NIntegerBase< supportInfinity >::gcdWithCoeffs ( const NIntegerBase< supportInfinity > &  other,
NIntegerBase< supportInfinity > &  u,
NIntegerBase< supportInfinity > &  v 
) const

Determines the greatest common divisor of this and the given integer and finds the smallest coefficients with which these integers combine to give their gcd.

Note that the given integers need not be non-negative. However, the gcd returned is guaranteed to be non-negative.

If d is the gcd of this and other, the values placed into u and v will be those for which u*this + v*other = d, -abs(this)/d < v*sign(other) <= 0 and 1 <= u*sign(this) <= abs(other)/d. These equations are not satisfied when either of this or other are zero, but in this case u and v are both 0, 1 or -1, using as many zeros as possible.

Precondition
Neither this integer nor other is infinite.
Parameters
otherthe integer whose greatest common divisor with this will be found.
ua variable into which the final coefficient of this will be placed.
va variable into which the final coefficient of other will be placed.
Returns
the greatest common divisor of this and other.
template<bool supportInfinity = false>
bool regina::NIntegerBase< supportInfinity >::isInfinite ( ) const

Returns whether this integer is infinity.

Returns
true if and only if this integer is infinity.
template<bool supportInfinity>
bool regina::NIntegerBase< supportInfinity >::isNative ( ) const
inline

Returns whether we are currently working with a native C/C++ long, or whether we have switched to GMP large integer arithmetic for this integer.

If this integer is infinite, this routine will return false.

Returns
true if and only if we are still using a native C/C++ long.
template<bool supportInfinity>
bool regina::NIntegerBase< supportInfinity >::isZero ( ) const
inline

Returns whether or not this integer is zero.

This is micro-optimised to be faster than simply testing whether (*this) == 0.

Returns
true if and only if this integer is zero.
template<bool supportInfinity>
NIntegerBase< supportInfinity > regina::NIntegerBase< supportInfinity >::lcm ( const NIntegerBase< supportInfinity > &  other) const

Determines the lowest common multiple of this and the given integer.

This integer is not changed.

Note that the result might possibly be negative.

Precondition
Neither this integer nor other is infinite.
Parameters
otherthe integer whose lowest common multiple with this will be found.
Returns
the lowest common multiple of this and the given integer.
template<bool supportInfinity = false>
void regina::NIntegerBase< supportInfinity >::lcmWith ( const NIntegerBase< supportInfinity > &  other)

Sets this integer to be the lowest common multiple of this and the given integer.

Note that the result might possibly be negative.

Precondition
Neither this integer nor other is infinite.
Parameters
otherthe integer whose lowest common multiple with this will be found.
template<bool supportInfinity = false>
int regina::NIntegerBase< supportInfinity >::legendre ( const NIntegerBase< supportInfinity > &  p) const

Returns the Legendre symbol (a/p), where a is this integer and p is an odd prime.

The Legendre symbol is equal to 0 if this integer is divisible by p, 1 if this integer is congruent to a square mod p (but not divisible by p), and -1 otherwise.

Precondition
The given integer p is an odd positive prime.
This integer is not infinite.
Parameters
pthe given odd prime.
Returns
The Legendre symbol (0, 1 or -1) as described above.
Author
Ryan Budney
template<bool supportInfinity>
long regina::NIntegerBase< supportInfinity >::longValue ( ) const
inline

Returns the value of this integer as a long.

It is the programmer's reponsibility to ensure that this integer is within the required range. If this integer is too large or small to fit into a long, then the result will be undefined.

Note that, assuming the value is within the required range, this routine will give correct results regardless of whether the underlying representation is a native or large integer.

Precondition
This integer is not infinity.
Returns
the value of this integer.
template<bool supportInfinity = false>
void regina::NIntegerBase< supportInfinity >::makeInfinite ( )
inline

Sets this integer to be infinity.

If the template parameter supportInfinity is false, this routine safely does nothing.

template<bool supportInfinity>
void regina::NIntegerBase< supportInfinity >::makeLarge ( )
inline

Converts this integer to use a GMP large integer representation, regardless of whether this is actually necessary.

The contents of this integer will be preserved.

It does not matter which kind of representation this integer is currently using.

Precondition
This integer is not infinite.
template<bool supportInfinity = false>
template<int bytes>
IntOfSize<bytes>::type regina::NIntegerBase< supportInfinity >::nativeValue ( ) const

Returns the value of this integer as a native integer of some fixed byte length.

It is the programmer's reponsibility to ensure that this integer is within the required range. If this integer is too large or small to fit into the return type, then the result will be undefined.

Note that, assuming the value is within the required range, this routine will give correct results regardless of whether the underlying representation is a native or large integer.

Precondition
If bytes is larger than sizeof(long), then bytes is a strict multiple of sizeof(long). For instance, if longs are 8 bytes then you can use this routine with bytes=16 but not bytes=12. This restriction is enforced through a compile-time assertion, but may be lifted in future versions of Regina.
This integer is not infinity.
Python:
Not present.
Returns
the value of this integer.
template<bool supportInfinity>
void regina::NIntegerBase< supportInfinity >::negate ( )
inline

Negates this integer.

This integer is changed to reflect the result.

Negating infinity will result in infinity.

template<bool supportInfinity>
bool regina::NIntegerBase< supportInfinity >::operator!= ( const NIntegerBase< supportInfinity > &  rhs) const
inline

Determines if this is not equal to the given integer.

Parameters
rhsthe integer with which this will be compared.
Returns
true if and only if this and the given integer are not equal.
template<bool supportInfinity>
bool regina::NIntegerBase< supportInfinity >::operator!= ( const NIntegerBase<!supportInfinity > &  rhs) const
inline

Determines if this is not equal to the given integer.

Parameters
rhsthe integer with which this will be compared.
Returns
true if and only if this and the given integer are not equal.
template<bool supportInfinity>
bool regina::NIntegerBase< supportInfinity >::operator!= ( long  rhs) const
inline

Determines if this is not equal to the given integer.

Parameters
rhsthe integer with which this will be compared.
Returns
true if and only if this and the given integer are not equal.
template<bool supportInfinity>
NIntegerBase< supportInfinity > regina::NIntegerBase< supportInfinity >::operator% ( const NIntegerBase< supportInfinity > &  other) const
inline

Determines the remainder when this integer is divided by the given integer.

If non-zero, the result will have the same sign as this integer. This integer is not changed.

For a division routine that always returns a non-negative remainder, see divisionAlg().

Precondition
other is not zero.
Neither this nor other is infinite.
Warning
As I understand it, the sign of the result under native C/C++ integer division when the second operand is negative was fixed in the C++11 specification, but left to the compiler implementation in earlier versions of the specification; however, any modern hardware should satisfy the C++11 sign rule as described above.
Parameters
otherthe integer to divide this by.
Returns
the remainder this modulo other.
template<bool supportInfinity>
NIntegerBase< supportInfinity > regina::NIntegerBase< supportInfinity >::operator% ( long  other) const
inline

Determines the remainder when this integer is divided by the given integer.

If non-zero, the result will have the same sign as this integer. This integer is not changed.

For a division routine that always returns a non-negative remainder, see divisionAlg().

Precondition
other is not zero.
This integer is not infinite.
Warning
As I understand it, the sign of the result under native C/C++ integer division when the second operand is negative was fixed in the C++11 specification, but left to the compiler implementation in earlier versions of the specification; however, any modern hardware should satisfy the C++11 sign rule as described above.
Parameters
otherthe integer to divide this by.
Returns
the remainder this modulo other.
template<bool supportInfinity = false>
NIntegerBase& regina::NIntegerBase< supportInfinity >::operator%= ( const NIntegerBase< supportInfinity > &  other)

Reduces this integer modulo the given integer.

If non-zero, the result will have the same sign as the original value of this integer. This integer is changed to reflect the result.

For a mod routine that always returns a non-negative remainder, see divisionAlg().

Precondition
other is not zero.
Neither this nor other is infinite.
Warning
As I understand it, the sign of the result under native C/C++ integer division when the second operand is negative was fixed in the C++11 specification, but left to the compiler implementation in earlier versions of the specification; however, any modern hardware should satisfy the C++11 sign rule as described above.
Parameters
otherthe integer modulo which this integer will be reduced.
Returns
a reference to this integer with its new value.
template<bool supportInfinity = false>
NIntegerBase& regina::NIntegerBase< supportInfinity >::operator%= ( long  other)

Reduces this integer modulo the given integer.

If non-zero, the result will have the same sign as the original value of this integer. This integer is changed to reflect the result.

For a mod routine that always returns a non-negative remainder, see divisionAlg().

Precondition
other is not zero.
This integer is not infinite.
Warning
As I understand it, the sign of the result under native C/C++ integer division when the second operand is negative was fixed in the C++11 specification, but left to the compiler implementation in earlier versions of the specification; however, any modern hardware should satisfy the C++11 sign rule as described above.
Parameters
otherthe integer modulo which this integer will be reduced.
Returns
a reference to this integer with its new value.
template<bool supportInfinity>
NIntegerBase< supportInfinity > regina::NIntegerBase< supportInfinity >::operator* ( const NIntegerBase< supportInfinity > &  other) const
inline

Multiplies this by the given integer and returns the result.

This integer is not changed.

If either factor of the product is infinite, the result will be infinity.

Parameters
otherthe integer to multiply by this integer.
Returns
the product this times other.
template<bool supportInfinity>
NIntegerBase< supportInfinity > regina::NIntegerBase< supportInfinity >::operator* ( long  other) const
inline

Multiplies this by the given integer and returns the result.

This integer is not changed.

If either factor of the product is infinite, the result will be infinity.

Parameters
otherthe integer to multiply by this integer.
Returns
the product this times other.
template<bool supportInfinity = false>
NIntegerBase& regina::NIntegerBase< supportInfinity >::operator*= ( const NIntegerBase< supportInfinity > &  other)

Multiplies the given integer by this.

This integer is changed to reflect the result.

If either factor of the product is infinite, the result will be infinity.

Parameters
otherthe integer to multiply with this integer.
Returns
a reference to this integer with its new value.
template<bool supportInfinity = false>
NIntegerBase& regina::NIntegerBase< supportInfinity >::operator*= ( long  other)

Multiplies the given integer by this.

This integer is changed to reflect the result.

If either factor of the product is infinite, the result will be infinity.

Parameters
otherthe integer to multiply with this integer.
Returns
a reference to this integer with its new value.
template<bool supportInfinity>
NIntegerBase< supportInfinity > regina::NIntegerBase< supportInfinity >::operator+ ( const NIntegerBase< supportInfinity > &  other) const
inline

Adds this to the given integer and returns the result.

This integer is not changed.

If either term of the sum is infinite, the result will be infinity.

Parameters
otherthe integer to add to this integer.
Returns
the sum this plus other.
template<bool supportInfinity>
NIntegerBase< supportInfinity > regina::NIntegerBase< supportInfinity >::operator+ ( long  other) const
inline

Adds this to the given integer and returns the result.

This integer is not changed.

If either term of the sum is infinite, the result will be infinity.

Parameters
otherthe integer to add to this integer.
Returns
the sum this plus other.
template<bool supportInfinity>
NIntegerBase< supportInfinity > & regina::NIntegerBase< supportInfinity >::operator++ ( )
inline

The preincrement operator.

This operator increments this integer by one, and returns a reference to the integer after the increment.

Python:
Not available.
Returns
a reference to this integer after the increment.
template<bool supportInfinity>
NIntegerBase< supportInfinity > regina::NIntegerBase< supportInfinity >::operator++ ( int  )
inline

The postincrement operator.

This operator increments this integer by one, and returns a copy of the integer before the increment.

Python:
Not available.
Returns
a copy of this integer before the increment took place.
template<bool supportInfinity>
NIntegerBase< supportInfinity > & regina::NIntegerBase< supportInfinity >::operator+= ( const NIntegerBase< supportInfinity > &  other)
inline

Adds the given integer to this.

This integer is changed to reflect the result.

If either term of the sum is infinite, the result will be infinity.

Parameters
otherthe integer to add to this integer.
Returns
a reference to this integer with its new value.
template<bool supportInfinity = false>
NIntegerBase& regina::NIntegerBase< supportInfinity >::operator+= ( long  other)

Adds the given integer to this.

This integer is changed to reflect the result.

If either term of the sum is infinite, the result will be infinity.

Parameters
otherthe integer to add to this integer.
Returns
a reference to this integer with its new value.
template<bool supportInfinity>
NIntegerBase< supportInfinity > regina::NIntegerBase< supportInfinity >::operator- ( const NIntegerBase< supportInfinity > &  other) const
inline

Subtracts the given integer from this and returns the result.

This integer is not changed.

If either term of the difference is infinite, the result will be infinity.

Parameters
otherthe integer to subtract from this integer.
Returns
the difference this minus other.
template<bool supportInfinity>
NIntegerBase< supportInfinity > regina::NIntegerBase< supportInfinity >::operator- ( long  other) const
inline

Subtracts the given integer from this and returns the result.

This integer is not changed.

If either term of the difference is infinite, the result will be infinity.

Parameters
otherthe integer to subtract from this integer.
Returns
the difference this minus other.
template<bool supportInfinity>
NIntegerBase< supportInfinity > regina::NIntegerBase< supportInfinity >::operator- ( ) const
inline

Determines the negative of this integer.

This integer is not changed.

Negative infinity will return infinity.

Returns
the negative of this integer.
template<bool supportInfinity>
NIntegerBase< supportInfinity > & regina::NIntegerBase< supportInfinity >::operator-- ( )
inline

The predecrement operator.

This operator decrements this integer by one, and returns a reference to the integer after the decrement.

Python:
Not available.
Returns
a reference to this integer after the decrement.
template<bool supportInfinity>
NIntegerBase< supportInfinity > regina::NIntegerBase< supportInfinity >::operator-- ( int  )
inline

The postdecrement operator.

This operator decrements this integer by one, and returns a copy of the integer before the decrement.

Python:
Not available.
Returns
a copy of this integer before the decrement took place.
template<bool supportInfinity>
NIntegerBase< supportInfinity > & regina::NIntegerBase< supportInfinity >::operator-= ( const NIntegerBase< supportInfinity > &  other)
inline

Subtracts the given integer from this.

This integer is changed to reflect the result.

If either term of the difference is infinite, the result will be infinity.

Parameters
otherthe integer to subtract from this integer.
Returns
a reference to this integer with its new value.
template<bool supportInfinity = false>
NIntegerBase& regina::NIntegerBase< supportInfinity >::operator-= ( long  other)

Subtracts the given integer from this.

This integer is changed to reflect the result.

If either term of the difference is infinite, the result will be infinity.

Parameters
otherthe integer to subtract from this integer.
Returns
a reference to this integer with its new value.
template<bool supportInfinity>
NIntegerBase< supportInfinity > regina::NIntegerBase< supportInfinity >::operator/ ( const NIntegerBase< supportInfinity > &  other) const
inline

Divides this by the given integer and returns the result.

The result will be truncated to an integer, i.e. rounded towards zero. This integer is not changed.

If other is known to divide this integer exactly, divExact() should be used instead.

Infinity divided by anything will return infinity. Anything finite divided by infinity will return zero. Anything finite divided by zero will return infinity.

For a division routine that always rounds down, see divisionAlg().

Precondition
If this class does not support infinity, then other must be non-zero.
Warning
As I understand it, the direction of rounding for native C/C++ integer division was fixed in the C++11 specification, but left to the compiler implementation in earlier versions of the specification; however, any modern hardware should satisfy the C++11 rounding rule as described above.
Parameters
otherthe integer to divide this by.
Returns
the quotient this divided by other.
template<bool supportInfinity>
NIntegerBase< supportInfinity > regina::NIntegerBase< supportInfinity >::operator/ ( long  other) const
inline

Divides this by the given integer and returns the result.

The result will be truncated to an integer, i.e. rounded towards zero. This integer is not changed.

If other is known to divide this integer exactly, divExact() should be used instead.

Infinity divided by anything will return infinity. Anything finite divided by zero will return infinity.

For a division routine that always rounds down, see divisionAlg().

Precondition
If this class does not support infinity, then other must be non-zero.
Warning
As I understand it, the direction of rounding for native C/C++ integer division was fixed in the C++11 specification, but left to the compiler implementation in earlier versions of the specification; however, any modern hardware should satisfy the C++11 rounding rule as described above.
Parameters
otherthe integer to divide this by.
Returns
the quotient this divided by other.
template<bool supportInfinity = false>
NIntegerBase& regina::NIntegerBase< supportInfinity >::operator/= ( const NIntegerBase< supportInfinity > &  other)

Divides this by the given integer.

The result will be truncated to an integer, i.e. rounded towards zero. This integer is changed to reflect the result.

If other is known to divide this integer exactly, divByExact() should be used instead.

Infinity divided by anything will return infinity. Anything finite divided by infinity will return zero. Anything finite divided by zero will return infinity.

For a division routine that always rounds down, see divisionAlg().

Precondition
If this class does not support infinity, then other must be non-zero.
Warning
As I understand it, the direction of rounding for native C/C++ integer division was fixed in the C++11 specification, but left to the compiler implementation in earlier versions of the specification; however, any modern hardware should satisfy the C++11 rounding rule as described above.
Parameters
otherthe integer to divide this by.
Returns
a reference to this integer with its new value.
template<bool supportInfinity = false>
NIntegerBase& regina::NIntegerBase< supportInfinity >::operator/= ( long  other)

Divides this by the given integer.

The result will be truncated to an integer, i.e. rounded towards zero. This integer is changed to reflect the result.

If other is known to divide this integer exactly, divByExact() should be used instead.

Infinity divided by anything will return infinity. Anything finite divided by zero will return infinity.

For a division routine that always rounds down, see divisionAlg().

Precondition
If this class does not support infinity, then other must be non-zero.
Warning
As I understand it, the direction of rounding for native C/C++ integer division was fixed in the C++11 specification, but left to the compiler implementation in earlier versions of the specification; however, any modern hardware should satisfy the C++11 rounding rule as described above.
Parameters
otherthe integer to divide this by.
Returns
a reference to this integer with its new value.
template<bool supportInfinity>
bool regina::NIntegerBase< supportInfinity >::operator< ( const NIntegerBase< supportInfinity > &  rhs) const
inline

Determines if this is less than the given integer.

Parameters
rhsthe integer with which this will be compared.
Returns
true if and only if this is less than the given integer.
template<bool supportInfinity>
bool regina::NIntegerBase< supportInfinity >::operator< ( long  rhs) const
inline

Determines if this is less than the given integer.

Parameters
rhsthe integer with which this will be compared.
Returns
true if and only if this is less than the given integer.
template<bool supportInfinity>
bool regina::NIntegerBase< supportInfinity >::operator<= ( const NIntegerBase< supportInfinity > &  rhs) const
inline

Determines if this is less than or equal to the given integer.

Parameters
rhsthe integer with which this will be compared.
Returns
true if and only if this is less than or equal to the given integer.
template<bool supportInfinity>
bool regina::NIntegerBase< supportInfinity >::operator<= ( long  rhs) const
inline

Determines if this is less than or equal to the given integer.

Parameters
rhsthe integer with which this will be compared.
Returns
true if and only if this is less than or equal to the given integer.
template<bool supportInfinity>
NIntegerBase< supportInfinity > & regina::NIntegerBase< supportInfinity >::operator= ( const NIntegerBase< supportInfinity > &  value)
inline

Sets this integer to the given value.

Parameters
valuethe new value of this integer.
Returns
a reference to this integer with its new value.
template<bool supportInfinity>
NIntegerBase< supportInfinity > & regina::NIntegerBase< supportInfinity >::operator= ( const NIntegerBase<!supportInfinity > &  value)
inline

Sets this integer to the given value.

Precondition
The given integer is not infinite.
Parameters
valuethe new value of this integer.
Returns
a reference to this integer with its new value.
template<bool supportInfinity>
NIntegerBase< supportInfinity > & regina::NIntegerBase< supportInfinity >::operator= ( int  value)
inline

Sets this integer to the given value.

Parameters
valuethe new value of this integer.
Returns
a reference to this integer with its new value.
template<bool supportInfinity>
NIntegerBase< supportInfinity > & regina::NIntegerBase< supportInfinity >::operator= ( unsigned  value)
inline

Sets this integer to the given value.

Parameters
valuethe new value of this integer.
Returns
a reference to this integer with its new value.
template<bool supportInfinity>
NIntegerBase< supportInfinity > & regina::NIntegerBase< supportInfinity >::operator= ( long  value)
inline

Sets this integer to the given value.

Parameters
valuethe new value of this integer.
Returns
a reference to this integer with its new value.
template<bool supportInfinity>
NIntegerBase< supportInfinity > & regina::NIntegerBase< supportInfinity >::operator= ( unsigned long  value)
inline

Sets this integer to the given value.

Parameters
valuethe new value of this integer.
Returns
a reference to this integer with its new value.
template<bool supportInfinity = false>
NIntegerBase& regina::NIntegerBase< supportInfinity >::operator= ( const char *  value)

Sets this integer to the given value which is represented as a string of digits in base 10.

Whitespace may be present at the beginning or end of the given string and will simply be ignored.

Precondition
The given string represents an integer in base 10, with optional whitespace added.
Parameters
valuethe new value of this integer, represented as a string of digits in base 10.
Returns
a reference to this integer with its new value.
template<bool supportInfinity>
NIntegerBase< supportInfinity > & regina::NIntegerBase< supportInfinity >::operator= ( const std::string &  value)
inline

Sets this integer to the given value which is represented as a string of digits in base 10.

Whitespace may be present at the beginning or end of the given string and will simply be ignored.

Precondition
The given string represents an integer in base 10, with optional whitespace added.
Parameters
valuethe new value of this integer, represented as a string of digits in base 10.
Returns
a reference to this integer with its new value.
template<bool supportInfinity>
bool regina::NIntegerBase< supportInfinity >::operator== ( const NIntegerBase< supportInfinity > &  rhs) const
inline

Determines if this is equal to the given integer.

Parameters
rhsthe integer with which this will be compared.
Returns
true if and only if this and the given integer are equal.
template<bool supportInfinity>
bool regina::NIntegerBase< supportInfinity >::operator== ( const NIntegerBase<!supportInfinity > &  rhs) const
inline

Determines if this is equal to the given integer.

Parameters
rhsthe integer with which this will be compared.
Returns
true if and only if this and the given integer are equal.
template<bool supportInfinity>
bool regina::NIntegerBase< supportInfinity >::operator== ( long  rhs) const
inline

Determines if this is equal to the given integer.

Parameters
rhsthe integer with which this will be compared.
Returns
true if and only if this and the given integer are equal.
template<bool supportInfinity>
bool regina::NIntegerBase< supportInfinity >::operator> ( const NIntegerBase< supportInfinity > &  rhs) const
inline

Determines if this is greater than the given integer.

Parameters
rhsthe integer with which this will be compared.
Returns
true if and only if this is greater than the given integer.
template<bool supportInfinity>
bool regina::NIntegerBase< supportInfinity >::operator> ( long  rhs) const
inline

Determines if this is greater than the given integer.

Parameters
rhsthe integer with which this will be compared.
Returns
true if and only if this is greater than the given integer.
template<bool supportInfinity>
bool regina::NIntegerBase< supportInfinity >::operator>= ( const NIntegerBase< supportInfinity > &  rhs) const
inline

Determines if this is greater than or equal to the given integer.

Parameters
rhsthe integer with which this will be compared.
Returns
true if and only if this is greater than or equal to the given integer.
template<bool supportInfinity>
bool regina::NIntegerBase< supportInfinity >::operator>= ( long  rhs) const
inline

Determines if this is greater than or equal to the given integer.

Parameters
rhsthe integer with which this will be compared.
Returns
true if and only if this is greater than or equal to the given integer.
template<bool supportInfinity = false>
void regina::NIntegerBase< supportInfinity >::raiseToPower ( unsigned long  exp)

Raises this integer to the power of the given exponent.

This integer is changed to reflect the result.

Note that 0 to the power of 0 will be 1, infinity to the power of 0 will be 1, and infinity to the power of anything else will be infinity.

Precondition
The given exponent is non-negative.
Parameters
expthe power to which this integer will be raised.
template<bool supportInfinity = false>
static NIntegerBase<supportInfinity> regina::NIntegerBase< supportInfinity >::randomBinary ( unsigned long  n)
static

Generate a pseudo-random integer that is uniformly distributed in the interval [0,2^n).

Parameters
nthe maximum number of bits in the pseudo-random integer.
Returns
a pseudo-random integer.
template<bool supportInfinity = false>
NIntegerBase<supportInfinity> regina::NIntegerBase< supportInfinity >::randomBoundedByThis ( ) const

Generate a pseudo-random integer that is uniformly distributed in the interval [0,*this).

Precondition
This integer is strictly positive.
Warning
Even if this integer is small, this routine is still slow - it always goes through the GMP large integer routines so that the random number generation algorithm is consistent. If you need a fast random number generator and this integer is small, consider using the standard rand() function instead.
Returns
a pseudo-random integer.
template<bool supportInfinity = false>
static NIntegerBase<supportInfinity> regina::NIntegerBase< supportInfinity >::randomCornerBinary ( unsigned long  n)
static

Generate a pseudo-random integer that is distributed in the interval [0,2^n), with a tendency to have long strings of 0s and 1s in its binary expansion.

Parameters
nthe maximum number of bits in the pseudo-random integer.
Returns
a pseudo-random integer.
template<bool supportInfinity>
mpz_srcptr regina::NIntegerBase< supportInfinity >::rawData ( ) const
inline

Returns the raw GMP data that describes this integer.

This routine allows NIntegerBase to interact directly with libgmp and libgmpxx if necessary.

Warning
This routine will have the side-effect of converting this integer to a (bulkier and slower) GMP representation, regardless of whether it is small enough to fit within a native integer. Excessive use of this routine could lead to a significant performance loss. It is best to use this only when isNative() is already known to return false.
Precondition
This integer is not infinite.
Python:
Not available.
Returns
the raw GMP data.
template<bool supportInfinity>
mpz_ptr regina::NIntegerBase< supportInfinity >::rawData ( )
inline

Returns the raw GMP data that describes this integer.

This routine allows NIntegerBase to interact directly with libgmp and libgmpxx if necessary.

Warning
This routine will have the side-effect of converting this integer to a (bulkier and slower) GMP representation, regardless of whether it is small enough to fit within a native integer. Excessive use of this routine could lead to a significant performance loss. It is best to use this only when isNative() is already known to return false.
Precondition
This integer is not infinite.
Python:
Not available.
Returns
the raw GMP data.
template<bool supportInfinity>
void regina::NIntegerBase< supportInfinity >::setRaw ( mpz_srcptr  fromData)
inline

Set this to a copy of the given raw GMP integer.

This routine allows NIntegerBase to interact directly with libgmp and libgmpxx if necessary.

Python:
Not available.
Parameters
fromDatathe raw GMP integer to clone.
template<bool supportInfinity>
int regina::NIntegerBase< supportInfinity >::sign ( ) const
inline

Returns the sign of this integer.

In this routine, infinity is considered to have sign +1.

Returns
+1, -1 or 0 according to whether this integer is positive, negative or zero.
template<bool supportInfinity = false>
std::string regina::NIntegerBase< supportInfinity >::stringValue ( int  base = 10) const

Returns the value of this integer as a string in the given base.

If not specified, the base defaults to 10.

If this integer is infinity, the string returned will be inf.

Precondition
The given base is between 2 and 36 inclusive.
Returns
the value of this integer as a newly allocated string.
template<bool supportInfinity = false>
void regina::NIntegerBase< supportInfinity >::swap ( NIntegerBase< supportInfinity > &  other)

Swaps the values of this and the given integer.

Parameters
otherthe integer whose value will be swapped with this.
template<bool supportInfinity>
void regina::NIntegerBase< supportInfinity >::tryReduce ( )
inline

Converts this integer to use a native C/C++ long representation, if this is possible.

However, if this integer is outside the range of a C/C++ long, then it will remain as a GMP large integer instead (i.e., nothing will change). Whatever happens, the contents of this integer will be preserved.

It does not matter which kind of representation this integer is currently using.

Precondition
This integer is not infinite.

Member Data Documentation

template<bool supportInfinity = false>
const NIntegerBase<supportInfinity> regina::NIntegerBase< supportInfinity >::infinity
static

Globally available infinity.

This is only defined if supportInfinity is true. Any attempt to use it when supportInfinity is false should generate a linker error.

template<bool supportInfinity = false>
const NIntegerBase<supportInfinity> regina::NIntegerBase< supportInfinity >::one
static

Globally available one.

template<bool supportInfinity = false>
const NIntegerBase<supportInfinity> regina::NIntegerBase< supportInfinity >::zero
static

Globally available zero.


The documentation for this singleton was generated from the following file:

Copyright © 1999-2014, The Regina development team
This software is released under the GNU General Public License, with some additional permissions; see the source code for details.
For further information, or to submit a bug or other problem, please contact Ben Burton (bab@debian.org).