Main Page | Modules | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

mp::mpf Class Reference
[Floating point numbers]

User class that provides an interface to use floating point numbers with the MP++ library. More...

#include <mpf.h>

Inheritance diagram for mp::mpf:

mp::mpf_ mp::mpi_ mp::mpn_ List of all members.

Pseudo-random number generator

void prng (size_type n)
 Generate a pseudo-random number.
static void prng_seed (limb_long_type seed)
 Set the PRNG seed.
static void prng_seed (const mpn_ &seed)
 Set the PRNG seed.

Public Types

typedef mp::float_type float_type
 Type for float conversion.
typedef mp::int_type int_type
 Type for integer conversion.
typedef mp::size_type size_type
 Type of index registers.
typedef mp::limb_type limb_type
 Type of normal limbs.
typedef mp::limb_long_type limb_long_type
 Type of double-long limbs.
typedef mp::radix_type radix_type
 Type of radix identifier.

Public Member Functions

 mpf (const mpf_ &n)
 mpf ()
 mpf (int_type n, size_type p=0)
 mpf (float_type n, size_type p=0)
 mpf (const mpi &n, size_type p=0)
 mpf (const mpf &n, size_type p=0)
 mpf (const std::string &s, char b=0)
mpfoperator++ ()
const mpf operator++ (int)
mpfoperator-- ()
const mpf operator-- (int)
const mpfoperator= (int_type n)
const mpfoperator= (float_type n)
const mpfoperator= (const mpi &n)
const mpfoperator= (const mpf &n)
const mpfoperator= (const std::string &n)
const mpfoperator+= (int_type n)
const mpfoperator+= (float_type n)
const mpfoperator+= (const mpi &n)
const mpfoperator+= (const mpf &n)
const mpfoperator-= (int_type n)
const mpfoperator-= (float_type n)
const mpfoperator-= (const mpi &n)
const mpfoperator-= (const mpf &n)
const mpfoperator *= (int_type n)
const mpfoperator *= (float_type n)
const mpfoperator *= (const mpi &n)
const mpfoperator *= (const mpf &n)
const mpfoperator/= (int_type n)
const mpfoperator/= (float_type n)
const mpfoperator/= (const mpi &n)
const mpfoperator/= (const mpf &n)
const mpfoperator%= (const mpf &n)
void init (int_type n, size_type p=0)
void init (float_type n, size_type p=0)
void init (const mpi_ &n, size_type p=0)
void init (const mpf_ &n, size_type p=0)
void setPrecision (size_type prec)
void clear ()
 Resets the number.
void swap (mpf_ &n)
 Swaps this with n.
mpi_ ipart () const
mpi_ fpart () const
mpf_ getIntPart () const
mpf_ getFractPart () const
size_type accuracy () const
 Accuracy to zero.
size_type accuracy (const mpf_ &n) const
 Accuracy to another number.
int compare (const mpf_ &n) const
 Compare two numbers.
int compare (const mpi_ &n) const
 Compare two MPIs.
void checkExp ()
 Check exponant for bad conditions.
void checkNeg ()
 Makes sure no -0 condition can exist.
void setUse ()
 Sets the local use_ variable after an operation.
Conversion operators
 operator int_type () const
 operator float_type () const
 operator std::string () const
 operator mpi () const
Conversion functions
int_type toInt () const
 Conversion to standard signed integer type.
float_type toFloat () const
 Conversion to standard signed integer type.
Initialization and basic alteration
void init (limb_type n, size_type size=0)
 Initialization to single limb.
void init (const mpn_ &n, size_type size=0)
 Initialization to MPN.
void swap (mpn_ &n)
 Swaps this with n.
Initialization and basic alteration
void swap (mpi_ &n)
 Swaps this with n.
void resize (size_type size)
 Resizes to size bits.
Comparison
int compare (const mpn_ &n) const
 Compare two MPNs.
Information retreval
size_type getPrecision () const
 Get the current precision of the number.
size_type getExponant () const
 Get the current exponent of the number.
bool hasIntPart () const
 Get the current precision of the number.
bool hasFractPart () const
 Get the current precision of the number.
