fixed.hpp File Reference

#include <cassert>
#include <cmath>
#include <iomanip>
#include <ios>
#include <istream>
#include <locale>
#include <ostream>
#include <sstream>
#include <stdexcept>
#include <string>
#include "ioflags.hpp"
#include "power10.hpp"

Go to the source code of this file.

Classes

class  fixed< T, N >
 Implement a fixed-point number class template. Values have N places after the decimal point. All arithmetic follows the usual rules. More...

Functions

template<class T, int N, class Char, class Traits>
std::basic_istream
< Char, Traits > & 
operator>> (std::basic_istream< Char, Traits > &strm, fixed< T, N > &f)
template<class T, int N, class Char, class Traits>
std::basic_ostream
< Char, Traits > & 
operator<< (std::basic_ostream< Char, Traits > &strm, fixed< T, N > f)
template<class T, int N>
fixed< T, N > operator+ (fixed< T, N > a, fixed< T, N > b)
template<class T, int N>
fixed< T, N > operator+ (fixed< T, N > a, T b)
template<class T, int N>
fixed< T, N > operator+ (T a, fixed< T, N > b)
template<class T, int N>
fixed< T, N > operator- (fixed< T, N > a, fixed< T, N > b)
template<class T, int N>
fixed< T, N > operator- (fixed< T, N > a, T b)
template<class T, int N>
fixed< T, N > operator- (T a, fixed< T, N > b)
template<class T, int N>
fixed< T, N > operator * (fixed< T, N > a, fixed< T, N > b)
template<class T, int N>
fixed< T, N > operator * (fixed< T, N > a, T b)
template<class T, int N>
fixed< T, N > operator * (T a, fixed< T, N > b)
template<class T, int N>
fixed< T, N > operator/ (fixed< T, N > a, fixed< T, N > b)
template<class T, int N>
fixed< T, N > operator/ (fixed< T, N > a, T b)
template<class T, int N>
fixed< T, N > operator/ (T a, fixed< T, N > b)
template<class T, int N>
fixed< T, N > operator- (fixed< T, N > a)
template<class T, int N>
bool operator== (fixed< T, N > a, fixed< T, N > b)
template<class T, int N>
bool operator== (T a, fixed< T, N > b)
template<class T, int N>
bool operator== (fixed< T, N > a, T b)
template<class T, int N>
bool operator!= (fixed< T, N > a, fixed< T, N > b)
template<class T, int N>
bool operator!= (T a, fixed< T, N > b)
template<class T, int N>
bool operator!= (fixed< T, N > a, T b)
template<class T, int N>
bool operator< (fixed< T, N > a, fixed< T, N > b)
template<class T, int N>
bool operator< (T a, fixed< T, N > b)
template<class T, int N>
bool operator< (fixed< T, N > a, T b)
template<class T, int N>
bool operator> (fixed< T, N > a, fixed< T, N > b)
template<class T, int N>
bool operator> (T a, fixed< T, N > b)
template<class T, int N>
bool operator> (fixed< T, N > a, T b)
template<class T, int N>
bool operator<= (fixed< T, N > a, fixed< T, N > b)
template<class T, int N>
bool operator<= (T a, fixed< T, N > b)
template<class T, int N>
bool operator<= (fixed< T, N > a, T b)
template<class T, int N>
bool operator>= (fixed< T, N > a, fixed< T, N > b)
template<class T, int N>
bool operator>= (T a, fixed< T, N > b)
template<class T, int N>
bool operator>= (fixed< T, N > a, T b)


Detailed Description

Definition in file fixed.hpp.


Function Documentation

template<class T, int N>
fixed<T,N> operator * ( a,
fixed< T, N >  b 
) [inline]

Multiply a fixed value and an integer

Parameters:
a The left-hand operand
b The right-hand operand

Definition at line 478 of file fixed.hpp.

template<class T, int N>
fixed<T,N> operator * ( fixed< T, N >  a,
b 
) [inline]

Multiply a fixed value and an integer

Parameters:
a The left-hand operand
b The right-hand operand

Definition at line 468 of file fixed.hpp.

template<class T, int N>
fixed<T,N> operator * ( fixed< T, N >  a,
fixed< T, N >  b 
) [inline]

