Symbian
Symbian OS Library

SYMBIAN OS V9.3

[Index] [Spacer] [Previous] [Next]



Location: 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:
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


TRealX()

IMPORT_C TRealX();

Description

Constructs a default extended precision object.

This sets the value to zero.


TRealX()

IMPORT_C TRealX(TInt aInt);

Description

Constructs an extended precision object from a signed integer value.

Parameters

TInt aInt


TRealX()

IMPORT_C TRealX(TUint aInt);

Description

Constructs an extended precision object from an unsigned integer value.

Parameters

TUint aInt


TRealX()

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()

IMPORT_C TRealX(const TInt64 &aInt);

Description

Constructs an extended precision object from a 64 bit integer.

Parameters

const TInt64 &aInt


TRealX()

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()

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=()

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=()

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=()

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=()

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=()

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()

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()

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()

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()

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()

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()

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()

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()

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()

IMPORT_C operator TReal32() const;

Description

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

Return value


operator TReal64()

IMPORT_C operator TReal64() const;

Description

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

Return value


GetTReal()

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()

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()

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()

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()

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()

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()

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()

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+=()

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-=()

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 *=()

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/=()

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%=()

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()

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()

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()

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()

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()

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+()

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-()

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++()

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--()

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+()

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-()

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 *()

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/()

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%()

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()

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()

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()

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()

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()

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()

IMPORT_C TRealXOrder Compare(const TRealX &aVal) const;

Description

Parameters

const TRealX &aVal

Return value

TRealXOrder


operator==()

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!=()

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>=()

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<=()

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>()

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<()

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