void normalize (mpf_ &n)
 Normalize the base MPIs over their radix points.
Algebraic functions
void add (const mpf_ &n, size_type p=0)
void sub (const mpf_ &n, size_type p=0)
void mul (const mpf_ &n, size_type p=0)
void div (const mpf_ &n, size_type p=0)
void mod (const mpf_ &n, size_type p=0)
void mul_pow2 (size_type n)
void div_pow2 (size_type n)
void sqr ()
Algebraic functions
void add (const mpi_ &n)
 Addition of an MPI.
void sub (const mpi_ &n)
 Subtraction of an MPI.
void mul (const mpi_ &n)
 Multiplication by an MPI.
void div (const mpi_ &n)
 Division by an MPI.
void mod (const mpi_ &n)
 Modulus by an MPI.
Algebraic functions
void add (const mpn_ &n)
 Addition of an MPN.
void sub (const mpn_ &n)
 Subtraction of an MPN.
void mul (const mpn_ &n)
 Multiplication by an MPN.
void div_mod (mpn_ &n)
 Division by an MPN.
Additional arithmetic operations
mpf_ pow (const mpf_ &n, size_type p=0) const
 Take the number to a real power.
mpf_ sqrt (size_type p=0) const
 Find the square root of a number.
mpf_ root (limb_type n, size_type p=0) const
 Find the integer root of a number.
mpf_ exp (size_type p=0) const
 Set the number to the exponential function of itself.
mpf_ log (size_type p=0) const
 Set the number to the natural logarithm of itself.
mpf_ agm (const mpf_ &n, size_type p) const
 Computes arithmetic-geometric mean.
void pi (size_type p)
 Get a truncated value of Pi.
Additional arithmetic operations
mpi_ pow (int_type e) const
 Exponentation.
void negate ()
 Flips the sign register, AKA negates.
void abs ()
 Clears the sign register, AKA takes the absolute value.
mpi_ pow_mod (const mpi_ &e, const mpi_ &m) const
 Performs modular exponentiation.
String conversion
void setString (const std::string &s, radix_type b=0)
 String input.
std::string getString (radix_type b=string_base) const
 String output.
Debugging output
void print () const
 Binary dump to stdout.
Information retreval
bool isNeg () const
 Is the number negative?
size_type size () const
 Find the number of bits in use.
Bit shifting
void shift_l (size_type n)
 Left shift.
void shift_r (size_type n)
 Right shift.
Information retreval
bool isZero () const
 Is the number zero?
size_type low_zeros () const
 Returns number of consecutive zero limbs, starting at the lowest limb.
Raw accessors
Data format is

raw_type getRaw () const
 Raw data output.
void setRaw (const raw_type &data)
 Raw data input.
Limb retreval overloads
Subscript operator is overloaded to allow users to interact with the individual limbs of a number in a safe way.

const limb_typeoperator[] (size_type i) const
 Const limb retreval.
limb_typeoperator[] (size_type i)
 Limb retreval and writing.
Bitwise functions
size_type popcount () const
 Population count.
void bitwise (const mpn_ &y, int type)
 Binary bitwise operations.
void bitwise_not ()
 Bitwise not operation.

Static Public Member Functions

static const byte capabilities ()
 A bitmask of this class' numerical and functional capabilities.
static void resetMinPrecision ()
 Sets the minimum precision to the default value.
static void setMinPrecision (size_type p)
 Sets the minimum precision for calculations when no precision is given.
static size_type getMinPrecision ()
 Gets the global minimum precision.
static void setDefaultBase (radix_type b)
 Sets the default base for string conversion.
static radix_type getDefaultBase ()
 Gets the default base for string conversion.
static void interrupt ()
 Interrupt the next main (math, string, PRNG) operation that runs.

Static Public Attributes

static const size_type limb_size_bits = _MP_SIZE / 2
 Size of a single limb (in bits).
static const limb_type limb_full = (1 << limb_size_bits) - 1
 A limb with all bits set.
static const size_type size_max = INT_MAX
 The largest positive size_type value.
static const std::string string_digits = _MP_STR_DIGIT
 The digits used in string conversion.

Protected Member Functions

void onInterrupt () const
 Activated when interrupt register is set.