Multiply fixed values

Parameters:
a The left-hand operand
b The right-hand operand

Definition at line 458 of file fixed.hpp.

template<class T, int N>
bool operator!= ( fixed< T, N >  a,
b 
) [inline]

Compare a fixed value and an integer for inequality

Parameters:
a The left-hand operand
b The right-hand operand

Definition at line 569 of file fixed.hpp.

template<class T, int N>
bool operator!= ( a,
fixed< T, N >  b 
) [inline]

Compare a fixed value and an integer for inequality

Parameters:
a The left-hand operand
b The right-hand operand

Definition at line 561 of file fixed.hpp.

template<class T, int N>
bool operator!= ( fixed< T, N >  a,
fixed< T, N >  b 
) [inline]

Compare fixed values for inequality by comparing the underlying values.

Parameters:
a The left-hand operand
b The right-hand operand

Definition at line 553 of file fixed.hpp.

template<class T, int N>
fixed<T,N> operator+ ( a,
fixed< T, N >  b 
) [inline]

Add a fixed value and an integer

Parameters:
a The left-hand operand
b The right-hand operand

Definition at line 418 of file fixed.hpp.

template<class T, int N>
fixed<T,N> operator+ ( fixed< T, N >  a,
b 
) [inline]

Add a fixed value and an integer

Parameters:
a The left-hand operand
b The right-hand operand

Definition at line 408 of file fixed.hpp.

template<class T, int N>
fixed<T,N> operator+ ( fixed< T, N >  a,
fixed< T, N >  b 
) [inline]

Add fixed values

Parameters:
a The left-hand operand
b The right-hand operand

Definition at line 398 of file fixed.hpp.

template<class T, int N>
fixed<T,N> operator- ( fixed< T, N >  a  )  [inline]

Negate a fixed value

Parameters:
a The value to negate

Definition at line 518 of file fixed.hpp.

References fixed< T, N >::negate().

template<class T, int N>
fixed<T,N> operator- ( a,
fixed< T, N >  b 
) [inline]

Subtract a fixed value from an integer

Parameters:
a The left-hand operand
b The right-hand operand

Definition at line 448 of file fixed.hpp.

template<class T, int N>
fixed<T,N> operator- ( fixed< T, N >  a,
b 
) [inline]

Subtract an integer from a fixed value

Parameters:
a The left-hand operand
b The right-hand operand

Definition at line 438 of file fixed.hpp.

template<class T, int N>
fixed<T,N> operator- ( fixed< T, N >  a,
fixed< T, N >  b 
) [inline]

Subtract fixed values

Parameters:
a The left-hand operand
b The right-hand operand

Definition at line 428 of file fixed.hpp.

template<class T, int N>
fixed<T,N> operator/ ( a,
fixed< T, N >  b 
) [inline]

Divide a fixed value by an integer

Parameters:
a The left-hand operand
b The right-hand operand

Definition at line 508 of file fixed.hpp.

template<class T, int N>
fixed<T,N> operator/ ( fixed< T, N >  a,
b 
) [inline]

Divide an integer by a fixed value

Parameters:
a The left-hand operand
b The right-hand operand

Definition at line 498 of file fixed.hpp.

template<class T, int N>
fixed<T,N> operator/ ( fixed< T, N >  a,
fixed< T, N >  b 
) [inline]

Divide fixed values

Parameters:
a The left-hand operand
b The right-hand operand

Definition at line 488 of file fixed.hpp.

template<class T, int N>
bool operator< ( fixed< T, N >  a,
b 
) [inline]

Compare a fixed value and an integer for less-than

Parameters:
a The left-hand operand
b The right-hand operand

Definition at line 594 of file fixed.hpp.

template<class T, int N>
bool operator< ( a,
fixed< T, N >  b 
) [inline]

Compare a fixed value and an integer for less-than

Parameters:
a The left-hand operand
b The right-hand operand

Definition at line 586 of file fixed.hpp.

template<class T, int N>
bool operator< ( fixed< T, N >  a,
fixed< T, N >  b 
) [inline]

Compare fixed values for less-than by comparing the underlying values.

