TRealX Class Reference

class TRealX

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.

Public Member Functions
TRealX()
TRealX(TInt)
TRealX(TUint)
TRealX(TUint, TUint, TUint)
TRealX(const TInt64 &)
TRealX(TReal32)
TRealX(TReal64)
IMPORT_C TIntAdd(TRealX &, const TRealX &)
IMPORT_C TIntAddEq(const TRealX &)
IMPORT_C TRealXOrderCompare(const TRealX &)
IMPORT_C TIntDiv(TRealX &, const TRealX &)
IMPORT_C TIntDivEq(const TRealX &)
IMPORT_C TIntGetTReal(TReal32 &)
IMPORT_C TIntGetTReal(TReal64 &)
IMPORT_C TBoolIsFinite()
IMPORT_C TBoolIsInfinite()
IMPORT_C TBoolIsNaN()
IMPORT_C TBoolIsZero()
IMPORT_C TIntMod(TRealX &, const TRealX &)
IMPORT_C TIntModEq(const TRealX &)
IMPORT_C TIntMult(TRealX &, const TRealX &)
IMPORT_C TIntMultEq(const TRealX &)
IMPORT_C TIntSet(TInt)
IMPORT_C TIntSet(TUint)
IMPORT_C TIntSet(const TInt64 &)
IMPORT_C TIntSet(TReal32)
IMPORT_C TIntSet(TReal64)
IMPORT_C voidSetInfinite(TBool)
IMPORT_C voidSetNaN()
IMPORT_C voidSetZero(TBool)
IMPORT_C TIntSub(TRealX &, const TRealX &)
IMPORT_C TIntSubEq(const TRealX &)
IMPORT_Coperator TInt()
IMPORT_Coperator TInt64()
IMPORT_Coperator TReal32()
IMPORT_Coperator TReal64()
IMPORT_Coperator TUint()
TBool operator!=(const TRealX &)
IMPORT_C TRealXoperator%(const TRealX &)
IMPORT_C const TRealX &operator%=(const TRealX &)
IMPORT_C TRealXoperator*(const TRealX &)
IMPORT_C const TRealX &operator*=(const TRealX &)
IMPORT_C TRealXoperator+()
IMPORT_C TRealXoperator+(const TRealX &)
IMPORT_C TRealX &operator++()
IMPORT_C TRealXoperator++(TInt)
IMPORT_C const TRealX &operator+=(const TRealX &)
IMPORT_C TRealXoperator-()
IMPORT_C TRealXoperator-(const TRealX &)
IMPORT_C TRealX &operator--()
IMPORT_C TRealXoperator--(TInt)
IMPORT_C const TRealX &operator-=(const TRealX &)
IMPORT_C TRealXoperator/(const TRealX &)
IMPORT_C const TRealX &operator/=(const TRealX &)
TBool operator<(const TRealX &)
TBool operator<=(const TRealX &)
IMPORT_C TRealX &operator=(TInt)
IMPORT_C TRealX &operator=(TUint)
IMPORT_C TRealX &operator=(const TInt64 &)
IMPORT_C TRealX &operator=(TReal32)
IMPORT_C TRealX &operator=(TReal64)
TBool operator==(const TRealX &)
TBool operator>(const TRealX &)
TBool operator>=(const TRealX &)
Public Member Enumerations
enumTRealXOrder { ELessThan = 1, EEqual = 2, EGreaterThan = 4, EUnordered = 8 }
Public Attributes
TUint16 iExp
TUint8 iFlag
TUint32 iMantHi
TUint32 iMantLo
TInt8 iSign

Constructor & Destructor Documentation

TRealX()

IMPORT_CTRealX()

Constructs a default extended precision object.

This sets the value to zero.

TRealX(TInt)

IMPORT_CTRealX(TIntaInt)

Constructs an extended precision object from a signed integer value.

Parameters

TInt aInt

TRealX(TUint)

IMPORT_CTRealX(TUintaInt)

Constructs an extended precision object from an unsigned integer value.

Parameters

TUint aInt

TRealX(TUint, TUint, TUint)

IMPORT_CTRealX(TUintaExp,
TUintaMantHi,
TUintaMantLo
)

Constructs an extended precision object from an explicit exponent and a 64 bit mantissa.

Parameters

TUint aExp
TUint aMantHiThe high order 32 bits of the 64 bit mantissa
TUint aMantLoThe low order 32 bits of the 64 bit mantissa

TRealX(const TInt64 &)

IMPORT_CTRealX(const TInt64 &aInt)

Constructs an extended precision object from a 64 bit integer.

Parameters

const TInt64 & aInt

TRealX(TReal32)