Algebraic functions with single limbs
These are much faster than the normal algebraic functions, and are called anyway if the argument fits within a single limb.

void add_l (limb_type n)
 Addition of a single limb.
void sub_l (limb_type n)
 Subtraction of a single limb.
void mul_l (limb_type n)
 Multiplacation by a single limb.
void div_mod_l (limb_type &n)
 Division by a single limb.

Protected Attributes

size_type exp_
 floating point exponant, relative to MSL
bool neg_
 negativity register (true if negative).
size_type alloc_
 Number of limbs allocated, pointed to by data.
size_type use_
 Number of limbs used (always <= alloc).
limb_typedata_
 Pointer to the data.

Static Protected Attributes

static size_type min_precision = _MPF_MIN_PREC
 Global minimum precision.
static const size_type min_prec_default = _MPF_MIN_PREC
 Default minimum precision.
static radix_type string_base = _MP_STR_BASE
 Default base for string conversion.
static bool interrupted
 Interrupt register.

Detailed Description

User class that provides an interface to use floating point numbers with the MP++ library.

All standard arithmetic, logical, conversion, and comparison operators are overloaded, so no knowledge of the underlying functions is required.

Most overloads function just as if operating on standard floating point types, except that there is no chance (within the available heap) of overflow or underflow.


Member Typedef Documentation

typedef mp::float_type mp::mpf_::float_type [inherited]
 

Type for float conversion.

typedef mp::int_type mp::mpi_::int_type [inherited]
 

Type for integer conversion.

typedef mp::limb_long_type mp::mpn_::limb_long_type [inherited]
 

Type of double-long limbs.

typedef mp::limb_type mp::mpn_::limb_type [inherited]
 

Type of normal limbs.

typedef mp::radix_type mp::mpn_::radix_type [inherited]
 

Type of radix identifier.

typedef mp::size_type mp::mpn_::size_type [inherited]
 

Type of index registers.


Constructor & Destructor Documentation

mp::mpf::mpf const mpf_ n  )  [inline]
 

mp::mpf::mpf  )  [inline]
 

mp::mpf::mpf int_type  n,
size_type  p = 0
[inline]
 

mp::mpf::mpf float_type  n,
size_type  p = 0
[inline]
 

mp::mpf::mpf const mpi n,
size_type  p = 0
[inline]
 

mp::mpf::mpf const mpf n,
size_type  p = 0
[inline]
 

mp::mpf::mpf const std::string &  s,
char  b = 0
[inline]
 


Member Function Documentation

void mp::mpi_::abs  )  [inherited]
 

Clears the sign register, AKA takes the absolute value.

size_type mp::mpf_::accuracy const mpf_ n  )  const [inherited]
 

Accuracy to another number.

Parameters:
n Number to compare to
Returns:
Number of consecutively equal bits below the radix point between this and n

size_type mp::mpf_::accuracy  )  const [inherited]
 

Accuracy to zero.

Returns:
Number of consecutive zero bits below the radix point

void mp::mpn_::add const mpn_ n  )  [inherited]
 

Addition of an MPN.

Parameters:
n Number to add

void mp::mpi_::add const mpi_ n  )  [inherited]
 

Addition of an MPI.

Parameters:
n Number to add

void mp::mpf_::add const mpf_ n,
size_type  p = 0
[inherited]
 

void mp::mpn_::add_l limb_type  n  )  [protected, inherited]
 

Addition of a single limb.

Parameters:
n Limb to add

mpf_ mp::mpf_::agm const mpf_ n,
size_type  p
const [inherited]
 

Computes arithmetic-geometric mean.

Parameters:
n Second paramater
p Minimum precision of result
Returns:
Result

void mp::mpn_::bitwise const mpn_ y,
int  type
[inherited]
 

Binary bitwise operations.

Parameters:
y Second parameter of the operation
type Type of bitwise operation to perform
  • 1: AND
  • 2: OR
  • 3: XOR

void mp::mpn_::bitwise_not  )  [inherited]
 

Bitwise not operation.

Operates on chunks of bytes, so that a not of a not is equal to the origional.

const byte mp::mpf_::capabilities  )  [static, inherited]
 

