Symbian
Symbian Developer Library

SYMBIAN OS V9.4

Feedback

[Index] [Previous] [Next]

#include <e32math.h>
Link against: euser.lib

Class TRealX

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:


Construction and destruction


TRealX()

IMPORT_C TRealX();

Description

Constructs a default extended precision object.

This sets the value to zero.


TRealX(TInt)

IMPORT_C TRealX(TInt aInt);

Description

Constructs an extended precision object from a signed integer value.

Parameters

TInt aInt


TRealX(TUint)

IMPORT_C TRealX(TUint aInt);

Description

Constructs an extended precision object from an unsigned integer value.

Parameters

TUint aInt


TRealX(TUint,TUint,TUint)

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


TRealX(const TInt64 &)

IMPORT_C TRealX(const TInt64 &aInt);

Description

Constructs an extended precision object from a 64 bit integer.

Parameters

const TInt64 &aInt


TRealX(TReal32)

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.


TRealX(TReal64)

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.

[Top]


Member functions


operator=(TInt)

IMPORT_C TRealX& operator=(TInt aInt);

Description

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

Parameters

TInt aInt

Return value

TRealX &

A reference to this extended precision object.


operator=(TUint)

IMPORT_C TRealX& operator=(TUint aInt);

Description

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

Parameters

TUint aInt

Return value

TRealX &

A reference to this extended precision object.


operator=(const TInt64 &)

IMPORT_C TRealX& operator=(const TInt64 &aInt);

Description

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

Parameters

const TInt64 &aInt

Return value

TRealX &

A reference to this extended precision object.


operator=(TReal32)

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.


operator=(TReal64)

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.


Set(TInt)

IMPORT_C TInt Set(TInt aInt);

Description

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

Parameters

TInt aInt

Return value

TInt

KErrNone, always.


Set(TUint)

IMPORT_C TInt Set(TUint aInt);

Description

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

Parameters

TUint aInt

Return value

TInt

KErrNone, always.


Set(const TInt64 &)

IMPORT_C TInt Set(const TInt64 &aInt);

Description

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

Parameters

const TInt64 &aInt

Return value

TInt

KErrNone, always.


Set(TReal32)

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.


Set(TReal64)

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.


operator TInt()const

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


operator TUint()const

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


operator TInt64()const

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


operator TReal32()const

IMPORT_C operator TReal32() const;

Description

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

Return value


operator TReal64()const

IMPORT_C operator TReal64() const;

Description

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

Return value


GetTReal(TReal32 &)const

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.


GetTReal(TReal64 &)const

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.


SetZero(TBool)

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.


SetNaN()

IMPORT_C void SetNaN();

Description

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


SetInfinite(TBool)

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.


IsZero()const

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.


IsNaN()const

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.


IsInfinite()const

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,


IsFinite()const

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,


operator+=(const TRealX &)

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.


operator-=(const TRealX &)

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.


operator *=(const TRealX &)

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.


operator/=(const TRealX &)

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.


operator%=(const TRealX &)

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.


AddEq(const TRealX &)

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.


SubEq(const TRealX &)

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.


MultEq(const TRealX &)

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


DivEq(const TRealX &)

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.


ModEq(const TRealX &)

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.


operator+()const

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.


operator-()const

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.


operator++()

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.


operator++(TInt)

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

TInt

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.


operator--()

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.


operator--(TInt)

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

TInt

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.


operator+(const TRealX &)const

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.


operator-(const TRealX &)const

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.


operator *(const TRealX &)const

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.


operator/(const TRealX &)const

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.


operator%(const TRealX &)const

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.


Add(TRealX &,const TRealX &)const

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.


Sub(TRealX &,const TRealX &)const

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.


Mult(TRealX &,const TRealX &)const

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.


Div(TRealX &,const TRealX &)const

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.


Mod(TRealX &,const TRealX &)const

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.


Compare(const TRealX &)const

IMPORT_C TRealXOrder Compare(const TRealX &aVal) const;

Description

Parameters

const TRealX &aVal

Return value

TRealX::TRealXOrder


operator==(const TRealX &)const

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.


operator!=(const TRealX &)const

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.


operator>=(const TRealX &)const

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.


operator<=(const TRealX &)const

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.


operator>(const TRealX &)const

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.


operator<(const TRealX &)const

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.

[Top]


Member enumerations


Enum TRealXOrder

TRealXOrder

Description

ELessThan

EEqual

EGreaterThan

EUnordered

[Top]


Member data


iMantLo

TUint32 iMantLo;

Description

The mantissa.


iMantHi

TUint32 iMantHi;

Description


iSign

TInt8 iSign;

Description

The sign: 0 for +, 1 for -


iFlag

TUint8 iFlag;

Description

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


iExp

TUint16 iExp;

Description

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