Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



Location: e32math.h
Link against: euser.lib

Class TRealX

TRealX

Support

Supported from 5.0

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.

Defined in TRealX:
Add(), AddEq(), Div(), DivEq(), GetTReal(), IsFinite(), IsInFinite(), IsNaN(), IsZero(), Mod(), ModEq(), Mult(), MultEq(), Set(), SetInfinite(), SetNaN(), SetZero(), Sub(), SubEq(), TRealX(), operator TInt(), operator TInt64(), operator TReal32(), operator TReal64(), operator TUint(), operator!=(), operator%(), operator%=(), operator*(), operator*=(), operator+(), operator++(), operator++(TInt), operator+=(), operator-(), operator--(), operator--(TInt), operator-=(), operator/(), operator/=(), operator<(), operator<=(), operator==(), operator>(), operator>=()


Construction


TRealX()

TRealX();

Description

Constructs a default extended precision object. This sets the value to zero.


TRealX()

TRealX(TInt aInt);

Description

Constructs an extended precision object from a signed integer value.

Parameters

TInt aInt

The signed integer value.


TRealX()

TRealX(TUint aInt);

Description

Constructs an extended precision object from an unsigned integer value.

Parameters

TUint aInt

The unsigned integer value.


TRealX()

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

The exponent

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

TRealX(const TInt64& aInt);

Description

Constructs an extended precision object from a 64 bit integer.

Parameters

const TInt64& aInt

A reference to a 64 bit integer.


TRealX()

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

TRealX(TReal64 aReal);

Description

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

Parameters

TReal32 aReal

The double precision floating point value.

[Top]


Set a new value


Set()

TInt Set(TInt aInt);

Description

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

Parameters

TInt aInt

The signed integer value..

Return value

TInt

KErrNone, always


Set()

TInt Set(TUint aInt);

Description

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

Parameters

TInt aInt

The unsigned integer value.

Return value

TInt

KErrNone, always


Set()

TInt Set(const TInt64& aInt);

Description

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

Parameters

const TInt64& aInt

The 64 bit integer value.

Return value

TInt

KErrNone, always


Set()

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

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


SetZero()

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

void SetNaN();

Description

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


SetInfinite()

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

[Top]


Conversion operators and extraction functions


operator TInt()

operator TInt();

Description

Returns the extended precision value as a signed integer value.

The operator returns:


operator TUint()

operator TUint();

Description

Returns the extended precision value as an unsigned signed integer value.

The operator returns:


operator TInt64()

operator TInt64();

Description

Returns the extended precision value as a 64 bit integer value.

The operator returns:


operator TReal32()

operator TReal32();

Description

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


GetTReal()

TInt GetTReal(TReal32& aVal) const;

Description

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

Parameters

TReal32& aVal

A reference to an single precision object which contains the result of the operation.

Return value

TInt

KErrNone, if the operation is successfulKErrOverflow, if the operation results in overflowKErrUnderflow, if the operation results in underflow.


operator TReal64()

operator TReal64();

Description

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


GetTReal()

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 successfulKErrOverflow, if the operation results in overflowKErrUnderflow, if the operation results in underflow.

[Top]


Query functions


IsZero()

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

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.


IsFinite()

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,


IsInFinite()

TBool IsInfinite() const;

Description

Determines whether the extended precision value has an infinite value.

Return value

TBool

True, if the extended precision value is infinite. false, otherwise.

[Top]


Standard operators (raising panic on failure)


operator+=()

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

Description

Adds an extended precision value to this extended precision number.

The operator raises a:

Parameters

const TRealX& aVal

The extended precision value to be added.

Return value

const TRealX&

A reference to this object.


operator-=()

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

Description

Subtracts an extended precision value from this extended precision number.

The operator raises a:

Parameters

const TRealX& aVal

The extended precision value to be subtracted.

Return value

const TRealX&

A reference to this object.


operator*=()

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

Description

Multiplies this extended precision number by an extended precision value.

The operator raises a:

Parameters

const TRealX& aVal

The extended precision value to be used as the multiplier.

Return value

const TRealX&

A reference to this object.


operator/=()

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

Description

Divides this extended precision number by an extended precision value.

The operator raises a:

Parameters

const TRealX& aVal

The extended precision value to be used as the divisor.