A bitmask of this class' numerical and functional capabilities.

Reimplemented from mp::mpi_.

void mp::mpf_::checkExp  )  [inherited]
 

Check exponant for bad conditions.

Makes sure that the exponant is zero if the number is zero

void mp::mpi_::checkNeg  )  [inherited]
 

Makes sure no -0 condition can exist.

void mp::mpf_::clear  )  [inherited]
 

Resets the number.

Reimplemented from mp::mpi_.

int mp::mpn_::compare const mpn_ n  )  const [inherited]
 

Compare two MPNs.

Parameters:
n Number to compare with
Returns:
sign(this - n)

int mp::mpi_::compare const mpi_ n  )  const [inherited]
 

Compare two MPIs.

Parameters:
n Number to compare with
Returns:
sign(this - n)

int mp::mpf_::compare const mpf_ n  )  const [inherited]
 

Compare two numbers.

Parameters:
n Number to compare to
Returns:
sign(this - n)

void mp::mpi_::div const mpi_ n  )  [inherited]
 

Division by an MPI.

Parameters:
n Number to divide by. If 0, a range_error exception is thrown.

void mp::mpf_::div const mpf_ n,
size_type  p = 0
[inherited]
 

void mp::mpn_::div_mod mpn_ n  )  [inherited]
 

Division by an MPN.

Parameters:
n Divisor and remainder storage. If less than 0, a range_error is thrown.

void mp::mpn_::div_mod_l limb_type n  )  [protected, inherited]
 

Division by a single limb.

Parameters:
n Divisor and remainder storage. If less than 0, a range_error is thrown.

void mp::mpf_::div_pow2 size_type  n  )  [inherited]
 

mpf_ mp::mpf_::exp size_type  p = 0  )  const [inherited]
 

Set the number to the exponential function of itself.

Parameters:
p Minimum precision of result
Returns:
Result

mpi_ mp::mpf_::fpart  )  const [inherited]
 

radix_type mp::mpi_::getDefaultBase  )  [static, inherited]
 

Gets the default base for string conversion.

Returns:
Current default string base

size_type mp::mpf_::getExponant  )  const [inherited]
 

Get the current exponent of the number.

Returns:
The exponant as a power of 2

mpf_ mp::mpf_::getFractPart  )  const [inherited]
 

mpf_ mp::mpf_::getIntPart  )  const [inherited]
 

size_type mp::mpf_::getMinPrecision  )  [static, inherited]
 

Gets the global minimum precision.

Returns:
Precision in bits

mpf_::size_type mp::mpf_::getPrecision  )  const [inherited]
 

Get the current precision of the number.

Returns:
Size of the mantissa in bits

raw_type mp::mpn_::getRaw  )  const [inherited]
 

Raw data output.

string mp::mpf_::getString radix_type  b = string_base  )  const [inherited]
 

String output.

Converts number to a string in base b.

Parameters:
b Base of the output string.
Returns:
Output string

Reimplemented from mp::mpi_.

bool mp::mpf_::hasFractPart  )  const [inherited]
 

Get the current precision of the number.

Returns:
Size of the mantissa in bits

bool mp::mpf_::hasIntPart  )  const [inherited]
 

Get the current precision of the number.

Returns:
Size of the mantissa in bits

void mp::mpn_::init const mpn_ n,
size_type  size = 0
[inherited]
 

Initialization to MPN.

MPN is truncated or padded with zeros in the to fit the size.

Parameters:
n Number to which this is initialized
size Size of the result, in limbs. If 0, size is set to 1. If less than 0, an out_of_range exception is thrown.

void mp::mpn_::init limb_type  n,
size_type  size = 0
[inherited]
 

Initialization to single limb.

MPN is padded with zeros to fit the size.

Parameters:
n Number to which this is initialized
size Size of the result, in limbs. If 0, size is set to 1. If less than 0, an out_of_range exception is thrown.

void mp::mpf_::init const mpf_ n,
size_type  p = 0
[inherited]
 

void mp::mpf_::init const mpi_ n,
size_type  p = 0
[inherited]
 

Reimplemented from mp::mpi_.