Parameters:
a The left-hand operand
b The right-hand operand

Definition at line 578 of file fixed.hpp.

template<class T, int N, class Char, class Traits>
std::basic_ostream<Char, Traits>& operator<< ( std::basic_ostream< Char, Traits > &  strm,
fixed< T, N >  f 
) [inline]

Write a fixed value

Parameters:
strm The output stream
f The value to write

Definition at line 388 of file fixed.hpp.

template<class T, int N>
bool operator<= ( fixed< T, N >  a,
b 
) [inline]

Compare a fixed value and an integer for less-than-or-equal

Parameters:
a The left-hand operand
b The right-hand operand

Definition at line 644 of file fixed.hpp.

template<class T, int N>
bool operator<= ( a,
fixed< T, N >  b 
) [inline]

Compare a fixed value and an integer for less-than-or-equal

Parameters:
a The left-hand operand
b The right-hand operand

Definition at line 636 of file fixed.hpp.

template<class T, int N>
bool operator<= ( fixed< T, N >  a,
fixed< T, N >  b 
) [inline]

Compare fixed values for less-than-or-equal by comparing the underlying values.

Parameters:
a The left-hand operand
b The right-hand operand

Definition at line 628 of file fixed.hpp.

template<class T, int N>
bool operator== ( fixed< T, N >  a,
b 
) [inline]

Compare a fixed value and an integer for equality

Parameters:
a The left-hand operand
b The right-hand operand

Definition at line 544 of file fixed.hpp.

References fixed< T, N >::value().

template<class T, int N>
bool operator== ( a,
fixed< T, N >  b 
) [inline]

Compare a fixed value and an integer for equality

Parameters:
a The left-hand operand
b The right-hand operand

Definition at line 536 of file fixed.hpp.

References fixed< T, N >::value().

template<class T, int N>
bool operator== ( fixed< T, N >  a,
fixed< T, N >  b 
) [inline]

Compare fixed values for equality by comparing the underlying values.

Parameters:
a The left-hand operand
b The right-hand operand

Definition at line 528 of file fixed.hpp.

References fixed< T, N >::value().

template<class T, int N>
bool operator> ( fixed< T, N >  a,
b 
) [inline]

Compare a fixed value and an integer for greater-than

Parameters:
a The left-hand operand
b The right-hand operand

Definition at line 619 of file fixed.hpp.

template<class T, int N>
bool operator> ( a,
fixed< T, N >  b 
) [inline]

Compare a fixed value and an integer for greater-than

Parameters:
a The left-hand operand
b The right-hand operand

Definition at line 611 of file fixed.hpp.

template<class T, int N>
bool operator> ( fixed< T, N >  a,
fixed< T, N >  b 
) [inline]

Compare fixed values for greater-than by comparing the underlying values.

Parameters:
a The left-hand operand
b The right-hand operand

Definition at line 603 of file fixed.hpp.

template<class T, int N>
bool operator>= ( fixed< T, N >  a,
b 
) [inline]

Compare a fixed value and an integer for greater-than-or-equal

Parameters:
a The left-hand operand
b The right-hand operand

Definition at line 669 of file fixed.hpp.

template<class T, int N>
bool operator>= ( a,
fixed< T, N >  b 
) [inline]

Compare a fixed value and an integer for greater-than-or-equal

Parameters:
a The left-hand operand
b The right-hand operand

Definition at line 661 of file fixed.hpp.

template<class T, int N>
bool operator>= ( fixed< T, N >  a,
fixed< T, N >  b 
) [inline]

Compare fixed values for greater-than-or-equal by comparing the underlying values.

Parameters:
a The left-hand operand
b The right-hand operand

Definition at line 653 of file fixed.hpp.

template<class T, int N, class Char, class Traits>
std::basic_istream<Char, Traits>& operator>> ( std::basic_istream< Char, Traits > &  strm,
fixed< T, N > &  f 
) [inline]

Read a fixed value

Parameters:
strm The input stream
f The result

Definition at line 377 of file fixed.hpp.

References fixed< T, N >::read().


Generated on Sun Nov 30 09:53:23 2008 for Exploring C++ - Final Forms of Key Examples by  doxygen 1.5.3