»
Symbian OS v9.3 »
Symbian OS reference »
C++ component reference »
Base E32_EKA2 »
TRealX
Location:
e32math.h
Link against: euser.lib
class TRealX;
Description
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.
Members
Defined in TRealX
:
Add()
, AddEq()
, Compare()
, Div()
, DivEq()
, EEqual
, EGreaterThan
, ELessThan
, EUnordered
, GetTReal()
, GetTReal()
, IsFinite()
, IsInfinite()
, IsNaN()
, IsZero()
, Mod()
, ModEq()
, Mult()
, MultEq()
, Set()
, Set()
, Set()
, Set()
, Set()
, SetInfinite()
, SetNaN()
, SetZero()
, Sub()
, SubEq()
, TRealX()
, TRealX()
, TRealX()
, TRealX()
, TRealX()
, TRealX()
, TRealX()
, TRealXOrder
, iExp
, iFlag
, iMantHi
, iMantLo
, iSign
, operator *()
, operator *=()
, operator TInt()
, operator TInt64()
, operator TReal32()
, operator TReal64()
, operator TUint()
, operator!=()
, operator%()
, operator%=()
, operator>()
, operator>=()
, operator<()
, operator<=()
, operator+()
, operator+()
, operator++()
, operator++()
, operator+=()
, operator-()
, operator-()
, operator--()
, operator--()
, operator-=()
, operator/()
, operator/=()
, operator=()
, operator=()
, operator=()
, operator=()
, operator=()
, operator==()
Construction and destruction
IMPORT_C TRealX();
Description
Constructs a default extended precision object.
This sets the value to zero.
IMPORT_C TRealX(TInt aInt);
Description
Constructs an extended precision object from a signed integer value.
Parameters
IMPORT_C TRealX(TUint aInt);
Description
Constructs an extended precision object from an unsigned integer value.
Parameters
IMPORT_C TRealX(TUint aExp, TUint aMantHi, TUint aMantLo);
Description
Constructs an extended precision object from an explicit exponent and a 64 bit mantissa.
Parameters
TUint aExp |
|
TUint aMantHi |
The high order 32 bits of the 64 bit mantissa
|
TUint aMantLo |
The low order 32 bits of the 64 bit mantissa
|
|
IMPORT_C TRealX(const TInt64 &aInt);
Description
Constructs an extended precision object from a 64 bit integer.
Parameters
IMPORT_C TRealX(TReal32 aReal);
Description
Constructs an extended precision object from a single precision floating point number.
Parameters
TReal32 aReal |
The single precision floating point value.
|
|
IMPORT_C TRealX(TReal64 aReal);
Description
Constructs an extended precision object from a double precision floating point number.
Parameters
TReal64 aReal |
The double precision floating point value.
|
|
IMPORT_C TRealX &operator=(TInt aInt);
Description
Assigns the specified signed integer value to this extended precision object.
Parameters
Return value
TRealX &
|
A reference to this extended precision object.
|
|
IMPORT_C TRealX &operator=(TUint aInt);
Description
Assigns the specified unsigned integer value to this extended precision object.
Parameters
Return value
TRealX &
|
A reference to this extended precision object.
|
|
IMPORT_C TRealX &operator=(const TInt64 &aInt);
Description
Assigns the specified 64 bit integer value to this extended precision object.
Parameters
Return value
TRealX &
|
A reference to this extended precision object.
|
|
IMPORT_C TRealX &operator=(TReal32 aReal);
Description
Assigns the specified single precision floating point number to this extended precision object.
Parameters
TReal32 aReal |
The single precision floating point value.
|
|
Return value
TRealX &
|
A reference to this extended precision object.
|
|
IMPORT_C TRealX &operator=(TReal64 aReal);
Description
Assigns the specified double precision floating point number to this extended precision object.
Parameters
TReal64 aReal |
The double precision floating point value.
|
|
Return value
TRealX &
|
A reference to this extended precision object.
|
|
IMPORT_C TInt Set(TInt aInt);
Description
Gives this extended precision object a new value taken from a signed integer.
Parameters
Return value
IMPORT_C TInt Set(TUint aInt);
Description
Gives this extended precision object a new value taken from an unsigned integer.
Parameters
Return value
IMPORT_C TInt Set(const TInt64 &aInt);
Description
Gives this extended precision object a new value taken from a 64 bit integer.
Parameters
Return value
IMPORT_C TInt Set(TReal32 aReal);
Description
Gives this extended precision object a new value taken from a single precision floating point number.
Parameters
TReal32 aReal |
The single precision floating point value.
|
|
Return value
TInt
|
KErrNone, if a valid number; KErrOverflow, if the number is infinite; KErrArgument, if not a number.
|
|
IMPORT_C TInt Set(TReal64 aReal);
Description
Gives this extended precision object a new value taken from a double precision floating point number.
Parameters
TReal64 aReal |
The double precision floating point value.
|
|
Return value
TInt
|
KErrNone, if a valid number; KErrOverflow, if the number is infinite; KErrArgument, if not a number.
|
|
IMPORT_C operator TInt() const;
Description
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.
Return value
IMPORT_C operator TUint() const;
Description
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.
Return value
IMPORT_C operator TInt64() const;
Description
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.
Return value
IMPORT_C operator TReal32() const;
Description
Returns the extended precision value as a single precision floating point value.
Return value
IMPORT_C operator TReal64() const;
Description
Returns the extended precision value as a double precision floating point value.
Return value
IMPORT_C TInt GetTReal(TReal32 &aVal) const;
Description
Extracts the extended precision value as a single precision floating point value.
Parameters
TReal32 &aVal |
A reference to a single precision object which contains the result of the operation.
|
|
Return value
TInt
|
KErrNone, if the operation is successful; KErrOverflow, if the operation results in overflow; KErrUnderflow, if the operation
results in underflow.
|
|
IMPORT_C TInt GetTReal(TReal64 &aVal) const;
Description
Extracts the extended precision value as a double precision floating point value.
Parameters
TReal64 &aVal |
A reference to a double precision object which contains the result of the operation.
|
|
Return value
TInt
|
KErrNone, if the operation is successful; KErrOverflow, if the operation results in overflow; KErrUnderflow, if the operation
results in underflow.
|
|
IMPORT_C void SetZero(TBool aNegative=EFalse);
Description
Sets the value of this extended precision object to zero.
Parameters
TBool aNegative |
ETrue, the value is a negative zero; EFalse, the value is a positive zero, this is the default.
|
|
IMPORT_C void SetNaN();
Description
Sets the value of this extended precision object to 'not a number'.
IMPORT_C void SetInfinite(TBool aNegative);
Description
Sets the value of this extended precision object to infinity.
Parameters
TBool aNegative |
ETrue, the value is a negative zero; EFalse, the value is a positive zero.
|
|
IMPORT_C TBool IsZero() const;
Description
Determines whether the extended precision value is zero.
Return value
TBool
|
True, if the extended precision value is zero, false, otherwise.
|
|
IMPORT_C TBool IsNaN() const;
Description
Determines whether the extended precision value is 'not a number'.
Return value
TBool
|
True, if the extended precision value is 'not a number', false, otherwise.
|
|
IMPORT_C TBool IsInfinite() const;
Description
Determines whether the extended precision value has a finite value.
Return value
TBool
|
True, if the extended precision value is finite, false, if the value is 'not a number' or is infinite,
|
|
IMPORT_C TBool IsFinite() const;
Description
Determines whether the extended precision value has a finite value.
Return value
TBool
|
True, if the extended precision value is finite, false, if the value is 'not a number' or is infinite,
|
|
IMPORT_C const TRealX &operator+=(const TRealX &aVal);
Description
Adds an extended precision value to this extended precision number.
Parameters
const TRealX &aVal |
The extended precision value to be added.
|
|
Return value
const TRealX & |
A reference to this object.
|
|
Panic codes
MATHX |
KErrOverflow if the operation results in overflow. MATHX KErrUnderflow if the operation results in underflow.
|
|
IMPORT_C const TRealX &operator-=(const TRealX &aVal);
Description
Subtracts an extended precision value from this extended precision number.
Parameters
const TRealX &aVal |
The extended precision value to be subtracted.
|
|
Return value
const TRealX & |
A reference to this object.
|
|
Panic codes
MATHX |
KErrOverflow if the operation results in overflow. MATHX KErrUnderflow if the operation results in underflow.
|
|
IMPORT_C const TRealX &operator *=(const TRealX &aVal);
Description
Multiplies this extended precision number by an extended precision value.
Parameters
const TRealX &aVal |
The extended precision value to be subtracted.
|
|
Return value
const TRealX & |
A reference to this object.
|
|
Panic codes
MATHX |
KErrOverflow if the operation results in overflow. MATHX KErrUnderflow if the operation results in underflow.
|
|
IMPORT_C const TRealX &operator/=(const TRealX &aVal);
Description
Divides this extended precision number by an extended precision value.
Parameters
const TRealX &aVal |
The extended precision value to be used as the divisor.
|
|
Return value
const TRealX & |
A reference to this object.
|
|
Panic codes
MATHX |
KErrOverflow if the operation results in overflow. MATHX KErrUnderflow if the operation results in underflow.
|
MATHX |
KErrDivideByZero if the divisor is zero.
|
|
IMPORT_C const TRealX &operator%=(const TRealX &aVal);
Description
Modulo-divides this extended precision number by an extended precision value.
Parameters
const TRealX &aVal |
The extended precision value to be used as the divisor.
|
|
Return value
const TRealX & |
A reference to this object.
|
|
Panic codes
MATHX |
KErrTotalLossOfPrecision panic if precision is lost. MATHX KErrUnderflow if the operation results in underflow.
|
|
IMPORT_C TInt AddEq(const TRealX &aVal);
Description
Adds an extended precision value to this extended precision number.
Parameters
const TRealX &aVal |
The extended precision value to be added.
|
|
Return value
TInt
|
KErrNone, if the operation is successful; KErrOverflow,if the operation results in overflow; KErrUnderflow, if the operation
results in underflow.
|
|
IMPORT_C TInt SubEq(const TRealX &aVal);
Description
Subtracts an extended precision value from this extended precision number.
Parameters
const TRealX &aVal |
The extended precision value to be subtracted.
|
|
Return value
TInt
|
KErrNone, if the operation is successful; KErrOverflow, if the operation results in overflow; KErrUnderflow, if the operation
results in underflow.
|
|
IMPORT_C TInt MultEq(const TRealX &aVal);
Description
Multiplies this extended precision number by an extended precision value.
Parameters
const TRealX &aVal |
The extended precision value to be used as the multiplier.
|
|
Return value
TInt
|
KErrNone, if the operation is successful; KErrOverflow, if the operation results in overflow; KErrUnderflow, if the operation
results in underflow
|
|
IMPORT_C TInt DivEq(const TRealX &aVal);
Description
Divides this extended precision number by an extended precision value.
Parameters
const TRealX &aVal |
The extended precision value to be used as the divisor.
|
|
Return value
TInt
|
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.
|
|
IMPORT_C TInt ModEq(const TRealX &aVal);
Description
Modulo-divides this extended precision number by an extended precision value.
Parameters
const TRealX &aVal |
The extended precision value to be used as the divisor.
|
|
Return value
TInt
|
KErrNone, if the operation is successful; KErrTotalLossOfPrecision, if precision is lost; KErrUnderflow, if the operation
results in underflow.
|
|
IMPORT_C TRealX operator+() const;
Description
Returns this extended precision number unchanged.
Note that this may also be referred to as a unary plus operator.
Return value
TRealX
|
The extended precision number.
|
|
IMPORT_C TRealX operator-() const;
Description
Negates this extended precision number.
This may also be referred to as a unary minus operator.
Return value
TRealX
|
The negative of the extended precision number.
|
|
IMPORT_C TRealX &operator++();
Description
Increments this extended precision number by one, and then returns a reference to it.
This is also referred to as a prefix operator.
Return value
TRealX &
|
A reference to this object.
|
|
Panic codes
MATHX |
KErrOverflow if the operation results in overflow. MATHX KErrUnderflow if the operation results in underflow.
|
|
IMPORT_C TRealX operator++(TInt);
Description
Returns this extended precision number before incrementing it by one.
This is also referred to as a postfix operator.
Parameters
Return value
TRealX
|
A reference to this object.
|
|
Panic codes
MATHX |
KErrOverflow if the operation results in overflow. MATHX KErrUnderflow if the operation results in underflow.
|
|
IMPORT_C TRealX &operator--();
Description
Decrements this extended precision number by one, and then returns a reference to it.
This is also referred to as a prefix operator.
Return value
TRealX &
|
A reference to this object.
|
|
Panic codes
MATHX |
KErrOverflow if the operation results in overflow. MATHX KErrUnderflow if the operation results in underflow.
|
|
IMPORT_C TRealX operator--(TInt);
Description
Returns this extended precision number before decrementing it by one.
This is also referred to as a postfix operator.
Parameters
Return value
TRealX
|
A reference to this object.
|
|
Panic codes
MATHX |
KErrOverflow if the operation results in overflow. MATHX KErrUnderflow if the operation results in underflow.
|
|
IMPORT_C TRealX operator+(const TRealX &aVal) const;
Description
Adds an extended precision value to this extended precision number.
Parameters
const TRealX &aVal |
The extended precision value to be added.
|
|
Return value
TRealX
|
An extended precision object containing the result.
|
|
Panic codes
MATHX |
KErrOverflow if the operation results in overflow. MATHX KErrUnderflow if the operation results in underflow.
|
|
IMPORT_C TRealX operator-(const TRealX &aVal) const;
Description
Subtracts an extended precision value from this extended precision number.
Parameters
const TRealX &aVal |
The extended precision value to be subtracted.
|
|
Return value
TRealX
|
An extended precision object containing the result.
|
|
Panic codes
MATHX |
KErrOverflow if the operation results in overflow. MATHX KErrUnderflow if the operation results in underflow.
|
|
IMPORT_C TRealX operator *(const TRealX &aVal) const;
Description
Multiplies this extended precision number by an extended precision value.
Parameters
const TRealX &aVal |
The extended precision value to be used as the multiplier.
|
|
Return value
TRealX
|
An extended precision object containing the result.
|
|
Panic codes
MATHX |
KErrOverflow if the operation results in overflow. MATHX KErrUnderflow if the operation results in underflow.
|
|
IMPORT_C TRealX operator/(const TRealX &aVal) const;
Description
Divides this extended precision number by an extended precision value.
Parameters
const TRealX &aVal |
The extended precision value to be used as the divisor.
|
|
Return value
TRealX
|
An extended precision object containing the result.
|
|
Panic codes
MATHX |
KErrOverflow if the operation results in overflow. MATHX KErrUnderflow if the operation results in underflow.
|
MATHX |
KErrDivideByZero if the divisor is zero.
|
|
IMPORT_C TRealX operator%(const TRealX &aVal) const;
Description
Modulo-divides this extended precision number by an extended precision value.
Parameters
const TRealX &aVal |
The extended precision value to be used as the divisor.
|
|
Return value
TRealX
|
An extended precision object containing the result.
|
|
Panic codes
MATHX |
KErrTotalLossOfPrecision if precision is lost. MATHX KErrUnderflow if the operation results in underflow.
|
|
IMPORT_C TInt Add(TRealX &aResult, const TRealX &aVal) const;
Description
Adds an extended precision value to this extended precision number.
Parameters
TRealX &aResult |
On return, a reference to an extended precision object containing the result of the operation.
|
const TRealX &aVal |
The extended precision value to be added.
|
|
Return value
TInt
|
KErrNone, if the operation is successful; KErrOverflow, if the operation results in overflow; KErrUnderflow, if the operation
results in underflow.
|
|
IMPORT_C TInt Sub(TRealX &aResult, const TRealX &aVal) const;
Description
Subtracts an extended precision value from this extended precision number.
Parameters
TRealX &aResult |
On return, a reference to an extended precision object containing the result of the operation.
|
const TRealX &aVal |
The extended precision value to be subtracted.
|
|
Return value
TInt
|
KErrNone, if the operation is successful; KErrOverflow, if the operation results in overflow; KErrUnderflow, if the operation
results in underflow.
|
|
IMPORT_C TInt Mult(TRealX &aResult, const TRealX &aVal) const;
Description
Multiplies this extended precision number by an extended precision value.
Parameters
TRealX &aResult |
On return, a reference to an extended precision object containing the result of the operation.
|
const TRealX &aVal |
The extended precision value to be used as the multiplier.
|
|
Return value
TInt
|
KErrNone, if the operation is successful; KErrOverflow, if the operation results in overflow; KErrUnderflow, if the operation
results in underflow.
|
|
IMPORT_C TInt Div(TRealX &aResult, const TRealX &aVal) const;
Description
Divides this extended precision number by an extended precision value.
Parameters
TRealX &aResult |
On return, a reference to an extended precision object containing the result of the operation.
|
const TRealX &aVal |
The extended precision value to be used as the divisor.
|
|
Return value
TInt
|
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.
|
|
IMPORT_C TInt Mod(TRealX &aResult, const TRealX &aVal) const;
Description
Modulo-divides this extended precision number by an extended precision value.
Parameters
TRealX &aResult |
On return, a reference to an extended precision object containing the result of the operation.
|
const TRealX &aVal |
The extended precision value to be used as the divisor.
|
|
Return value
TInt
|
KErrNone, if the operation is successful; KErrTotalLossOfPrecision, if precision is lost; KErrUnderflow, if the operation
results in underflow.
|
|
IMPORT_C TRealXOrder Compare(const TRealX &aVal) const;
Description
Parameters
Return value
inline TBool operator==(const TRealX &aVal) const;
Description
Compares this extended precision number for equality with another.
Parameters
const TRealX &aVal |
A reference to the extended precision value to be compared.
|
|
Return value
TBool
|
True, if this extended precision number is equal to aVal; false, otherwise.
|
|
inline TBool operator!=(const TRealX &aVal) const;
Description
Compares this extended precision number for in-equality with another.
Parameters
const TRealX &aVal |
A reference to the extended precision value to be compared.
|
|
Return value
TBool
|
True, if this extended precision number is not equal to aVal; false, otherwise.
|
|
inline TBool operator>=(const TRealX &aVal) const;
Description
Compares this extended precision number for being greater than or equal to another.
Parameters
const TRealX &aVal |
A reference to the extended precision value to be compared.
|
|
Return value
TBool
|
True, if this extended precision number is greater than or equal to aVal, false, otherwise.
|
|
inline TBool operator<=(const TRealX &aVal) const;
Description
Compares this extended precision number for being less than or equal to another.
Parameters
const TRealX &aVal |
A reference to the extended precision value to be compared.
|
|
Return value
TBool
|
True, if this extended precision number is less than or equal to aVal, false, otherwise.
|
|
inline TBool operator>(const TRealX &aVal) const;
Description
Compares this extended precision number for being greater than another.
Parameters
const TRealX &aVal |
A reference to the extended precision value to be compared.
|
|
Return value
TBool
|
True, if this extended precision number is greater than aVal, false, otherwise.
|
|
inline TBool operator<(const TRealX &aVal) const;
Description
Compares this extended precision number for being less than another.
Parameters
const TRealX &aVal |
A reference to the extended precision value to be compared.
|
|
Return value
TBool
|
True, if this extended precision number is less than aVal, false, otherwise.
|
|
TUint32 iMantLo;
Description
The mantissa.
TUint32 iMantHi;
Description
TInt8 iSign;
Description
The sign: 0 for +, 1 for -
TUint8 iFlag;
Description
Flags: 0 for exact, 1 for rounded down, 2 for rounded up
TUint16 iExp;
Description
Exponent: biased by 32767, iExp=0 => zero, +65535 => infinity or NaN