void mp::mpf_::init float_type  n,
size_type  p = 0
[inherited]
 

void mp::mpf_::init int_type  n,
size_type  p = 0
[inherited]
 

Reimplemented from mp::mpi_.

void mp::mpn_::interrupt  )  [static, inherited]
 

Interrupt the next main (math, string, PRNG) operation that runs.

mpi_ mp::mpf_::ipart  )  const [inherited]
 

bool mp::mpi_::isNeg  )  const [inherited]
 

Is the number negative?

Returns:
True if the number is negative

bool mp::mpn_::isZero  )  const [inherited]
 

Is the number zero?

Returns:
True if the number is zero

mpf_ mp::mpf_::log size_type  p = 0  )  const [inherited]
 

Set the number to the natural logarithm of itself.

Parameters:
p Minimum precision of result
Returns:
Result

mpn_::size_type mp::mpn_::low_zeros  )  const [inherited]
 

Returns number of consecutive zero limbs, starting at the lowest limb.

void mp::mpi_::mod const mpi_ n  )  [inherited]
 

Modulus by an MPI.

Parameters:
n Number to divide by. If 0, a range_error exception is thrown.

void mp::mpf_::mod const mpf_ n,
size_type  p = 0
[inherited]
 

void mp::mpn_::mul const mpn_ n  )  [inherited]
 

Multiplication by an MPN.

Parameters:
n Number to multiply by

void mp::mpi_::mul const mpi_ n  )  [inherited]
 

Multiplication by an MPI.

Parameters:
n Number to multiply by

void mp::mpf_::mul const mpf_ n,
size_type  p = 0
[inherited]
 

void mp::mpn_::mul_l limb_type  n  )  [protected, inherited]
 

Multiplacation by a single limb.

Parameters:
n Limb to multiply by

void mp::mpf_::mul_pow2 size_type  n  )  [inherited]
 

void mp::mpi_::negate  )  [inherited]
 

Flips the sign register, AKA negates.

void mp::mpf_::normalize mpf_ n  )  [inherited]
 

Normalize the base MPIs over their radix points.

If necessary, shift either this or n to normalize their mantissas.

void mp::mpn_::onInterrupt  )  const [protected, inherited]
 

Activated when interrupt register is set.

Throws a runtime_error to break the execution of a main (math, string handling, PRNG) function.

const mpf & mp::mpf::operator *= const mpf n  ) 
 

const mpf & mp::mpf::operator *= const mpi n  ) 
 

const mpf & mp::mpf::operator *= float_type  n  ) 
 

const mpf & mp::mpf::operator *= int_type  n  ) 
 

mp::mpf::operator float_type  )  const [inline]
 

mp::mpf::operator int_type  )  const [inline]
 

mp::mpf::operator mpi  )  const [inline]
 

mp::mpf::operator std::string  )  const [inline]
 

const mpf & mp::mpf::operator%= const mpf n  ) 
 

const mpf mp::mpf::operator++ int   ) 
 

mpf & mp::mpf::operator++  ) 
 

const mpf & mp::mpf::operator+= const mpf n  ) 
 

const mpf & mp::mpf::operator+= const mpi n  ) 
 

const mpf & mp::mpf::operator+= float_type  n  ) 
 

const mpf & mp::mpf::operator+= int_type  n  ) 
 

const mpf mp::mpf::operator-- int   ) 
 

mpf & mp::mpf::operator--  ) 
 

const mpf & mp::mpf::operator-= const mpf n  ) 
 

const mpf & mp::mpf::operator-= const mpi n  ) 
 

const mpf & mp::mpf::operator-= float_type  n  ) 
 

const mpf & mp::mpf::operator-= int_type  n  ) 
 

const mpf & mp::mpf::operator/= const mpf n  ) 
 

const mpf & mp::mpf::operator/= const mpi n  ) 
 

const mpf & mp::mpf::operator/= float_type  n  ) 
 

const mpf & mp::mpf::operator/= int_type  n  ) 
 

const mpf & mp::mpf::operator= const std::string &  n  ) 
 

const mpf & mp::mpf::operator= const mpf n  ) 
 

const mpf & mp::mpf::operator= const mpi n  ) 
 

