AnimatLab
2
Test
|
Standard fixed-point number class. More...
#include <StdFixed.h>
Public Member Functions | |
CStdFixed () | |
Default constructor. More... | |
CStdFixed (int iM, int iN, int iMultM=-1, int iMultN=-1) | |
Constructor. More... | |
CStdFixed (int iM, int iN, double dblVal, int iMultM=-1, int iMultN=-1) | |
Constructor. More... | |
CStdFixed (int iM, int iN, long lVal, int iMultM=-1, int iMultN=-1) | |
Constructor. More... | |
~CStdFixed (void) | |
Destructor. More... | |
virtual void | Configure (int iM, int iN, int iMultM=-1, int iMultN=-1) |
Configures the fixed-point representation values. More... | |
void | Fixed (long lVal) |
Sets the fixed-point representation of the number. More... | |
long | FixedVal () |
Gets the fixed-point representation of the number. More... | |
double | GetDouble () |
Gets the double representation of the number. More... | |
double * | GetDoublePtr () |
Gets the pointer to the floating-point representation of the number. More... | |
float | GetFloat () |
Gets the floating-point representation of the number. More... | |
float * | GetFloatPtr () |
Gets the pointer to the floating-point representation of the number. More... | |
long * | GetLongPtr () |
Gets the pointer to the fixed-point representation of the number. More... | |
int | M () |
Gets the number of bits to the left of the decimal point. More... | |
int | MultM () |
Number of bits to the left of the decimal point during multiplication. More... | |
int | MultN () |
Number of bits to the right of the decimal point during multiplication. More... | |
int | N () |
Gets the number of bits to the right of the decimal point. More... | |
operator const double () | |
double casting operator. More... | |
operator const float () | |
float casting operator. More... | |
operator const int () | |
int casting operator. More... | |
operator const long () | |
long casting operator. More... | |
bool | operator!= (const float fltVal) |
= operators More... | |
bool | operator!= (const double dblVal) |
Inequality operator. More... | |
bool | operator!= (const int iVal) |
Inequality operator. More... | |
bool | operator!= (const long lVal) |
Inequality operator. More... | |
bool | operator!= (CStdFixed &fxB) |
Inequality operator. More... | |
CStdFixed | operator* (const float fltVal) |
Multiplication operator. More... | |
CStdFixed | operator* (const double dblVal) |
Multiplication operator. More... | |
CStdFixed | operator* (const int iVal) |
Multiplication operator. More... | |
CStdFixed | operator* (const long lVal) |
Multiplication operator. More... | |
CStdFixed | operator* (const CStdFixed &fxB) |
Multiplication operator. More... | |
CStdFixed | operator*= (const float fltVal) |
Multiplication assignment operator. More... | |
CStdFixed | operator*= (const double dblVal) |
Multiplication assignment operator. More... | |
CStdFixed | operator*= (const int iVal) |
Multiplication assignment operator. More... | |
CStdFixed | operator*= (const long lVal) |
Multiplication assignment operator. More... | |
CStdFixed | operator*= (const CStdFixed &fxB) |
Multiplication assignment operator. More... | |
CStdFixed | operator+ (const float fltVal) |
Addition operator. More... | |
CStdFixed | operator+ (const double dblVal) |
Addition operator. More... | |
CStdFixed | operator+ (const int iVal) |
Addition operator. More... | |
CStdFixed | operator+ (const long lVal) |
Addition operator. More... | |
CStdFixed | operator+ (const CStdFixed &fxB) |
Addition operator. More... | |
CStdFixed | operator+= (const float fltVal) |
Addition assignment operator. More... | |
CStdFixed | operator+= (const double dblVal) |
Addition assignment operator. More... | |
CStdFixed | operator+= (const int iVal) |
Addition assignment operator. More... | |
CStdFixed | operator+= (const long lVal) |
Addition assignment operator. More... | |
CStdFixed | operator+= (const CStdFixed &fxB) |
Addition assignment operator. More... | |
CStdFixed | operator- (const float fltVal) |
Negation operator. More... | |
CStdFixed | operator- (const double dblVal) |
Negation operator. More... | |
CStdFixed | operator- (const int iVal) |
Negation operator. More... | |
CStdFixed | operator- (const long lVal) |
Negation operator. More... | |
CStdFixed | operator- (const CStdFixed &fxB) |
Negation operator. More... | |
CStdFixed | operator-= (const float fltVal) |
Subtraction assignment operator. More... | |
CStdFixed | operator-= (const double dblVal) |
Subtraction assignment operator. More... | |
CStdFixed | operator-= (const int iVal) |
Subtraction assignment operator. More... | |
CStdFixed | operator-= (const long lVal) |
Subtraction assignment operator. More... | |
CStdFixed | operator-= (const CStdFixed &fxB) |
Subtraction assignment operator. More... | |
CStdFixed | operator/ (const float fltVal) |
Division operator. More... | |
CStdFixed | operator/ (const double dblVal) |
Division operator. More... | |
CStdFixed | operator/ (const int iVal) |
Division operator. More... | |
CStdFixed | operator/ (const long lVal) |
Division operator. More... | |
CStdFixed | operator/ (const CStdFixed &fxB) |
Division operator. More... | |
CStdFixed | operator/= (const float fltVal) |
Division assignment operator. More... | |
CStdFixed | operator/= (const double dblVal) |
Division assignment operator. More... | |
CStdFixed | operator/= (const int iVal) |
Division assignment operator. More... | |
CStdFixed | operator/= (const long lVal) |
Division assignment operator. More... | |
CStdFixed | operator/= (const CStdFixed &fxB) |
Division assignment operator. More... | |
bool | operator< (const float fltVal) |
Less-than comparison operator. More... | |
bool | operator< (const double dblVal) |
Less-than comparison operator. More... | |
bool | operator< (const int iVal) |
Less-than comparison operator. More... | |
bool | operator< (const long lVal) |
Less-than comparison operator. More... | |
bool | operator< (CStdFixed &fxB) |
Less-than comparison operator. More... | |
std::ostream & | operator<< (std::ostream &output) |
stream output operator. More... | |
bool | operator<= (const float fltVal) |
Less-than-or-equal comparison operator. More... | |
bool | operator<= (const double dblVal) |
Less-than-or-equal comparison operator. More... | |
bool | operator<= (const int iVal) |
Less-than-or-equal comparison operator. More... | |
bool | operator<= (const long lVal) |
Less-than-or-equal comparison operator. More... | |
bool | operator<= (CStdFixed &fxB) |
Less-than-or-equal comparison operator. More... | |
CStdFixed | operator= (float fltVal) |
Assignment operator. More... | |
CStdFixed | operator= (double dblVal) |
Assignment operator. More... | |
CStdFixed | operator= (long lVal) |
Assignment operator. More... | |
CStdFixed | operator= (int iVal) |
Assignment operator. More... | |
bool | operator== (const float fltVal) |
Equality operator. More... | |
bool | operator== (const double dblVal) |
Equality operator. More... | |
bool | operator== (const int iVal) |
Equality operator. More... | |
bool | operator== (const long lVal) |
Equality operator. More... | |
bool | operator== (CStdFixed &fxB) |
Equality operator. More... | |
bool | operator> (const float fltVal) |
Greater-than comparison operator. More... | |
bool | operator> (const double dblVal) |
Greater-than comparison operator. More... | |
bool | operator> (const int iVal) |
Greater-than comparison operator. More... | |
bool | operator> (const long lVal) |
Greater-than comparison operator. More... | |
bool | operator> (CStdFixed &fxB) |
Greater-than comparison operator. More... | |
bool | operator>= (const float fltVal) |
Greater-than-or-equal comparison operator. More... | |
bool | operator>= (const double dblVal) |
Greater-than-or-equal comparison operator. More... | |
bool | operator>= (const int iVal) |
Greater-than-or-equal comparison operator. More... | |
bool | operator>= (const long lVal) |
Greater-than-or-equal comparison operator. More... | |
bool | operator>= (CStdFixed &fxB) |
Greater-than-or-equal comparison operator. More... | |
Protected Member Functions | |
long | Convert (double dblVal) |
Converts floating-point number to a fixed-point number. More... | |
double | Convert (long lVal) |
Converts a fixed-point number to a floating-point number. More... | |
Protected Attributes | |
double | m_dblConvertInt |
The value to convert a floating-point number to a fixed-point number. | |
double | m_dblConvertReal |
The value to convert a fixed-point number to a floating-point number. | |
double | m_dblVal |
Actual value in double variable. | |
float | m_fltVal |
Actual value in float variable. | |
int | m_iM |
int | m_iMultiplyM |
int | m_iMultiplyN |
int | m_iN |
long | m_lAddNegMask |
Mask that is used to make certain that the number cannot go above the maximum number of bits. | |
long | m_lAddPosMask |
Mask that is used to make certain that the number cannot go above the maximum number of bits. | |
long | m_lAddTestMask |
Mask that is used to make certain that the number cannot go above the maximum number of bits. | |
long | m_lFixed |
The fixed-point representation of the number. | |
unsigned long | m_lMaxInt |
This is the maximum integer value attainable by the fixed number. | |
unsigned long | m_lMaxReal |
This is the maximum real value attainable by the fixed number. | |
Standard fixed-point number class.
This is used to calculate fixed point numbers.
Definition at line 19 of file StdFixed.h.
|
inline |
StdUtils::CStdFixed::CStdFixed | ( | int | iM, |
int | iN, | ||
int | iMultM = -1 , |
||
int | iMultN = -1 |
||
) |
Constructor.
iM | Number of bits to the left of the decimal point. |
iN | Number of bits to the right of the decimal point. |
iMultM | Number of bits to the left of the decimal point during multiplication. |
iMultN | Number of bits to the right of the decimal point during multiplication. |
Definition at line 22 of file StdFixed.cpp.
References Configure().
StdUtils::CStdFixed::CStdFixed | ( | int | iM, |
int | iN, | ||
double | dblVal, | ||
int | iMultM = -1 , |
||
int | iMultN = -1 |
||
) |
Constructor.
iM | Number of bits to the left of the decimal point. |
iN | Number of bits to the right of the decimal point. |
dblVal | The initial floating-point value of the variable. |
iMultM | Number of bits to the left of the decimal point during multiplication. |
iMultN | Number of bits to the right of the decimal point during multiplication. |
Definition at line 39 of file StdFixed.cpp.
References Configure(), Convert(), and Fixed().
StdUtils::CStdFixed::CStdFixed | ( | int | iM, |
int | iN, | ||
long | lVal, | ||
int | iMultM = -1 , |
||
int | iMultN = -1 |
||
) |
Constructor.
iM | Number of bits to the left of the decimal point. |
iN | Number of bits to the right of the decimal point. |
lVal | The initial fixed-point value of the variable. |
iMultM | Number of bits to the left of the decimal point during multiplication. |
iMultN | Number of bits to the right of the decimal point during multiplication. |
Definition at line 57 of file StdFixed.cpp.
References Configure(), and Fixed().
StdUtils::CStdFixed::~CStdFixed | ( | void | ) |
|
virtual |
Configures the fixed-point representation values.
iM | Number of bits to the left of the decimal point. |
iN | Number of bits to the right of the decimal point. |
iMultM | Number of bits to the left of the decimal point during multiplication. |
iMultN | Number of bits to the right of the decimal point during multiplication. |
Definition at line 84 of file StdFixed.cpp.
References m_dblConvertInt, m_dblConvertReal, m_dblVal, m_fltVal, m_iM, m_iMultiplyM, m_iMultiplyN, m_iN, m_lAddNegMask, m_lAddPosMask, m_lAddTestMask, m_lFixed, m_lMaxInt, and m_lMaxReal.
Referenced by CStdFixed().
|
inlineprotected |
Converts floating-point number to a fixed-point number.
dblVal | The floating-point value to convert. |
Definition at line 82 of file StdFixed.h.
Referenced by CStdFixed().
|
inlineprotected |
Converts a fixed-point number to a floating-point number.
lVal | The fixed-point value to convert. |
Definition at line 97 of file StdFixed.h.
|
inline |
Sets the fixed-point representation of the number.
lVal | The new value. |
Definition at line 191 of file StdFixed.h.
Referenced by CStdFixed(), operator*(), operator+(), operator-(), and operator/().
|
inline |
Gets the fixed-point representation of the number.
Definition at line 181 of file StdFixed.h.
|
inline |
Gets the double representation of the number.
Definition at line 227 of file StdFixed.h.
|
inline |
Gets the pointer to the floating-point representation of the number.
Definition at line 237 of file StdFixed.h.
|
inline |
Gets the floating-point representation of the number.
Definition at line 207 of file StdFixed.h.
|
inline |
Gets the pointer to the floating-point representation of the number.
Definition at line 217 of file StdFixed.h.
|
inline |
Gets the pointer to the fixed-point representation of the number.
Definition at line 247 of file StdFixed.h.
|
inline |
Gets the number of bits to the left of the decimal point.
Definition at line 141 of file StdFixed.h.
|
inline |
Number of bits to the left of the decimal point during multiplication.
Definition at line 161 of file StdFixed.h.
|
inline |
Number of bits to the right of the decimal point during multiplication.
Definition at line 171 of file StdFixed.h.
|
inline |
Gets the number of bits to the right of the decimal point.
Definition at line 151 of file StdFixed.h.
|
inline |
double casting operator.
Definition at line 1060 of file StdFixed.h.
|
inline |
float casting operator.
Definition at line 1049 of file StdFixed.h.
|
inline |
int casting operator.
Definition at line 1082 of file StdFixed.h.
|
inline |
long casting operator.
Definition at line 1071 of file StdFixed.h.
|
inline |
= operators
Inequality operator.
fltVal | The value. |
Definition at line 1541 of file StdFixed.h.
|
inline |
Inequality operator.
dblVal | The value. |
Definition at line 1557 of file StdFixed.h.
|
inline |
Inequality operator.
iVal | The value. |
Definition at line 1573 of file StdFixed.h.
|
inline |
Inequality operator.
lVal | The value. |
Definition at line 1589 of file StdFixed.h.
|
inline |
Inequality operator.
[in,out] | fxB | The fx b. |
Definition at line 1605 of file StdFixed.h.
|
inline |
Multiplication operator.
fltVal | The value. |
Definition at line 705 of file StdFixed.h.
|
inline |
Multiplication operator.
dblVal | The value. |
Definition at line 721 of file StdFixed.h.
|
inline |
Multiplication operator.
iVal | The value. |
Definition at line 737 of file StdFixed.h.
|
inline |
Multiplication operator.
lVal | The value. |
Definition at line 753 of file StdFixed.h.
Multiplication operator.
fxB | The fx b. |
Definition at line 769 of file StdFixed.h.
References Fixed(), m_iN, and m_lFixed.
|
inline |
Multiplication assignment operator.
fltVal | The value. |
Definition at line 793 of file StdFixed.h.
|
inline |
Multiplication assignment operator.
dblVal | The value. |
Definition at line 809 of file StdFixed.h.
|
inline |
Multiplication assignment operator.
iVal | The value. |
Definition at line 825 of file StdFixed.h.
|
inline |
Multiplication assignment operator.
lVal | The value. |
Definition at line 841 of file StdFixed.h.
Multiplication assignment operator.
fxB | The fx b. |
Definition at line 857 of file StdFixed.h.
|
inline |
Addition operator.
fltVal | The value. |
Definition at line 329 of file StdFixed.h.
|
inline |
Addition operator.
dblVal | The value. |
Definition at line 345 of file StdFixed.h.
|
inline |
Addition operator.
iVal | The value. |
Definition at line 361 of file StdFixed.h.
|
inline |
Addition operator.
lVal | The value. |
Definition at line 377 of file StdFixed.h.
Addition operator.
fxB | The fx b. |
Definition at line 393 of file StdFixed.h.
References Fixed(), and m_lFixed.
|
inline |
Addition assignment operator.
fltVal | The value. |
Definition at line 423 of file StdFixed.h.
|
inline |
Addition assignment operator.
dblVal | The value. |
Definition at line 439 of file StdFixed.h.
|
inline |
Addition assignment operator.
iVal | The value. |
Definition at line 455 of file StdFixed.h.
|
inline |
Addition assignment operator.
lVal | The value. |
Definition at line 471 of file StdFixed.h.
Addition assignment operator.
fxB | The fx b. |
Definition at line 487 of file StdFixed.h.
References m_lFixed.
|
inline |
Negation operator.
fltVal | The value. |
Definition at line 516 of file StdFixed.h.
|
inline |
Negation operator.
dblVal | The value. |
Definition at line 532 of file StdFixed.h.
|
inline |
Negation operator.
iVal | The value. |
Definition at line 548 of file StdFixed.h.
|
inline |
Negation operator.
lVal | The value. |
Definition at line 564 of file StdFixed.h.
Negation operator.
fxB | The fx b. |
Definition at line 580 of file StdFixed.h.
References Fixed(), and m_lFixed.
|
inline |
Subtraction assignment operator.
fltVal | The value. |
Definition at line 612 of file StdFixed.h.
|
inline |
Subtraction assignment operator.
dblVal | The value. |
Definition at line 628 of file StdFixed.h.
|
inline |
Subtraction assignment operator.
iVal | The value. |
Definition at line 644 of file StdFixed.h.
|
inline |
Subtraction assignment operator.
lVal | The value. |
Definition at line 660 of file StdFixed.h.
Subtraction assignment operator.
fxB | The fx b. |
Definition at line 676 of file StdFixed.h.
References m_lFixed.
|
inline |
Division operator.
fltVal | The value. |
Definition at line 880 of file StdFixed.h.
|
inline |
Division operator.
dblVal | The value. |
Definition at line 896 of file StdFixed.h.
|
inline |
Division operator.
iVal | The value. |
Definition at line 912 of file StdFixed.h.
|
inline |
Division operator.
lVal | The value. |
Definition at line 928 of file StdFixed.h.
Division operator.
fxB | The fx b. |
Definition at line 944 of file StdFixed.h.
References Fixed(), m_iN, and m_lFixed.
|
inline |
Division assignment operator.
fltVal | The value. |
Definition at line 965 of file StdFixed.h.
|
inline |
Division assignment operator.
dblVal | The value. |
Definition at line 981 of file StdFixed.h.
|
inline |
Division assignment operator.
iVal | The value. |
Definition at line 997 of file StdFixed.h.
|
inline |
Division assignment operator.
lVal | The value. |
Definition at line 1013 of file StdFixed.h.
Division assignment operator.
fxB | The fx b. |
Definition at line 1029 of file StdFixed.h.
|
inline |
Less-than comparison operator.
fltVal | The value. |
Definition at line 1187 of file StdFixed.h.
|
inline |
Less-than comparison operator.
dblVal | The value. |
Definition at line 1203 of file StdFixed.h.
|
inline |
Less-than comparison operator.
iVal | The value. |
Definition at line 1219 of file StdFixed.h.
|
inline |
Less-than comparison operator.
lVal | The value. |
Definition at line 1235 of file StdFixed.h.
|
inline |
Less-than comparison operator.
[in,out] | fxB | The fx b. |
Definition at line 1251 of file StdFixed.h.
|
inline |
stream output operator.
[in,out] | output | The output. |
Definition at line 1626 of file StdFixed.h.
|
inline |
Less-than-or-equal comparison operator.
fltVal | The value. |
Definition at line 1274 of file StdFixed.h.
|
inline |
Less-than-or-equal comparison operator.
dblVal | The value. |
Definition at line 1290 of file StdFixed.h.
|
inline |
Less-than-or-equal comparison operator.
iVal | The value. |
Definition at line 1306 of file StdFixed.h.
|
inline |
Less-than-or-equal comparison operator.
lVal | The value. |
Definition at line 1322 of file StdFixed.h.
|
inline |
Less-than-or-equal comparison operator.
[in,out] | fxB | The fx b. |
Definition at line 1338 of file StdFixed.h.
|
inline |
Assignment operator.
fltVal | The value. |
Definition at line 263 of file StdFixed.h.
|
inline |
Assignment operator.
dblVal | The value. |
Definition at line 279 of file StdFixed.h.
|
inline |
Assignment operator.
lVal | The value. |
Definition at line 295 of file StdFixed.h.
|
inline |
Assignment operator.
iVal | The value. |
Definition at line 311 of file StdFixed.h.
|
inline |
Equality operator.
fltVal | The value. |
Definition at line 1099 of file StdFixed.h.
|
inline |
Equality operator.
dblVal | The value. |
Definition at line 1115 of file StdFixed.h.
|
inline |
Equality operator.
iVal | The value. |
Definition at line 1131 of file StdFixed.h.
|
inline |
Equality operator.
lVal | The value. |
Definition at line 1147 of file StdFixed.h.
|
inline |
Equality operator.
[in,out] | fxB | The fx b. |
Definition at line 1163 of file StdFixed.h.
|
inline |
Greater-than comparison operator.
fltVal | The value. |
Definition at line 1363 of file StdFixed.h.
|
inline |
Greater-than comparison operator.
dblVal | The value. |
Definition at line 1379 of file StdFixed.h.
|
inline |
Greater-than comparison operator.
iVal | The value. |
Definition at line 1395 of file StdFixed.h.
|
inline |
Greater-than comparison operator.
lVal | The value. |
Definition at line 1411 of file StdFixed.h.
|
inline |
Greater-than comparison operator.
[in,out] | fxB | The fx b. |
Definition at line 1427 of file StdFixed.h.
|
inline |
Greater-than-or-equal comparison operator.
fltVal | The value. |
Definition at line 1452 of file StdFixed.h.
|
inline |
Greater-than-or-equal comparison operator.
dblVal | The value. |
Definition at line 1468 of file StdFixed.h.
|
inline |
Greater-than-or-equal comparison operator.
iVal | The value. |
Definition at line 1484 of file StdFixed.h.
|
inline |
Greater-than-or-equal comparison operator.
lVal | The value. |
Definition at line 1500 of file StdFixed.h.
|
inline |
Greater-than-or-equal comparison operator.
[in,out] | fxB | The fx b. |
Definition at line 1516 of file StdFixed.h.
|
protected |
The number of bits to the left of the decimal point of the fixed-point number representation.
Definition at line 24 of file StdFixed.h.
Referenced by Configure().
|
protected |
The number of digits to shift when doing a multiplication. For this we assume we are using some standard M.N format, but sometimes we may have to multiply be a different format. When that multiplication occurs we must always output things in the M.N format though.
Definition at line 34 of file StdFixed.h.
Referenced by Configure().
|
protected |
The number of digits to shift when doing a multiplication. For this we assume we are using some standard M.N format, but sometimes we may have to multiply be a different format. When that multiplication occurs we must always output things in the M.N format though.
Definition at line 40 of file StdFixed.h.
Referenced by Configure().
|
protected |
The number of bits to the right of the decimal point of the fixed-point number representation.
Definition at line 28 of file StdFixed.h.
Referenced by Configure(), operator*(), operator*=(), operator/(), and operator/=().