Return value

const TRealX&

A reference to this object.


operator%=()

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

Description

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

The operator raises a:

Parameters

const TRealX& aVal

The extended precision value to be used as the divisor.

Return value

const TRealX&

A reference to this object.


operator+()

TRealX operator+() const;

Description

Returns this extended precision number unchanged.

Return value

TRealX

The extended precision number

Notes:


operator-()

TRealX operator-() const;

Description

Negates this extended precision number.

Return value

TRealX

The negative of the extended precision number

Notes:


operator++()

TRealX& operator++();

Description

Increments this extended precision number by one and returns a reference to it.

The operator raises a:

Return value

TRealX&

A reference to this object

Notes:


operator++(TInt)

TRealX operator++(TInt);

Description

Returns this extended precision number before incrementing it by one.

The operator raises a:

Return value

TRealX

An extended precision object.

Notes:


operator--()

TRealX& operator--();

Description

Decrements this extended precision number by one and returns a reference to it.

The operator raises a:

Return value

TRealX&

A reference to this object

Notes:


operator--(TInt)

TRealX operator--(TInt);

Description

Returns this extended precision number before decrementing it by one.

The operator raises a:

Return value

TRealX

An extended precision object.

Notes:


operator+()

TRealX operator+(const TRealX& aVal) const;

Description

Adds an extended precision value to this extended precision number.

The operator raises a:

Parameters

const TRealX& aVal

The extended precision value to be added.

Return value

TRealX

An extended precision object containing the result


operator-()

TRealX operator-(const TRealX& aVal) const;

Description

Subtracts an extended precision value from this extended precision number.

The operator raises a:

Parameters

const TRealX& aVal

The extended precision value to be subtracted.

Return value

TRealX

An extended precision object containing the result.


operator*()

TRealX operator*(const TRealX& aVal) const;

Description

Multiplies this extended precision number by an extended precision value.

The operator raises a:

Parameters

const TRealX& aVal

The extended precision value to be used as the multiplier.

Return value

TRealX

An extended precision object containing the result.


operator/()

TRealX operator/(const TRealX& aVal) const;

Description

Divides this extended precision number by an extended precision value.

The operator raises a:

Parameters

const TRealX& aVal

The extended precision value to be used as the divisor.

Return value

TRealX

An extended precision object containing the result.


operator%()

TRealX operator%(const TRealX& aVal) const;

Description

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

The operator raises a:

Parameters

const TRealX& aVal

The extended precision value to be used as the divisor.

Return value

TRealX

An extended precision object containing the result.

[Top]


Functions equivalent to operators (returning an error on failure)


AddEq()

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 successfulKErrOverflow, if the operation results in overflowKErrUnderflow, if the operation results in underflow.


SubEq()

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 successfulKErrOverflow, if the operation results in overflowKErrUnderflow, if the operation results in underflow


MultEq()

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 successfulKErrOverflow, if the operation results in overflowKErrUnderflow, if the operation results in underflow.


DivEq()

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 successfulKErrOverflow, if the operation results in overflowKErrUnderflow, if the operation results in underflowKErrDivideByZero, if the divisor is zero.


ModEq()

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 successfulKErrTotalLossOfPrecision, if precision is lostKErrUnderflow, if the operation results in underflow.


Add()

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 successfulKErrOverflow, if the operation results in overflowKErrUnderflow, if the operation results in underflow.


Sub()

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 successfulKErrOverflow, if the operation results in overflowKErrUnderflow, if the operation results in underflow.


Mult()

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 successfulKErrOverflow, if the operation results in overflowKErrUnderflow, if the operation results in underflow.


Div()

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 successfulKErrOverflow, if the operation results in overflowKErrUnderflow, if the operation results in underflowKErrDivideByZero, if the divisor is zero


Mod()

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 successfulKErrTotalLossOfPrecision, if precision is lostKErrUnderflow, if the operation results in underflow.

[Top]


Comparison operations


operator==()

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 aValfalse, otherwise.


operator!=()

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 toaVal false, otherwise.


operator>=()

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 toaVal false, otherwise


operator<=()

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 toaVal false, otherwise.


operator>()

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 or equal toaVal false, otherwise,


operator<()

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 or equal toaVal false, otherwise,