System.Currency

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

type Currency = Currency;

C++

class RTL_DELPHIRETURN Currency : public CurrencyBase

Properties

Type Visibility Source Unit Parent
type
class
public
System.pas
syscurr.h
System System

Description

Currency is the C++ implementation of the Delphi Currency data type.

Use Currency to hold monetary values.

Note: A Currency object is implemented as a 64-bit signed integer. Avoid operations that might cause integer overflow. The interval of Currency is

[-922337203685477.5808.. 922337203685477.5807

- (263+1)/10000.. 263/10000]

Use only the operators defined by Currency. The compiler ignores any operators you overload yourself. Use the Currency constructors to create Currency objects from pointers to other Currency objects, and also from numeric and string values.

To utilize the C++ streaming operators (<< and >>) with Currency, you must include the iostream library before the syscurr library:

#include <iostream>
#include <syscurr>
...

The following stream operators are defined:

ostream& operator << (ostream& os, const Currency& arg);
istream& operator >> (istream& is, Currency& arg);

Currency is a fixed-point data type. The maximum error when converting from floating-point to Currency is 0.00005.

See Also