rwlogo
SourcePro C++ 12.0

SourcePro® C++ API Reference Guide



   SourcePro C++
Documentation Home

RWDecimalBase Class Reference
[MiscellaneousDecimal Numbers]

Base class for the family of Rogue Wave decimal classes. More...

#include <rw/tools/decbase.h>

Inheritance diagram for RWDecimalBase:
RWDecimal< M > RWDecimalPortable RWFixedDecimal< M >

List of all members.

Public Types

enum  RoundingMethod {
  PLAIN, UP, DOWN, BANKERS,
  TRUNCATE
}
enum  State {
  normal, nullstate, NaNstate, ctorError,
  missingstate, SNaNstate, infinitystate
}
enum  Op {
  assign, add, sub, mult,
  div, powop, pow10op, conversion
}

Public Member Functions

void swap (RWDecimalBase &rhs)

Detailed Description

The base class for the different RWDecimal classes. This class provides the definition of enums used in the derived classes and in the related classes RWDecimalInexactErr and RWDecimalOverflowErr.


Member Enumeration Documentation

An enumeration defining the operation that caused the error handler to be called.

See also:
RWDecimalInexactErr and RWDecimalOverflowErr.
Enumerator:
assign 

 

add 

 

sub 

 

mult 

 

div 

 

powop 

 

pow10op 

 

conversion 

 

Rounding methods used by RWDecimalPortable::round()

The following table shows the results of the different rounding methods.

Method 1.25 1.35 1.251
PLAIN 1.2 1.3 1.2
UP 1.3 1.4 1.3
DOWN 1.2 1.3 1.2
TRUNCATE 1.2 1.3 1.2
BANKERS 1.2 1.4 1.3
Enumerator:
PLAIN 

Round up on a tie.

UP 

Always round up.

DOWN 

Always round down.

BANKERS 

On a tie, round so that last digit is even.

TRUNCATE 

Same as DOWN.

An enumeration defining the state of the object.

Any operation on nullstate returns the other operand.

Any operation on NaN provides a NaN result.

Any operation on ctorError or missingstate returns a result with the State ctorError or missingstate respectively.

Operations on infinitystate are as follows:

Operation Result
$n \div \pm Infinity$ 0
$\pm Infinity \times \pm Infinity$ $\pm Infinity$
$Infinity + Infinity$ $Infinity$
$Infinity - Infinity$ NaN
$\pm Infinity \div \pm Infinity$ NaN
$\pm Infinity \times 0$ NaN
Note:
An operation on an object with SNaNstate does not generate signals, unless converted to a double or long double and used in double arithemetic.
Enumerator:
normal 

Normal numeric value.

nullstate 

Non-numeric value.

NaNstate 

Quiet NaN.

ctorError 

Error in construction.

missingstate 

Non-numeric value.

SNaNstate 

Signaling NaN.

infinitystate 

Infinity.


Member Function Documentation

void RWDecimalBase::swap ( RWDecimalBase rhs  )  [inline]

Swaps the data owned by self with the data owned by rhs.

 All Classes Functions Variables Typedefs Enumerations Enumerator Friends

© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.