[Development] Decimal arithmetic classes proposal

Sviatoslav Feshchenko sviatoslavf at icloud.com
Sat Feb 20 18:03:24 CET 2016


I would like to propose to develop classes for inclusion in the Qt library to support general decimal arithmetic. Such classes would be useful for financial and other applications requiring accurate decimal arithmetic. The intent is to develop the classes as a wrapper around the existing decNumber C library which is a reference implementation of the standards applicable to decimal arithmetic (IEEE 754). More details about the library can be found here: http://speleotrove.com/decimal/

The deNumber library is available under ICU permissive licence, the details of which are here: http://source.icu-project.org/repos/icu/icu/trunk/license.html

Before I spend the time developing the classes, I would like to ask the Qt developer community if such classes would be in line with Qt interest and if my contribution would have a reasonable chance of being accepted into the library assuming high quality Qt standards compliant code.

There would be at least 3 classes:

QDouble - decimal encoded compressed format 64 bits long
QQuad - decimal encoded compressed format 128 bits long
QDecimal - arbitrary precision

There may be a 4th class:

QDecimalContext - a context for computations which maintain details about precision of the result (number of digits, exponent etc.), rounding algorithm to use, and record if any errors occurred during an operation. I may implement this class as part of the 3 main decimal classes rather than as a separate class. The decision is yet to be made.

Please advise if such classes would be of value to Qt and if I should spend the time developing them.

Sviatoslav


More information about the Development mailing list