IMPORT_CTRealX(TReal32aReal)

Constructs an extended precision object from a single precision floating point number.

Parameters

TReal32 aRealThe single precision floating point value.

TRealX(TReal64)

IMPORT_CTRealX(TReal64aReal)

Constructs an extended precision object from a double precision floating point number.

Parameters

TReal64 aRealThe double precision floating point value.

Member Functions Documentation

Add(TRealX &, const TRealX &)

IMPORT_C TIntAdd(TRealX &aResult,
const TRealX &aVal
)const

Adds an extended precision value to this extended precision number.

Parameters

TRealX & aResultOn return, a reference to an extended precision object containing the result of the operation.
const TRealX & aValThe extended precision value to be added.

AddEq(const TRealX &)

IMPORT_C TIntAddEq(const TRealX &aVal)

Adds an extended precision value to this extended precision number.

Parameters

const TRealX & aValThe extended precision value to be added.

Compare(const TRealX &)

IMPORT_C TRealXOrderCompare(const TRealX &aVal)const

Parameters

const TRealX & aVal

Div(TRealX &, const TRealX &)

IMPORT_C TIntDiv(TRealX &aResult,
const TRealX &aVal
)const

Divides this extended precision number by an extended precision value.

Parameters

TRealX & aResultOn return, a reference to an extended precision object containing the result of the operation.
const TRealX & aValThe extended precision value to be used as the divisor.

DivEq(const TRealX &)

IMPORT_C TIntDivEq(const TRealX &aVal)

Divides this extended precision number by an extended precision value.

Parameters

const TRealX & aValThe extended precision value to be used as the divisor.

GetTReal(TReal32 &)

IMPORT_C TIntGetTReal(TReal32 &aVal)const

Extracts the extended precision value as a single precision floating point value.

Parameters

TReal32 & aValA reference to a single precision object which contains the result of the operation.

GetTReal(TReal64 &)

IMPORT_C TIntGetTReal(TReal64 &aVal)const

Extracts the extended precision value as a double precision floating point value.

Parameters

TReal64 & aValA reference to a double precision object which contains the result of the operation.

IsFinite()

IMPORT_C TBoolIsFinite()const

Determines whether the extended precision value has a finite value.

IsInfinite()

IMPORT_C TBoolIsInfinite()const

Determines whether the extended precision value has a finite value.

IsNaN()

IMPORT_C TBoolIsNaN()const

Determines whether the extended precision value is 'not a number'.

IsZero()

IMPORT_C TBoolIsZero()const

Determines whether the extended precision value is zero.

Mod(TRealX &, const TRealX &)

IMPORT_C TIntMod(TRealX &aResult,
const TRealX &aVal
)const

Modulo-divides this extended precision number by an extended precision value.

Parameters

TRealX & aResultOn return, a reference to an extended precision object containing the result of the operation.
const TRealX & aValThe extended precision value to be used as the divisor.

ModEq(const TRealX &)

IMPORT_C TIntModEq(const TRealX &aVal)

Modulo-divides this extended precision number by an extended precision value.

Parameters

const TRealX & aValThe extended precision value to be used as the divisor.

Mult(TRealX &, const TRealX &)

IMPORT_C TIntMult(TRealX &aResult,
const TRealX &aVal
)const

Multiplies this extended precision number by an extended precision value.

Parameters

TRealX & aResultOn return, a reference to an extended precision object containing the result of the operation.
const TRealX & aValThe extended precision value to be used as the multiplier.

MultEq(const TRealX &)

IMPORT_C TIntMultEq(const TRealX &aVal)

Multiplies this extended precision number by an extended precision value.

Parameters

const TRealX & aValThe extended precision value to be used as the multiplier.

Set(TInt)

IMPORT_C TIntSet(TIntaInt)

Gives this extended precision object a new value taken from a signed integer.

Parameters

TInt aInt

Set(TUint)

IMPORT_C TIntSet(TUintaInt)

Gives this extended precision object a new value taken from an unsigned integer.

Parameters

TUint aInt

Set(const TInt64 &)

IMPORT_C TIntSet(const TInt64 &aInt)

Gives this extended precision object a new value taken from a 64 bit integer.

Parameters

const TInt64 & aInt

Set(TReal32)

IMPORT_C TIntSet(TReal32aReal)

Gives this extended precision object a new value taken from a single precision floating point number.

Parameters

TReal32 aRealThe single precision floating point value.

Set(TReal64)

IMPORT_C TIntSet(TReal64aReal)

Gives this extended precision object a new value taken from a double precision floating point number.

Parameters

TReal64 aRealThe double precision floating point value.

SetInfinite(TBool)

