You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
173 lines
6.2 KiB
Plaintext
173 lines
6.2 KiB
Plaintext
|
|
Dear Qt users,
|
|
|
|
I would like to announce initial public release of QDecimal library.
|
|
|
|
Most computers today support binary floating-point in hardware. While suitable
|
|
for many purposes, binary floating-point arithmetic should not be used
|
|
for financial, commercial, and user-centric applications because the
|
|
decimal data used in these applications cannot be represented exactly
|
|
using binary floating-point.
|
|
|
|
The General Decimal Arithmetic (GDA) specification aims to address
|
|
deficiencies in the binary floating-point arithmetic, and defines a
|
|
decimal arithmetic which meets the requirements of commercial,
|
|
financial, and human-oriented applications. It also matches the
|
|
decimal arithmetic in the IEEE 754-2008 Standard for Floating Point
|
|
Arithmetic.
|
|
|
|
The decNumber library is full implementation of the GDA specification
|
|
and also matches the decimal arithmetic in the IEEE 754-2008 Standard
|
|
for Floating Point Arithmetic.
|
|
|
|
The QDecimal is a thin layer around IBM's decNumber library which
|
|
implements the General Decimal Arithmetic Specification in ANSI C. [1]
|
|
|
|
The QDecimal/decNumberlibrary [2,3] fully implements the specification,
|
|
and hence supports integer, fixed-point, and floating-point decimal
|
|
numbers directly, including infinite, NaN (Not a Number), and
|
|
subnormal values. Both arbitrary-precision and fixed-size
|
|
representations are supported.
|
|
|
|
The aim of the QDecimal library [4] is to extend decNumber functionality
|
|
to C++ language and Qt framework by using idioms, tecniques and best
|
|
practices in both tecnologies. For instance, inline functions are used
|
|
heavily to aid optimization, operator overloading and conversion
|
|
operators are defined to aid type casting in between the types defined
|
|
by QDecimal. Further these types are integrated with Qt object model
|
|
by introducing them to Qt meta type system.
|
|
|
|
|
|
CONTENTS
|
|
Following classes are defined by QDecimal library:
|
|
|
|
QDecNumber (based on decNumber):
|
|
----------
|
|
decNumber module uses an arbitrary-precision decimal number
|
|
representation designed for efficient computation in software and
|
|
implements the arithmetic and logical operations, together with a
|
|
number of conversions and utilities. Once a number is held as a
|
|
decNumber, no further conversions are necessary to carry out
|
|
arithmetic.
|
|
|
|
The decNumber representation is variable-length and machine-dependent
|
|
(for example, it contains integers which may be big-endian or
|
|
little-endian).
|
|
|
|
QDecNumber encapsulates decNumber and reimplements global functions
|
|
that operates upon decNumber as member functions with the same name.
|
|
|
|
|
|
QDecContext (based on decContext):
|
|
-----------
|
|
Most functions in the decNumber module take as an argument a
|
|
decContext structure, which provides the context for operations
|
|
(precision, rounding mode, etc.) and also controls the handling of
|
|
exceptional conditions (corresponding to the flags and trap enablers
|
|
in a hardware floating-point implementation).
|
|
|
|
QDecContext encapsulates decContext and provides decNumber library
|
|
functions that operates upon decContext as member functions.
|
|
|
|
|
|
QDecSingle (based on decSingle/decimal32):
|
|
----------
|
|
decimal32 is a 32-bit decimal floating-point representation which
|
|
provides 7 decimal digits of precision in a compressed format.
|
|
|
|
decSingle module provides the functions for the decimal32 format; this
|
|
format is intended for storage and interchange only and so the module
|
|
provides utilities and conversions but no arithmetic functions.
|
|
|
|
QDecSingle encapsulates decSingle and provides decNumber library
|
|
functions that operates upon decSingle as member functions with the
|
|
same name.
|
|
|
|
|
|
QDecDouble (based on decDouble/decimal64):
|
|
----------
|
|
decimal64 is a 64-bit decimal floating-point representation which
|
|
provides 16 decimal digits of precision in a compressed format.
|
|
|
|
decDouble module provides the functions for the decimal64 format; this
|
|
format is an IEEE 754 basic format and so a full set of arithmetic and
|
|
other functions is included.
|
|
|
|
QDecDouble encapsulates decDouble and provides decNumber library
|
|
functions that operates upon decSingle as member functions with the
|
|
same name.
|
|
|
|
|
|
QDecQuad (based on decQuad/decimal128):
|
|
--------
|
|
decimal128 is a 128-bit decimal floating-point representation which
|
|
provides 34 decimal digits of precision in a compressed format.
|
|
|
|
decQuad module provides the functions for the decimal128 format; this
|
|
format is an IEEE 754 basic format; it contains the same set of
|
|
functions as decDouble.
|
|
|
|
QDecQuad encapsulates decQuad and provides decNumber library functions
|
|
that operates upon decSingle as member functions with the same name.
|
|
|
|
|
|
QDecPacked (based on decPacked):
|
|
---------
|
|
The decPacked format is the classic packed decimal format implemented
|
|
by IBM S/360 and later machines, where each digit is encoded as a
|
|
4-bit binary sequence (BCD) and a number is ended by a 4-bit sign
|
|
indicator. The decPacked module accepts variable lengths, allowing for
|
|
very large numbers (up to a billion digits), and also allows the
|
|
specification of a scale.
|
|
|
|
QDecPacked augments decPacked by encapsulating reference counted byte
|
|
array and scale of the decimal point as member variables, thus, freeing up
|
|
user of this class from memory management and keeping track of scale value.
|
|
|
|
|
|
LICENSE
|
|
QDecimal is under the terms of the LGPL v2.1.
|
|
decNumber is under the terms of ICU v1.8.1
|
|
See COPYRIGHT file within the package for terms of the these licenses.
|
|
Both licences allow commercial and non-commercial use of the software.
|
|
|
|
|
|
PLATFORMS
|
|
QDecimal should be usable in all platforms on which Qt 4.7.x or
|
|
greater is supported:
|
|
We regularly test on following platforms:
|
|
Solaris 11 x86 (sstudio 12.2 CC 5.11)
|
|
Linux x64 2.6.38 (Ubuntu 11.04 - gcc 4.5.2)
|
|
Linux x86 2.6.38 (Ubuntu 11.04- gcc 4.5.2)
|
|
Windows XP (msvc 2008)
|
|
|
|
|
|
CREDITS
|
|
We are grateful to Mike Cowlishaw et al. from IBM for making decNumber package
|
|
available. Further, Mr. Cowlishaw has kindly helped us while making
|
|
QDecimal production ready.
|
|
|
|
|
|
REFERENCES
|
|
[1] General Decimal Arithmetic Specification
|
|
http://speleotrove.com/decimal/decarith.html
|
|
|
|
[2] The decNumber Library
|
|
http://speleotrove.com/decimal/decnumber.html
|
|
|
|
[3] General Decimal Arithmetic
|
|
http://speleotrove.com/decimal
|
|
|
|
[4] QDecimal Project Home
|
|
http://code.google.com/p/qdecimal
|
|
|
|
|
|
|
|
Regards,
|
|
Semih Cemiloglu
|
|
|
|
semih (at) cemiloglu.org
|
|
PGP/GPG KeyId: FCEE9B7A on keyserver.pgp.com
|
|
Fingerprint: ED8F48028DE03BE0A2C95E0FACC5043BFCEE9B7A
|
|
|