diadic< NT_ > Class Template Reference

List of all members.

Detailed Description

template<typename NT_>
class diadic< NT_ >

This class provides arithmetic operations on numbers which are an integer of type NT_, times a power of 2, which is stored by as its exponent.

Definition at line 41 of file diadic.h.

Public Types

typedef NT_ NT

Public Member Functions

 diadic ()
 diadic (const NT &n, int d=0)
template<typename RT>
 diadic (const RT &n, int d=0)
diadic< NT > & operator+= (const diadic< NT > &r)
 Inplace addition of diadic numbers.
diadic< NT > & operator-= (const diadic< NT > &r)
 Inplace substraction of diadic numbers.
diadic< NT > & operator *= (const diadic< NT > &r)
 Inplace multiplication of diadic numbers.
diadic< NT > & operator/= (const diadic< NT > &r)
diadic< NT > & operator/= (int r)
diadic< NT > & operator+= (const NT &r)
 Inplace addition of a diadic number with an integer.
diadic< NT > & operator-= (const NT &r)
 Inplace substraction of a diadic number with an integer.
diadic< NT > & operator *= (const NT &r)
 Inplace multiplication of a diadic number with an integer.
diadic< NT > & operator/= (const NT &r)
diadic< NT > & normalize ()
const NTnumerator () const
NT denominator () const
int valuation () const

Public Attributes

NT num_
int exp_


Member Function Documentation

template<typename NT>
diadic< NT > & diadic< NT >::operator+= ( const diadic< NT > &  r  ) 

Inplace addition of diadic numbers.

Definition at line 97 of file diadic.h.

References diadic< NT_ >::exp_, diadic< NT_ >::normalize(), and diadic< NT_ >::num_.

template<typename NT>
diadic< NT > & diadic< NT >::operator-= ( const diadic< NT > &  r  ) 

Inplace substraction of diadic numbers.

Definition at line 121 of file diadic.h.

References diadic< NT_ >::exp_, diadic< NT_ >::normalize(), and diadic< NT_ >::num_.

template<typename NT>
diadic< NT > & diadic< NT >::operator *= ( const diadic< NT > &  r  ) 

Inplace multiplication of diadic numbers.

Definition at line 144 of file diadic.h.

References diadic< NT_ >::exp_, and diadic< NT_ >::num_.

template<typename NT>
diadic< NT > & diadic< NT >::operator/= ( const diadic< NT > &  r  ) 

Inplace division of diadic numbers. The numerator is divided inplace by the other denominators and the exponents are substracted. This corresponds to a euclidean division.

Definition at line 157 of file diadic.h.

References diadic< NT_ >::exp_, diadic< NT_ >::normalize(), and diadic< NT_ >::num_.

template<typename NT>
diadic< NT > & diadic< NT >::operator/= ( int  r  ) 

Inplace division of a diadic number by an machine integer n. The number n is supposed to be a power of two.

Definition at line 189 of file diadic.h.

References diadic< NT_ >::exp_, and diadic< NT_ >::num_.

template<typename NT>
diadic< NT > & diadic< NT >::operator+= ( const NT r  ) 

Inplace addition of a diadic number with an integer.

Definition at line 201 of file diadic.h.

References diadic< NT_ >::exp_, diadic< NT_ >::normalize(), and diadic< NT_ >::num_.

template<typename NT>
diadic< NT > & diadic< NT >::operator-= ( const NT r  ) 

Inplace substraction of a diadic number with an integer.

Definition at line 219 of file diadic.h.

References diadic< NT_ >::exp_, diadic< NT_ >::normalize(), and diadic< NT_ >::num_.

template<typename NT>
diadic< NT > & diadic< NT >::operator *= ( const NT r  ) 

Inplace multiplication of a diadic number with an integer.

Definition at line 237 of file diadic.h.

References diadic< NT_ >::normalize(), and diadic< NT_ >::num_.

template<typename NT>
diadic< NT > & diadic< NT >::operator/= ( const NT r  ) 

Inplace division of a diadic number by an machine integer n. The number n is supposed to be a power of two.

Definition at line 171 of file diadic.h.

References diadic< NT_ >::exp_, and diadic< NT_ >::num_.


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

SYNAPS DOCUMENTATION
logo