#include <lkfloat.h>
Inheritance diagram for look::LookFloat::
Public Methods | |
LookFloat (double theValue=0.0) | |
Constructor. | |
~LookFloat (void) | |
Destructor. | |
LookFloat (const LookFloat &theOther) | |
Copy constructor. | |
LookFloat& | operator= (const LookFloat &theOther) |
Assignment. | |
LookTypeBase* | GetNewCopy (void) const |
Get a new copy. More... | |
long | GetTypeID (void) const |
Get Type ID. More... | |
operator double (void) const | |
Cast to double. | |
bool | Set (const LookString &theString) |
Set from a string. More... | |
LookString | GetString (int aPrecision) const |
Convert to a string. More... | |
LookString | GetStrippedString (int aPrecision) const |
Convert to a string, no trailing 0 or . More... | |
LookFloat& | operator+= (const LookFloat &) |
Addition. | |
LookFloat& | operator-= (const LookFloat &) |
Subtraction. | |
LookFloat | operator+ (const LookFloat &) const |
Addition. | |
LookFloat | operator- (const LookFloat &) const |
Subtraction. | |
long | GetRoundedInteger (void) const |
Get value rounded to nearest long. More... | |
bool | LessEqual (const LookFloat &theOtherFloat, int thePrecision) const |
Less than or equal within a precision. More... | |
bool | LessThan (const LookFloat &theOtherFloat, int thePrecision) const |
Less than within a precision. More... | |
bool | IsEqual (const LookFloat &theOtherFloat, int thePrecision) const |
Equal within a precision. More... | |
bool | IsZero (int thePrecision) const |
Is zero within a precision. More... | |
Protected Attributes | |
double | itsValue |
Its value. |
It has some rounding abilities. Internally it uses a double.
|
Get a new copy. Virtual copy constructor, aka clone.
Reimplemented from look::LookTypeBase. |
|
Get value rounded to nearest long. (See LookMoney for a short discussion on adding very small numbers to fix rounding at the 0.5 mark - you will have to do this yourself)
|
|
Convert to a string. The precision is the number of decimal places to include. It can be negative. The value is rounded to the nearest value. Trailing zeros are included. (See LookMoney for a short discussion on adding very small numbers to fix rounding at the 0.5 mark - you will have to do this yourself) Eg 12345.67
|
|
Convert to a string, no trailing 0 or . The precision is the number of decimal places to include. It can be negative. The value is rounded to the nearest value. Trailing zeros and decimal points are not included. Eg 12345.98
|
|
Get Type ID. Pseudo-rtti, or isA.
Reimplemented from look::LookTypeBase. |
|
Equal within a precision. See LessEqual() |
|
Is zero within a precision. Like Equal(), except theOther is 0. Eg 0.0001 is zero for precision <= 3.
|
|
Less than or equal within a precision. Comparison ops with floating points sometimes don't work very well, due to precision issues. This is an attempt to get round this. Eg my value 123.4567, other 123.4566 me.LessEqual( other, 4 ) = false. me.LessEqual( other, 3 ) = true.
|
|
Less than within a precision. See LessEqual() |
|
Set from a string. The string must be in the form xxxx, -xxxx, -xxx.xx or xxx.xx. Ie minus at front if present, only one decimal point. If any other characters are present, false will be returned, but its value will still be set to what it would have been if all the invalid characters weren't present.
|