carl  24.04
Computer ARithmetic Library
operations.h File Reference
#include <carl-common/meta/platform.h>
#include "typetraits.h"
#include <cassert>
#include <limits>
Include dependency graph for operations.h:

Go to the source code of this file.

Namespaces

 carl
 carl is the main namespace for the library.
 

Functions

bool carl::is_zero (const cln::cl_I &n)
 
bool carl::is_zero (const cln::cl_RA &n)
 
bool carl::is_one (const cln::cl_I &n)
 
bool carl::is_one (const cln::cl_RA &n)
 
bool carl::is_positive (const cln::cl_I &n)
 
bool carl::is_positive (const cln::cl_RA &n)
 
bool carl::is_negative (const cln::cl_I &n)
 
bool carl::is_negative (const cln::cl_RA &n)
 
cln::cl_I carl::get_num (const cln::cl_RA &n)
 Extract the numerator from a fraction. More...
 
cln::cl_I carl::get_denom (const cln::cl_RA &n)
 Extract the denominator from a fraction. More...
 
bool carl::is_integer (const cln::cl_I &)
 Check if a number is integral. More...
 
bool carl::is_integer (const cln::cl_RA &n)
 Check if a fraction is integral. More...
 
std::size_t carl::bitsize (const cln::cl_I &n)
 Get the bit size of the representation of a integer. More...
 
std::size_t carl::bitsize (const cln::cl_RA &n)
 Get the bit size of the representation of a fraction. More...
 
double carl::to_double (const cln::cl_RA &n)
 Converts the given fraction to a double. More...
 
double carl::to_double (const cln::cl_I &n)
 Converts the given integer to a double. More...
 
template<typename Integer >
Integer carl::to_int (const cln::cl_I &n)
 
template<typename Integer >
Integer carl::to_int (const cln::cl_RA &n)
 
template<>
sint carl::to_int< sint > (const cln::cl_I &n)
 
template<>
uint carl::to_int< uint > (const cln::cl_I &n)
 
template<typename To , typename From >
To carl::from_int (const From &n)
 
template<>
cln::cl_I carl::from_int (const uint &n)
 
template<>
cln::cl_I carl::from_int (const sint &n)
 
template<>
cln::cl_I carl::to_int< cln::cl_I > (const cln::cl_RA &n)
 Convert a fraction to an integer. More...
 
template<>
sint carl::to_int< sint > (const cln::cl_RA &n)
 
template<>
uint carl::to_int< uint > (const cln::cl_RA &n)
 
cln::cl_LF carl::to_lf (const cln::cl_RA &n)
 Convert a cln fraction to a cln long float. More...
 
template<>
cln::cl_RA carl::rationalize< cln::cl_RA > (double n)
 
template<>
cln::cl_RA carl::rationalize< cln::cl_RA > (float n)
 
template<>
cln::cl_RA carl::rationalize< cln::cl_RA > (int n)
 
template<>
cln::cl_RA carl::rationalize< cln::cl_RA > (uint n)
 
template<>
cln::cl_RA carl::rationalize< cln::cl_RA > (sint n)
 
template<>
cln::cl_I carl::parse< cln::cl_I > (const std::string &n)
 
template<>
bool carl::try_parse< cln::cl_I > (const std::string &n, cln::cl_I &res)
 
template<>
cln::cl_RA carl::parse< cln::cl_RA > (const std::string &n)
 
template<>
bool carl::try_parse< cln::cl_RA > (const std::string &n, cln::cl_RA &res)
 
cln::cl_I carl::abs (const cln::cl_I &n)
 Get absolute value of an integer. More...
 
cln::cl_RA carl::abs (const cln::cl_RA &n)
 Get absolute value of a fraction. More...
 
cln::cl_I carl::round (const cln::cl_RA &n)
 Round a fraction to next integer. More...
 
cln::cl_I carl::round (const cln::cl_I &n)
 Round an integer to next integer, that is do nothing. More...
 
cln::cl_I carl::floor (const cln::cl_RA &n)
 Round down a fraction. More...
 
cln::cl_I carl::floor (const cln::cl_I &n)
 Round down an integer. More...
 
cln::cl_I carl::ceil (const cln::cl_RA &n)
 Round up a fraction. More...
 
cln::cl_I carl::ceil (const cln::cl_I &n)
 Round up an integer. More...
 
cln::cl_I carl::gcd (const cln::cl_I &a, const cln::cl_I &b)
 Calculate the greatest common divisor of two integers. More...
 