IMPORT_C voidSetInfinite(TBoolaNegative)

Sets the value of this extended precision object to infinity.

Parameters

TBool aNegativeETrue, the value is a negative zero; EFalse, the value is a positive zero.

SetNaN()

IMPORT_C voidSetNaN()

Sets the value of this extended precision object to 'not a number'.

SetZero(TBool)

IMPORT_C voidSetZero(TBoolaNegative = EFalse)

Sets the value of this extended precision object to zero.

Parameters

TBool aNegative = EFalseETrue, the value is a negative zero; EFalse, the value is a positive zero, this is the default.

Sub(TRealX &, const TRealX &)

IMPORT_C TIntSub(TRealX &aResult,
const TRealX &aVal
)const

Subtracts an extended precision value from this extended precision number.

Parameters

TRealX & aResultOn return, a reference to an extended precision object containing the result of the operation.
const TRealX & aValThe extended precision value to be subtracted.

SubEq(const TRealX &)

IMPORT_C TIntSubEq(const TRealX &aVal)

Subtracts an extended precision value from this extended precision number.

Parameters

const TRealX & aValThe extended precision value to be subtracted.

operator TInt()

IMPORT_Coperator 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.

operator TInt64()

IMPORT_Coperator 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.

operator TReal32()

IMPORT_Coperator TReal32()const

Returns the extended precision value as a single precision floating point value.

operator TReal64()

IMPORT_Coperator TReal64()const

Returns the extended precision value as a double precision floating point value.

operator TUint()

IMPORT_Coperator 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.

operator!=(const TRealX &)

TBool operator!=(const TRealX &aVal)const [inline]

Compares this extended precision number for in-equality with another.

Parameters

const TRealX & aValA reference to the extended precision value to be compared.

operator%(const TRealX &)

IMPORT_C TRealXoperator%(const TRealX &aVal)const

Modulo-divides this extended precision number by an extended precision value.

panic
MATHX KErrTotalLossOfPrecision if precision is lost.
panic
MATHX KErrUnderflow if the operation results in underflow.

Parameters

const TRealX & aValThe extended precision value to be used as the divisor.

operator%=(const TRealX &)

IMPORT_C const TRealX &operator%=(const TRealX &aVal)

Modulo-divides this extended precision number by an extended precision value.

panic
MATHX KErrTotalLossOfPrecision panic if precision is lost.
panic
MATHX KErrUnderflow if the operation results in underflow.

Parameters

const TRealX & aValThe extended precision value to be used as the divisor.

operator*(const TRealX &)

IMPORT_C TRealXoperator*(const TRealX &aVal)const

Multiplies this extended precision number by an extended precision value.

panic
MATHX KErrOverflow if the operation results in overflow.
panic
MATHX KErrUnderflow if the operation results in underflow.

Parameters

const TRealX & aValThe extended precision value to be used as the multiplier.

operator*=(const TRealX &)

IMPORT_C const TRealX &operator*=(const TRealX &aVal)

Multiplies this extended precision number by an extended precision value.

panic
MATHX KErrOverflow if the operation results in overflow.
panic
MATHX KErrUnderflow if the operation results in underflow.

Parameters

const TRealX & aValThe extended precision value to be subtracted.

operator+()

IMPORT_C TRealXoperator+()const

Returns this extended precision number unchanged.

Note that this may also be referred to as a unary plus operator.

operator+(const TRealX &)

IMPORT_C TRealXoperator+(const TRealX &aVal)const

Adds an extended precision value to this extended precision number.

panic
MATHX KErrOverflow if the operation results in overflow.
panic
MATHX KErrUnderflow if the operation results in underflow.

Parameters

const TRealX & aValThe extended precision value to be added.

operator++()

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.

panic
MATHX KErrOverflow if the operation results in overflow.
panic
MATHX KErrUnderflow if the operation results in underflow.

operator++(TInt)

IMPORT_C TRealXoperator++(TInt)

Returns this extended precision number before incrementing it by one.

This is also referred to as a postfix operator.

panic
MATHX KErrOverflow if the operation results in overflow.
panic
MATHX KErrUnderflow if the operation results in underflow.

Parameters

TInt

operator+=(const TRealX &)

IMPORT_C const TRealX &operator+=(const TRealX &aVal)

Adds an extended precision value to this extended precision number.

panic
MATHX KErrOverflow if the operation results in overflow.
panic
MATHX KErrUnderflow if the operation results in underflow.

Parameters

const TRealX & aValThe extended precision value to be added.

operator-()

IMPORT_C TRealXoperator-()const

Negates this extended precision number.

This may also be referred to as a unary minus operator.

operator-(const TRealX &)