const mpf & mp::mpf::operator= float_type  n  ) 
 

const mpf & mp::mpf::operator= int_type  n  ) 
 

mpn_::limb_type & mp::mpn_::operator[] size_type  i  )  [inherited]
 

Limb retreval and writing.

Parameters:
i Index of limb. If less than 0, an out_of_range exception is thrown.

const mpn_::limb_type & mp::mpn_::operator[] size_type  i  )  const [inherited]
 

Const limb retreval.

Parameters:
i Index of limb. If less than 0, an out_of_range exception is thrown.

void mp::mpf_::pi size_type  p  )  [inherited]
 

Get a truncated value of Pi.

The number is accurate to prec bits below the radix point.

mpn_::size_type mp::mpn_::popcount  )  const [inherited]
 

Population count.

Returns:
Number of set bits

mpi_ mp::mpi_::pow int_type  e  )  const [inherited]
 

Exponentation.

Takes the number to a basic signed integer power. The exponant is limited because the number would overflow if allowed to be any larger.

Parameters:
e Exponant in powering operation

mpf_ mp::mpf_::pow const mpf_ n,
size_type  p = 0
const [inherited]
 

Take the number to a real power.

Parameters:
n Exponent of operation
p Minimum precision of result
Returns:
Result

mpi_ mp::mpi_::pow_mod const mpi_ e,
const mpi_ m
const [inherited]
 

Performs modular exponentiation.

The result is equivalent to the expression: (this ^ p) m

Parameters:
e Exponant in powering operation
m Divisor in modulus operation

void mp::mpf_::print  )  const [inherited]
 

Binary dump to stdout.

Includes size and radix information.

Reimplemented from mp::mpi_.

void mp::mpn_::prng size_type  n  )  [inherited]
 

Generate a pseudo-random number.

Parameters:
n Number of random bits to generate

void mp::mpn_::prng_seed const mpn_ seed  )  [static, inherited]
 

Set the PRNG seed.

Parameters:
seed Seed for the PRNG

void mp::mpn_::prng_seed limb_long_type  seed  )  [static, inherited]
 

Set the PRNG seed.

Parameters:
seed Seed for the PRNG

void mp::mpf_::resetMinPrecision  )  [static, inherited]
 

Sets the minimum precision to the default value.

void mp::mpi_::resize size_type  size  )  [inherited]
 

Resizes to size bits.

Adds upper zeros or destroys upper bits as necessary.

Parameters:
size Size of the result, in bits

Reimplemented from mp::mpn_.

mpf_ mp::mpf_::root limb_type  n,
size_type  p = 0
const [inherited]
 

Find the integer root of a number.

Parameters:
n Root to take
p Minimum precision of result
Returns:
Result

void mp::mpi_::setDefaultBase radix_type  b  )  [static, inherited]
 

Sets the default base for string conversion.

Parameters:
b Base to set as default. If less than 2 or greater than the number of available conversion digits, an out_of_range exception is thrown.

void mp::mpf_::setMinPrecision size_type  p  )  [static, inherited]
 

Sets the minimum precision for calculations when no precision is given.

Parameters:
p Precision in bits

void mp::mpf_::setPrecision size_type  prec  )  [inherited]
 

void mp::mpn_::setRaw const raw_type data  )  [inherited]
 

Raw data input.

void mp::mpf_::setString const std::string &  s,
radix_type  b = 0
[inherited]
 

String input.

Converts the input string in base b to an MPF.

Parameters:
s Input string
b Base of the input string. If zero, base is guessed using the first few digits of the input string. If less than 2, an out_of_range exception is thrown.

Reimplemented from mp::mpi_.

void mp::mpn_::setUse  )  [inherited]
 

Sets the local use_ variable after an operation.

Not necessary for users unless twiddling with individual limbs.

void mp::mpi_::shift_l size_type  n  )  [inherited]
 

Left shift.

Non-destructively shifts left n bits, AKA "multiplication by 2 ^\a n".

Parameters:
n Number of bits to shift. If less than 0, right shift.

Reimplemented from mp::mpn_.

void mp::mpi_::shift_r size_type  n  )  [inherited]
 