cln::cl_I & carl::gcd_assign (cln::cl_I &a, const cln::cl_I &b)
 Calculate the greatest common divisor of two integers. More...
 
void carl::divide (const cln::cl_I &dividend, const cln::cl_I &divisor, cln::cl_I &quotient, cln::cl_I &remainder)
 
cln::cl_RA & carl::gcd_assign (cln::cl_RA &a, const cln::cl_RA &b)
 Calculate the greatest common divisor of two fractions. More...
 
cln::cl_RA carl::gcd (const cln::cl_RA &a, const cln::cl_RA &b)
 Calculate the greatest common divisor of two fractions. More...
 
cln::cl_I carl::lcm (const cln::cl_I &a, const cln::cl_I &b)
 Calculate the least common multiple of two integers. More...
 
cln::cl_RA carl::lcm (const cln::cl_RA &a, const cln::cl_RA &b)
 Calculate the least common multiple of two fractions. More...
 
template<>
cln::cl_RA carl::pow (const cln::cl_RA &basis, std::size_t exp)
 Calculate the power of some fraction to some positive integer. More...
 
cln::cl_RA carl::log (const cln::cl_RA &n)
 
cln::cl_RA carl::log10 (const cln::cl_RA &n)
 
cln::cl_RA carl::sin (const cln::cl_RA &n)
 
cln::cl_RA carl::cos (const cln::cl_RA &n)
 
bool carl::sqrt_exact (const cln::cl_RA &a, cln::cl_RA &b)
 Calculate the square root of a fraction if possible. More...
 
cln::cl_RA carl::sqrt (const cln::cl_RA &a)
 
std::pair< cln::cl_RA, cln::cl_RA > carl::sqrt_safe (const cln::cl_RA &a)
 Calculate the square root of a fraction. More...
 
std::pair< cln::cl_RA, cln::cl_RA > carl::sqrt_fast (const cln::cl_RA &a)
 Compute square root in a fast but less precise way. More...
 
std::pair< cln::cl_RA, cln::cl_RA > carl::root_safe (const cln::cl_RA &a, uint n)
 
cln::cl_I carl::mod (const cln::cl_I &a, const cln::cl_I &b)
 Calculate the remainder of the integer division. More...
 
cln::cl_RA carl::div (const cln::cl_RA &a, const cln::cl_RA &b)
 Divide two fractions. More...
 
cln::cl_I carl::div (const cln::cl_I &a, const cln::cl_I &b)
 Divide two integers. More...
 
cln::cl_RA & carl::div_assign (cln::cl_RA &a, const cln::cl_RA &b)
 Divide two fractions. More...
 
cln::cl_I & carl::div_assign (cln::cl_I &a, const cln::cl_I &b)
 Divide two integers. More...
 
cln::cl_RA carl::quotient (const cln::cl_RA &a, const cln::cl_RA &b)
 Divide two fractions. More...
 
cln::cl_I carl::quotient (const cln::cl_I &a, const cln::cl_I &b)
 Divide two integers. More...
 
cln::cl_I carl::remainder (const cln::cl_I &a, const cln::cl_I &b)
 Calculate the remainder of the integer division. More...
 
cln::cl_I carl::operator/ (const cln::cl_I &a, const cln::cl_I &b)
 Divide two integers. More...
 
cln::cl_I carl::operator/ (const cln::cl_I &lhs, const int &rhs)
 
cln::cl_RA carl::reciprocal (const cln::cl_RA &a)
 
std::string carl::toString (const cln::cl_RA &_number, bool _infix=true)
 
std::string carl::toString (const cln::cl_I &_number, bool _infix=true)
 

Variables

static const cln::cl_RA carl::ONE_DIVIDED_BY_10_TO_THE_POWER_OF_23 = cln::cl_RA(1)/cln::expt(cln::cl_RA(10), 23)
 
static const cln::cl_RA carl::ONE_DIVIDED_BY_10_TO_THE_POWER_OF_52 = cln::cl_RA(1)/cln::expt(cln::cl_RA(10), 52)
 

Detailed Description

Author
Gereon Kremer gereo.nosp@m.n.kr.nosp@m.emer@.nosp@m.cs.r.nosp@m.wth-a.nosp@m.ache.nosp@m.n.de
Sebastian Junges
Warning
This file should never be included directly but only via operations.h

Definition in file operations.h.