Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Hydra Core Library Reference Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

rwsf::Decimal

Group:  General


rwsf::Decimal RWDecimalBase

Local Index

Members

Header File

#include <rwsf/core/Decimal.h>

Description

This class represents an arbitrary precision decimal fraction. The representation is not exposed via member functions for accessing the strings representing the pieces before and after the decimal. This is done because it might make sense to one day replace this implementation with an arbitrary precision integer-based implementation.

The concept of trailing zeros after the decimal place is supported. If you construct an rwsf::Decimal using the string constructor and have trailing zeros (e.g., 1.200), then you are guaranteed that the string conversion operator will return a string with these trailing zeros. Rounding supports the concept of trailing zeros, so round("1.2",2) yields 1.20. The math functions (+-*) truncate trailing zeros. Use trimZeros() to strip off the excess zeros. Note that because trailing zeroes are allowed the relation x==y does not guarantee that std::string(x)==std::string(y) since "1.200"=="1.2".

Public Constructors

Decimal();
Decimal(const Decimal&);

Public Member Functions

Decimal(const char *);
Decimal(const std::string&);
Decimal(long);
Decimal(int);
std::string
asString()const;
std::string
asString(const rwsf::Locale&) const;
static std::string
decimalSeparator(const rwsf::Locale&);
unsigned
hash() const;
bool
isNumber() const;
bool
isZero();
size_t
numSignificantDigits() const;
size_t
precision() const;
size_t
scale() const;
void
setState(State);
State
state() const;
static std::string
thousandsSeparator(const rwsf::Locale&);
void
trimZeros();

Public Member Operators

Decimal&
operator=(const Decimal&);
const Decimal&
operator-=(const Decimal &rhs);
const Decimal&
operator+=(const Decimal &rhs);
const Decimal&
operator*=(const Decimal &rhs);

Static Constants

RWDecimal missing; 
RWDecimal NaN;
RWDecimal null;


Previous fileTop of DocumentContentsIndex pageNext file

©2004-2007 Copyright Quovadx, Inc. All Rights Reserved.
Quovadx and Rogue Wave are registered trademarks and HydraSDO is a trademark of Quovadx, 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.