teditor  1.8.0@@fee5e94
Terminal based editor written in C++
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | List of all members
teditor::calc::Number< IntT, FloatT > Struct Template Reference

Core number used for computing in the calculator. More...

#include <number.h>

Public Types

typedef Number< IntT, FloatT > Num
 

Public Member Functions

 Number ()
 
 Number (IntT v)
 
 Number (FloatT v)
 
 Number (const Num &n)
 
 Number (const std::string &str)
 
const Numoperator= (const Num &n)
 
Numoperator+ ()
 
Numoperator- ()
 
const Numoperator+= (const Num &b)
 
const Numoperator-= (const Num &b)
 
const Numoperator*= (const Num &b)
 
const Numoperator/= (const Num &b)
 
bool operator== (const Num &b) const
 
bool operator!= (const Num &b) const
 
bool operator< (const Num &b) const
 
bool operator<= (const Num &b) const
 
bool operator> (const Num &b) const
 
bool operator>= (const Num &b) const
 
Num toInt () const
 
Num toFloat () const
 

Public Attributes

union {
   IntT   i
 
   FloatT   f
 
}; 
 
bool isInt
 

Static Public Attributes

static const Num e
 
static const Num pi
 
static const Num nan
 
static const Num log2e
 
static const Num log10e
 
static const Num sqrt2
 
static const Num sqrt1_2
 

Detailed Description

template<typename IntT, typename FloatT>
struct teditor::calc::Number< IntT, FloatT >

Core number used for computing in the calculator.

Template Parameters
IntTinteger type
FloatTfloat type

Member Typedef Documentation

◆ Num

template<typename IntT , typename FloatT >
typedef Number<IntT, FloatT> teditor::calc::Number< IntT, FloatT >::Num

Constructor & Destructor Documentation

◆ Number() [1/5]

template<typename IntT , typename FloatT >
teditor::calc::Number< IntT, FloatT >::Number ( )
inline

◆ Number() [2/5]

template<typename IntT , typename FloatT >
teditor::calc::Number< IntT, FloatT >::Number ( IntT  v)
inline

◆ Number() [3/5]

template<typename IntT , typename FloatT >
teditor::calc::Number< IntT, FloatT >::Number ( FloatT  v)
inline

◆ Number() [4/5]

template<typename IntT , typename FloatT >
teditor::calc::Number< IntT, FloatT >::Number ( const Num n)
inline

◆ Number() [5/5]

template<typename IntT , typename FloatT >
teditor::calc::Number< IntT, FloatT >::Number ( const std::string &  str)
inline

Member Function Documentation

◆ operator!=()

template<typename IntT , typename FloatT >
bool teditor::calc::Number< IntT, FloatT >::operator!= ( const Num b) const
inline

◆ operator*=()

template<typename IntT , typename FloatT >
const Num& teditor::calc::Number< IntT, FloatT >::operator*= ( const Num b)
inline

◆ operator+()

template<typename IntT , typename FloatT >
Num& teditor::calc::Number< IntT, FloatT >::operator+ ( )
inline

◆ operator+=()

template<typename IntT , typename FloatT >
const Num& teditor::calc::Number< IntT, FloatT >::operator+= ( const Num b)
inline

◆ operator-()

template<typename IntT , typename FloatT >
Num& teditor::calc::Number< IntT, FloatT >::operator- ( )
inline

◆ operator-=()

template<typename IntT , typename FloatT >
const Num& teditor::calc::Number< IntT, FloatT >::operator-= ( const Num b)
inline

◆ operator/=()

template<typename IntT , typename FloatT >
const Num& teditor::calc::Number< IntT, FloatT >::operator/= ( const Num b)
inline

◆ operator<()

template<typename IntT , typename FloatT >
bool teditor::calc::Number< IntT, FloatT >::operator< ( const Num b) const
inline

◆ operator<=()

template<typename IntT , typename FloatT >
bool teditor::calc::Number< IntT, FloatT >::operator<= ( const Num b) const
inline

◆ operator=()

template<typename IntT , typename FloatT >
const Num& teditor::calc::Number< IntT, FloatT >::operator= ( const Num n)
inline

◆ operator==()

template<typename IntT , typename FloatT >
bool teditor::calc::Number< IntT, FloatT >::operator== ( const Num b) const
inline

◆ operator>()

template<typename IntT , typename FloatT >
bool teditor::calc::Number< IntT, FloatT >::operator> ( const Num b) const
inline

◆ operator>=()

template<typename IntT , typename FloatT >
bool teditor::calc::Number< IntT, FloatT >::operator>= ( const Num b) const
inline

◆ toFloat()

template<typename IntT , typename FloatT >
Num teditor::calc::Number< IntT, FloatT >::toFloat ( ) const
inline

◆ toInt()

template<typename IntT , typename FloatT >
Num teditor::calc::Number< IntT, FloatT >::toInt ( ) const
inline

Member Data Documentation

◆ @1

union { ... }

actual value stored

◆ e

template<typename IntT , typename FloatT >
const Num teditor::calc::Number< IntT, FloatT >::e
static

◆ f

template<typename IntT , typename FloatT >
FloatT teditor::calc::Number< IntT, FloatT >::f

◆ i

template<typename IntT , typename FloatT >
IntT teditor::calc::Number< IntT, FloatT >::i

◆ isInt

template<typename IntT , typename FloatT >
bool teditor::calc::Number< IntT, FloatT >::isInt

whether the storage is currently via int or float

◆ log10e

template<typename IntT , typename FloatT >
const Num teditor::calc::Number< IntT, FloatT >::log10e
static

◆ log2e

template<typename IntT , typename FloatT >
const Num teditor::calc::Number< IntT, FloatT >::log2e
static

◆ nan

template<typename IntT , typename FloatT >
const Num teditor::calc::Number< IntT, FloatT >::nan
static

◆ pi

template<typename IntT , typename FloatT >
const Num teditor::calc::Number< IntT, FloatT >::pi
static

◆ sqrt1_2

template<typename IntT , typename FloatT >
const Num teditor::calc::Number< IntT, FloatT >::sqrt1_2
static

◆ sqrt2

template<typename IntT , typename FloatT >
const Num teditor::calc::Number< IntT, FloatT >::sqrt2
static

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