#include <e32math.h>
class TRealX |
Public Attributes | |
---|---|
TUint16 | iExp |
TUint8 | iFlag |
TUint32 | iMantHi |
TUint32 | iMantLo |
TInt8 | iSign |
Public Member Enumerations | |
---|---|
enum | TRealXOrder { ELessThan, EEqual, EGreaterThan, EUnordered } |
A class encapsulating an extended precision real value.
This class provides 64 bit precision and a dynamic range of approximately 1E-9863 to 1E+9863. All member functions are optimized for speed.
IMPORT_C | TRealX | ( | ) |
Constructs a default extended precision object.
This sets the value to zero.
IMPORT_C | TRealX | ( | TInt | aInt | ) |
Constructs an extended precision object from a signed integer value.
IMPORT_C | TRealX | ( | TUint | aInt | ) |
Constructs an extended precision object from an unsigned integer value.
IMPORT_C | TRealX | ( | const TInt64 & | aInt | ) |
Constructs an extended precision object from a 64 bit integer.
IMPORT_C | TRealX | ( | TReal32 | aReal | ) |
Constructs an extended precision object from a single precision floating point number.
Parameter | Description |
---|---|
aReal | The single precision floating point value. |
IMPORT_C | TRealX | ( | TReal64 | aReal | ) |
Constructs an extended precision object from a double precision floating point number.
Parameter | Description |
---|---|
aReal | The double precision floating point value. |
Adds an extended precision value to this extended precision number.
Parameter | Description |
---|---|
aResult | On return, a reference to an extended precision object containing the result of the operation. |
aVal | The extended precision value to be added. |
Returns: KErrNone, if the operation is successful; KErrOverflow, if the operation results in overflow; KErrUnderflow, if the operation results in underflow.
Adds an extended precision value to this extended precision number.
Parameter | Description |
---|---|
aVal | The extended precision value to be added. |
Returns: KErrNone, if the operation is successful; KErrOverflow,if the operation results in overflow; KErrUnderflow, if the operation results in underflow.
Divides this extended precision number by an extended precision value.
Parameter | Description |
---|---|
aResult | On return, a reference to an extended precision object containing the result of the operation. |
aVal | The extended precision value to be used as the divisor. |
Returns: KErrNone, if the operation is successful; KErrOverflow, if the operation results in overflow; KErrUnderflow, if the operation results in underflow; KErrDivideByZero, if the divisor is zero.
Divides this extended precision number by an extended precision value.
Parameter | Description |
---|---|
aVal | The extended precision value to be used as the divisor. |
Returns: KErrNone, if the operation is successful; KErrOverflow, if the operation results in overflow; KErrUnderflow, if the operation results in underflow; KErrDivideByZero, if the divisor is zero.
Extracts the extended precision value as a single precision floating point value.
Parameter | Description |
---|---|
aVal | A reference to a single precision object which contains the result of the operation. |
Returns: KErrNone, if the operation is successful; KErrOverflow, if the operation results in overflow; KErrUnderflow, if the operation results in underflow.
Extracts the extended precision value as a double precision floating point value.
Parameter | Description |
---|---|
aVal | A reference to a double precision object which contains the result of the operation. |
Returns: KErrNone, if the operation is successful; KErrOverflow, if the operation results in overflow; KErrUnderflow, if the operation results in underflow.
IMPORT_C TBool | IsFinite | ( | ) | const |
Determines whether the extended precision value has a finite value.
Returns: True, if the extended precision value is finite, false, if the value is 'not a number' or is infinite,
IMPORT_C TBool | IsInfinite | ( | ) | const |
Determines whether the extended precision value has a finite value.
Returns: True, if the extended precision value is finite, false, if the value is 'not a number' or is infinite,
IMPORT_C TBool | IsNaN | ( | ) | const |
Determines whether the extended precision value is 'not a number'.
Returns: True, if the extended precision value is 'not a number', false, otherwise.
IMPORT_C TBool | IsZero | ( | ) | const |
Determines whether the extended precision value is zero.
Returns: True, if the extended precision value is zero, false, otherwise.
Modulo-divides this extended precision number by an extended precision value.
Parameter | Description |
---|---|
aResult | On return, a reference to an extended precision object containing the result of the operation. |
aVal | The extended precision value to be used as the divisor. |
Returns: KErrNone, if the operation is successful; KErrTotalLossOfPrecision, if precision is lost; KErrUnderflow, if the operation results in underflow.
Modulo-divides this extended precision number by an extended precision value.
Parameter | Description |
---|---|
aVal | The extended precision value to be used as the divisor. |
Returns: KErrNone, if the operation is successful; KErrTotalLossOfPrecision, if precision is lost; KErrUnderflow, if the operation results in underflow.
Multiplies this extended precision number by an extended precision value.
Parameter | Description |
---|---|
aResult | On return, a reference to an extended precision object containing the result of the operation. |
aVal | The extended precision value to be used as the multiplier. |
Returns: KErrNone, if the operation is successful; KErrOverflow, if the operation results in overflow; KErrUnderflow, if the operation results in underflow.
Multiplies this extended precision number by an extended precision value.
Parameter | Description |
---|---|
aVal | The extended precision value to be used as the multiplier. |
Returns: KErrNone, if the operation is successful; KErrOverflow, if the operation results in overflow; KErrUnderflow, if the operation results in underflow
Gives this extended precision object a new value taken from a single precision floating point number.
Parameter | Description |
---|---|
aReal | The single precision floating point value. |
Returns: KErrNone, if a valid number; KErrOverflow, if the number is infinite; KErrArgument, if not a number.
Gives this extended precision object a new value taken from a double precision floating point number.
Parameter | Description |
---|---|
aReal | The double precision floating point value. |
Returns: KErrNone, if a valid number; KErrOverflow, if the number is infinite; KErrArgument, if not a number.
IMPORT_C void | SetInfinite | ( | TBool | aNegative | ) |
Sets the value of this extended precision object to infinity.
Parameter | Description |
---|---|
aNegative | ETrue, the value is a negative zero; EFalse, the value is a positive zero. |
IMPORT_C void | SetNaN | ( | ) |
Sets the value of this extended precision object to 'not a number'.
IMPORT_C void | SetZero | ( | TBool | aNegative = EFalse | ) |
Sets the value of this extended precision object to zero.
Parameter | Description |
---|---|
aNegative | ETrue, the value is a negative zero; EFalse, the value is a positive zero, this is the default. |
Subtracts an extended precision value from this extended precision number.
Parameter | Description |
---|---|
aResult | On return, a reference to an extended precision object containing the result of the operation. |
aVal | The extended precision value to be subtracted. |
Returns: KErrNone, if the operation is successful; KErrOverflow, if the operation results in overflow; KErrUnderflow, if the operation results in underflow.
Subtracts an extended precision value from this extended precision number.
Parameter | Description |
---|---|
aVal | The extended precision value to be subtracted. |
Returns: KErrNone, if the operation is successful; KErrOverflow, if the operation results in overflow; KErrUnderflow, if the operation results in underflow.
IMPORT_C | operator TInt | ( | ) | const |
Gets the extended precision value as a signed integer value.
The operator returns:
1. zero , if the extended precision value is not a number
2. 0x7FFFFFFF, if the value is positive and too big to fit into a TInt.
3. 0x80000000, if the value is negative and too big to fit into a TInt.
IMPORT_C | operator TInt64 | ( | ) | const |
Returns the extended precision value as a 64 bit integer value.
The operator returns:
1. zero, if the extended precision value is not a number
2. 0x7FFFFFFF FFFFFFFF, if the value is positive and too big to fit into a TInt64
3. 0x80000000 00000000, if the value is negative and too big to fit into a TInt.
IMPORT_C | operator TReal32 | ( | ) | const |
Returns the extended precision value as a single precision floating point value.
IMPORT_C | operator TReal64 | ( | ) | const |
Returns the extended precision value as a double precision floating point value.
IMPORT_C | operator TUint | ( | ) | const |
Returns the extended precision value as an unsigned signed integer value.
The operator returns:
1. zero, if the extended precision value is not a number
2. 0xFFFFFFFF, if the value is positive and too big to fit into a TUint.
3. zero, if the value is negative and too big to fit into a TUint.
Modulo-divides this extended precision number by an extended precision value.
Parameter | Description |
---|---|
aVal | The extended precision value to be used as the divisor. |
Returns: An extended precision object containing the result.
Modulo-divides this extended precision number by an extended precision value.
Parameter | Description |
---|---|
aVal | The extended precision value to be used as the divisor. |
Returns: A reference to this object.
Multiplies this extended precision number by an extended precision value.
Parameter | Description |
---|---|
aVal | The extended precision value to be used as the multiplier. |
Returns: An extended precision object containing the result.
Multiplies this extended precision number by an extended precision value.
Parameter | Description |
---|---|
aVal | The extended precision value to be subtracted. |
Returns: A reference to this object.
IMPORT_C TRealX | operator+ | ( | ) | const |
Returns this extended precision number unchanged.
Note that this may also be referred to as a unary plus operator.
Returns: The extended precision number.
Adds an extended precision value to this extended precision number.
Parameter | Description |
---|---|
aVal | The extended precision value to be added. |
Returns: An extended precision object containing the result.
IMPORT_C TRealX & | operator++ | ( | ) |
Increments this extended precision number by one, and then returns a reference to it.
This is also referred to as a prefix operator.
Returns: A reference to this object.
Returns this extended precision number before incrementing it by one.
This is also referred to as a postfix operator.
Returns: A reference to this object.
Adds an extended precision value to this extended precision number.
Parameter | Description |
---|---|
aVal | The extended precision value to be added. |
Returns: A reference to this object.
IMPORT_C TRealX | operator- | ( | ) | const |
Negates this extended precision number.
This may also be referred to as a unary minus operator.
Returns: The negative of the extended precision number.
Subtracts an extended precision value from this extended precision number.
Parameter | Description |
---|---|
aVal | The extended precision value to be subtracted. |
Returns: An extended precision object containing the result.
IMPORT_C TRealX & | operator-- | ( | ) |
Decrements this extended precision number by one, and then returns a reference to it.
This is also referred to as a prefix operator.
Returns: A reference to this object.
Returns this extended precision number before decrementing it by one.
This is also referred to as a postfix operator.
Returns: A reference to this object.
Subtracts an extended precision value from this extended precision number.
Parameter | Description |
---|---|
aVal | The extended precision value to be subtracted. |
Returns: A reference to this object.
Divides this extended precision number by an extended precision value.
Parameter | Description |
---|---|
aVal | The extended precision value to be used as the divisor. |
Returns: An extended precision object containing the result.
Divides this extended precision number by an extended precision value.
Parameter | Description |
---|---|
aVal | The extended precision value to be used as the divisor. |
Returns: A reference to this object.
Compares this extended precision number for being less than or equal to another.
Parameter | Description |
---|---|
aVal | A reference to the extended precision value to be compared. |
Returns: True, if this extended precision number is less than or equal to aVal, false, otherwise.