IMPORT_C TRealXoperator-(const TRealX &aVal)const

Subtracts an extended precision value from this extended precision number.

panic
MATHX KErrOverflow if the operation results in overflow.
panic
MATHX KErrUnderflow if the operation results in underflow.

Parameters

const TRealX & aValThe extended precision value to be subtracted.

operator--()

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.

panic
MATHX KErrOverflow if the operation results in overflow.
panic
MATHX KErrUnderflow if the operation results in underflow.

operator--(TInt)

IMPORT_C TRealXoperator--(TInt)

Returns this extended precision number before decrementing it by one.

This is also referred to as a postfix operator.

panic
MATHX KErrOverflow if the operation results in overflow.
panic
MATHX KErrUnderflow if the operation results in underflow.

Parameters

TInt

operator-=(const TRealX &)

IMPORT_C const TRealX &operator-=(const TRealX &aVal)

Subtracts an extended precision value from this extended precision number.

panic
MATHX KErrOverflow if the operation results in overflow.
panic
MATHX KErrUnderflow if the operation results in underflow.

Parameters

const TRealX & aValThe extended precision value to be subtracted.

operator/(const TRealX &)

IMPORT_C TRealXoperator/(const TRealX &aVal)const

Divides this extended precision number by an extended precision value.

panic
MATHX KErrOverflow if the operation results in overflow.
panic
MATHX KErrUnderflow if the operation results in underflow.
panic
MATHX KErrDivideByZero if the divisor is zero.

Parameters

const TRealX & aValThe extended precision value to be used as the divisor.

operator/=(const TRealX &)

IMPORT_C const TRealX &operator/=(const TRealX &aVal)

Divides this extended precision number by an extended precision value.

panic
MATHX KErrOverflow if the operation results in overflow.
panic
MATHX KErrUnderflow if the operation results in underflow.
panic
MATHX KErrDivideByZero if the divisor is zero.

Parameters

const TRealX & aValThe extended precision value to be used as the divisor.

operator<(const TRealX &)

TBool operator<(const TRealX &aVal)const [inline]

Compares this extended precision number for being less than another.

Parameters

const TRealX & aValA reference to the extended precision value to be compared.

operator<=(const TRealX &)

TBool operator<=(const TRealX &aVal)const [inline]

Compares this extended precision number for being less than or equal to another.

Parameters

const TRealX & aValA reference to the extended precision value to be compared.

operator=(TInt)

IMPORT_C TRealX &operator=(TIntaInt)

Assigns the specified signed integer value to this extended precision object.

Parameters

TInt aInt

operator=(TUint)

IMPORT_C TRealX &operator=(TUintaInt)

Assigns the specified unsigned integer value to this extended precision object.

Parameters

TUint aInt

operator=(const TInt64 &)

IMPORT_C TRealX &operator=(const TInt64 &aInt)

Assigns the specified 64 bit integer value to this extended precision object.

Parameters

const TInt64 & aInt

operator=(TReal32)

IMPORT_C TRealX &operator=(TReal32aReal)

Assigns the specified single precision floating point number to this extended precision object.

Parameters

TReal32 aRealThe single precision floating point value.

operator=(TReal64)

IMPORT_C TRealX &operator=(TReal64aReal)

Assigns the specified double precision floating point number to this extended precision object.

Parameters

TReal64 aRealThe double precision floating point value.

operator==(const TRealX &)

TBool operator==(const TRealX &aVal)const [inline]

Compares this extended precision number for equality with another.

Parameters

const TRealX & aValA reference to the extended precision value to be compared.

operator>(const TRealX &)

TBool operator>(const TRealX &aVal)const [inline]

Compares this extended precision number for being greater than another.

Parameters

const TRealX & aValA reference to the extended precision value to be compared.

operator>=(const TRealX &)

TBool operator>=(const TRealX &aVal)const [inline]

Compares this extended precision number for being greater than or equal to another.

Parameters

const TRealX & aValA reference to the extended precision value to be compared.

Member Enumerations Documentation

Enum TRealXOrder

Enumerators

ELessThan = 1
EEqual = 2
EGreaterThan = 4
EUnordered = 8

Member Data Documentation

TUint16 iExp

TUint16 iExp

Exponent: biased by 32767, iExp=0 => zero, +65535 => infinity or NaN

TUint8 iFlag

TUint8 iFlag

Flags: 0 for exact, 1 for rounded down, 2 for rounded up

TUint32 iMantHi

TUint32 iMantHi

TUint32 iMantLo

TUint32 iMantLo

The mantissa.

TInt8 iSign

TInt8 iSign

The sign: 0 for +, 1 for -