Right shift.

Destructively shifts right n bits, AKA "integer division by 2 ^\a n".

Parameters:
n Number of bits to shift. If less than 0, left shift.

Reimplemented from mp::mpn_.

mpi_::size_type mp::mpi_::size  )  const [inherited]
 

Find the number of bits in use.

Returns:
The minimum number of bits required to store the number

Reimplemented from mp::mpn_.

void mp::mpf_::sqr  )  [inherited]
 

Reimplemented from mp::mpi_.

mpf_ mp::mpf_::sqrt size_type  p = 0  )  const [inherited]
 

Find the square root of a number.

Parameters:
p Minimum precision of result
Returns:
Result

void mp::mpn_::sub const mpn_ n  )  [inherited]
 

Subtraction of an MPN.

Parameters:
n Number to subtract

void mp::mpi_::sub const mpi_ n  )  [inherited]
 

Subtraction of an MPI.

Parameters:
n Number to subtract

void mp::mpf_::sub const mpf_ n,
size_type  p = 0
[inherited]
 

void mp::mpn_::sub_l limb_type  n  )  [protected, inherited]
 

Subtraction of a single limb.

Parameters:
n Limb to subtract

void mp::mpn_::swap mpn_ n  )  [inherited]
 

Swaps this with n.

This swaps the internals of the number, so it is very fast. A fast move can be done by clear()ing the destination before swap()ing.

Parameters:
n Number to swap with

void mp::mpi_::swap mpi_ n  )  [inherited]
 

Swaps this with n.

Function swaps the internals of the number, so it is very fast. A fast move can be done by clear()ing the destination before swap()ing.

Parameters:
n Number to swap with

void mp::mpf_::swap mpf_ n  )  [inherited]
 

Swaps this with n.

Function swaps the internals of the number, so it is very fast. A fast move can be done by clear()ing the destination before swap()ing.

Parameters:
n Number to swap with

float_type mp::mpf_::toFloat  )  const [inherited]
 

Conversion to standard signed integer type.

If number has a fractional part, it is truncated. If number is too large to fit in standard integer an overflow_error exception is thrown.

Returns:
Standard signed integer representation of the number

int_type mp::mpf_::toInt  )  const [inherited]
 

Conversion to standard signed integer type.

If number has a fractional part, it is truncated. If number is too large to fit in standard integer an overflow_error exception is thrown.

Returns:
Standard signed integer representation of the number

Reimplemented from mp::mpi_.


Member Data Documentation

size_type mp::mpn_::alloc_ [protected, inherited]
 

Number of limbs allocated, pointed to by data.

limb_type* mp::mpn_::data_ [protected, inherited]
 

Pointer to the data.

size_type mp::mpf_::exp_ [protected, inherited]
 

floating point exponant, relative to MSL

bool mp::mpn_::interrupted [static, protected, inherited]
 

Interrupt register.

const mpn_::limb_type mp::mpn_::limb_full = (1 << limb_size_bits) - 1 [static, inherited]
 

A limb with all bits set.

const mpn_::size_type mp::mpn_::limb_size_bits = _MP_SIZE / 2 [static, inherited]
 

Size of a single limb (in bits).

const mpf_::size_type mp::mpf_::min_prec_default = _MPF_MIN_PREC [static, protected, inherited]
 

Default minimum precision.

mpf_::size_type mp::mpf_::min_precision = _MPF_MIN_PREC [static, protected, inherited]
 

Global minimum precision.

bool mp::mpi_::neg_ [protected, inherited]
 

negativity register (true if negative).

const mpn_::size_type mp::mpn_::size_max = INT_MAX [static, inherited]
 

The largest positive size_type value.

radix_type mp::mpi_::string_base = _MP_STR_BASE [static, protected, inherited]
 

Default base for string conversion.

const string mp::mpn_::string_digits = _MP_STR_DIGIT [static, inherited]
 

The digits used in string conversion.

size_type mp::mpn_::use_ [protected, inherited]
 

Number of limbs used (always <= alloc).


The documentation for this class was generated from the following files:
Generated on Fri Feb 4 16:17:55 2005 for LibMP++ by  doxygen 1.4.1