Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

SH::ShFraction< T > Struct Template Reference

This param does not exist any more because the default param broke some stuff like ShIsFraction in ShStorageType.hpp under VC.NET, and I don't have time to fix it right now. More...

#include <ShFraction.hpp>

List of all members.

Public Types

typedef ShFractionLongType<
T >::type 
LongType
typedef ShFractionSignedLongType<
T >::type 
SignedLongType
typedef LongType CompType

Public Member Functions

 ShFraction ()
 Constructs an fraction with undefined value.
 ShFraction (double value)
 Constructs an fraction.
template<typename T2>
 ShFraction (const ShFraction< T2 > &other)
 operator double () const
 accessor methods *
T & val ()
val () const
ShFractionoperator= (double value)
 Arithmetic operators *.
ShFractionoperator= (const ShFraction &other)
ShFractionoperator+= (double value)
ShFractionoperator+= (const ShFraction &other)
ShFractionoperator-= (double value)
ShFractionoperator-= (const ShFraction &other)
ShFractionoperator *= (double value)
ShFractionoperator *= (const ShFraction &other)
ShFractionoperator/= (double value)
ShFractionoperator/= (const ShFraction &other)
ShFractionoperator%= (double value)
 Float modulus - result is always positive.
ShFractionoperator%= (const ShFraction &other)
ShFraction operator- () const
 Negation *.

Static Public Member Functions

static ShFraction make_fraction (CompType value)
 Makes a fraction and clamps from the computation type.
static ShFraction make_fraction_signed (SignedLongType value)
 Makes a fraction and clamps from the signed type.

Public Attributes

m_val

Static Public Attributes

static const bool is_signed
static const int BITS
 number of bits
static const T ONE
 representation of ONE
static const T MAX
 maximum representable value
static const T MIN
 minumum representable value

Friends

template<typename TT>
std::ostream & operator<< (std::ostream &out, const ShFraction< TT > &value)
 Output operator *.
template<typename TT>
std::istream & operator>> (std::istream &out, ShFraction< TT > &value)
 Input operator (format matches output) *.


Detailed Description

template<typename T>
struct SH::ShFraction< T >

This param does not exist any more because the default param broke some stuff like ShIsFraction in ShStorageType.hpp under VC.NET, and I don't have time to fix it right now.

All ShFractions are by default clamped. Everything that was commented out has been marked with a

Todo:
clamp

Parameters:
Clamp whether to clamp to avoid overflow. If this is true, then during computation we always use a temporary type with enough bits to hold the result. If this is false, then we only use temporaries with extra bits if an intermediate value may overflow. If the result itself overflows, then the value stored is implementation defined (wraps around for 2's complement).

Definition at line 86 of file ShFraction.hpp.


The documentation for this struct was generated from the following files:
Generated on Mon Jan 24 18:38:11 2005 for Sh by  doxygen 1.4.1