carl  24.04
Computer ARithmetic Library
FLOAT_T.h File Reference

General class for floating point numbers with different formats. More...

#include <carl-common/util/hash.h>
#include <carl-common/meta/SFINAE.h>
#include "roundingConversion.h"
#include <cfloat>
#include <cmath>
#include <cstddef>
#include <iostream>
#include <string>
#include "mpfr_float.tpp"
Include dependency graph for FLOAT_T.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  carl::FloatConv< T1, T2 >
 Struct which holds the conversion operator for any two instanciations of FLOAT_T with different underlying floating point implementations. More...
 
class  carl::FLOAT_T< FloatType >
 Templated wrapper class which allows universal usage of different IEEE 754 implementations. More...
 
struct  std::hash< carl::FLOAT_T< Number > >
 
class  std::numeric_limits< carl::FLOAT_T< Number > >
 

Namespaces

 carl
 carl is the main namespace for the library.
 

Typedefs

using carl::precision_t = std::size_t
 

Enumerations

enum  carl::Str2Double_Error { carl::FLOAT_SUCCESS , carl::FLOAT_OVERFLOW , carl::FLOAT_UNDERFLOW , carl::FLOAT_INCONVERTIBLE }
 

Functions

Str2Double_Error carl::str2double (double &d, char const *s)
 
template<typename Number >
bool carl::AlmostEqual2sComplement (const Number &A, const Number &B, unsigned=128)
 
template<>
bool carl::AlmostEqual2sComplement< double > (const double &A, const double &B, unsigned maxUlps)
 
template<typename FloatType >
bool carl::is_integer (const FLOAT_T< FloatType > &in)
 
template<typename FloatType >
FLOAT_T< FloatType > carl::div (const FLOAT_T< FloatType > &_lhs, const FLOAT_T< FloatType > &_rhs)
 Implements the division which assumes that there is no remainder. More...
 
template<typename FloatType >
FLOAT_T< FloatType > carl::quotient (const FLOAT_T< FloatType > &_lhs, const FLOAT_T< FloatType > &_rhs)
 Implements the division with remainder. More...
 
template<typename Integer , typename FloatType >
Integer carl::to_int (const FLOAT_T< FloatType > &_float)
 Casts the FLOAT_T to an arbitrary integer type which has a constructor for a native int. More...
 
template<typename FloatType >
double carl::to_double (const FLOAT_T< FloatType > &_float)
 
template<typename FloatType >
FLOAT_T< FloatType > carl::abs (const FLOAT_T< FloatType > &_in)
 Method which returns the absolute value of the passed number. More...
 
template<typename FloatType >
FLOAT_T< FloatType > carl::log (const FLOAT_T< FloatType > &_in)
 Method which returns the logarithm of the passed number. More...
 
template<typename FloatType >
FLOAT_T< FloatType > carl::sqrt (const FLOAT_T< FloatType > &_in)
 Method which returns the square root of the passed number. More...
 
template<typename FloatType >
std::pair< FLOAT_T< FloatType >, FLOAT_T< FloatType > > carl::sqrt_safe (const FLOAT_T< FloatType > &_in)
 
template<typename FloatType >
FLOAT_T< FloatType > carl::pow (const FLOAT_T< FloatType > &_in, size_t _exp)
 
template<typename FloatType >
FLOAT_T< FloatType > carl::sin (const FLOAT_T< FloatType > &_in)
 
template<typename FloatType >
FLOAT_T< FloatType > carl::cos (const FLOAT_T< FloatType > &_in)
 
template<typename FloatType >
FLOAT_T< FloatType > carl::asin (const FLOAT_T< FloatType > &_in)
 
template<typename FloatType >
FLOAT_T< FloatType > carl::acos (const FLOAT_T< FloatType > &_in)
 
template<typename FloatType >
FLOAT_T< FloatType > carl::atan (const FLOAT_T< FloatType > &_in)
 
template<typename FloatType >
FLOAT_T< FloatType > carl::floor (const FLOAT_T< FloatType > &_in)
 Method which returns the next smaller integer of this number or the number itself, if it is already an integer. More...
 
template<typename FloatType >
FLOAT_T< FloatType > carl::ceil (const FLOAT_T< FloatType > &_in)
 Method which returns the next larger integer of the passed number or the number itself, if it is already an integer. More...
 
template<>
FLOAT_T< double > carl::rationalize< FLOAT_T< double > > (double n)
 
template<>
FLOAT_T< float > carl::rationalize< FLOAT_T< float > > (float n)
 
template<>
FLOAT_T< mpq_class > carl::rationalize< FLOAT_T< mpq_class > > (double n)
 
mpz_class carl::get_denom (const FLOAT_T< mpq_class > &_in)
 Implicitly converts the number to a rational and returns the denominator. More...
 
mpz_class carl::get_num (const FLOAT_T< mpq_class > &_in)
 Implicitly converts the number to a rational and returns the nominator. More...
 
template<typename FloatType >
bool carl::is_zero (const FLOAT_T< FloatType > &_in)
 
template<typename FloatType >
bool carl::isInfinity (const FLOAT_T< FloatType > &_in)
 
template<typename FloatType >
bool carl::isNan (const FLOAT_T< FloatType > &_in)
 
template<>
bool carl::AlmostEqual2sComplement< FLOAT_T< double > > (const FLOAT_T< double > &A, const FLOAT_T< double > &B, unsigned maxUlps)
 

Detailed Description

General class for floating point numbers with different formats.

Extend to other types if necessary.

Author
Stefan Schupp stefa.nosp@m.n.sc.nosp@m.hupp@.nosp@m.cs.r.nosp@m.wth-a.nosp@m.ache.nosp@m.n.de
Since
2013-10-14
Version
2014-08-28

Definition in file FLOAT_T.h.