Number formatting

TFormattableNumber, derived from TFormattable, and TNumberFormatter, derived from TFormatter, provide the mechanism for scanning and formatting numbers. Classes derived from TNumberFormatter provide formatting for various numbering systems used throughout the world. To format numbers in the Western decimal numbering system, use TPositionalNumberFormatter and its derived classes.


TFormattableNumber stores a numeric value as a double, allowing it to be formatted by a number formatter.

TNumberFormatter is the abstract base class for classes that scan and format numerical data. TNumberFormatter manipulates numerical data wrapped in a TFormattableNumber instance. The system provides TNumberFormatter subclasses that cover most of the commonly used number formats in most languages:

    The system includes the following subclass of TPositionalNumberFormatter that provides additional functionality for handling non-integers within a value-based system:
  1. TRationalNumberFormatter formats non-integer values as a ratio of two integers--a fraction (for example, 22/7). TRationalNumberFormatter lets you specify:
TUniversalNumberFormatter, a special class derived from TFloatingPointNumberFormatter, provides a formatter with a universal range. This class can handle any number, including infinity and NaNs. TUniversalNumberFormatter is the default formatter for all other number formatting classes, guaranteeing that you will get a result whenever you format data from a binary number into a text representation. You will not need to use this class directly.

TNumerals provides the character-value mapping rules used by a TNumberFormatter. Two subclasses are provided:


[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker