Loading...
Searching...
No Matches
bliss::BigNum Class Reference

A simple wrapper class for non-negative big integers (or approximation of them). More...

`#include <bignum.hh>`

## Public Member Functions

| BigNum ()
| ~BigNum ()
void | assign (unsigned int n)
void | multiply (unsigned int n)
size_t | print (FILE *const fp) const
const std::vector< unsigned int > & | get_factors () const
std::string | to_string () const

## Detailed Description

A simple wrapper class for non-negative big integers (or approximation of them).

If the compile time flag BLISS_USE_GMP is set, then the GNU Multiple Precision Arithmetic library (GMP) is used to obtain arbitrary precision. Otherwise, if the compile time flag BLISS_BIGNUM_APPROX is set, a "long double" is used to approximate a big integer. Otherwise, by default, a big integer is represented by a product of integer-sized factors.

## Constructor & Destructor Documentation

## BigNum()

bliss::BigNum::BigNum | ( |  | ) |

inline

Create a new big number and set it to zero.

## ~BigNum()

bliss::BigNum::~BigNum | ( |  | ) |

inline

Destroy the number.

## Member Function Documentation

## assign()

void bliss::BigNum::assign | ( | unsigned int | n | ) |

inline

Set the number to n.

## get_factors()

const std::vector< unsigned int > & bliss::BigNum::get_factors | ( |  | ) | const

inline

Get a reference to the factors vector.

## multiply()

void bliss::BigNum::multiply | ( | unsigned int | n | ) |

inline

Multiply the number with n.

## print()

size_t bliss::BigNum::print | ( | FILE *const | fp | ) | const

inline

Print the number in the file stream fp. In the current version, the returned number of characters printed, is incorrect (either -1 or 0).

## to_string()

std::string bliss::BigNum::to_string | ( |  | ) | const

inline

Get the tring representation of the number. Unoptimized, uses an elementary school algorithm to multiply the factors.

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

- src/bignum.hh