Decimal Arithmetic Specification, version 1.70
Copyright (c) IBM Corporation, 2009. All rights reserved. ©
7 Apr 2009
[previous | contents | next]



This document defines a general purpose decimal arithmetic. A correct implementation of this specification using appropriate parameters will conform to the decimal arithmetic defined in IEEE standard 754-2008,[1]  except for some minor restrictions, and will also provide unrounded decimal arithmetic[2]  and integer arithmetic as proper subsets.


This specification defines the following:


This specification does not define the following:


This specification deviates from the requirements of IEEE 754 in the following respects:
  1. The remainder-near operator is restricted to those values where the intermediate integer can be represented in the current precision.[4] 
  2. The mathematical functions do not, in general, correspond to the recommended functions in IEEE 754 with the same or similar names; in particular, the power function has some different special cases, and most of the functions may be up to one unit wrong in the last place.
  3. The squareroot function is only specified here for one rounding algorithm (IEEE 754 requires it to be supported for all rounding algorithms). However, it is defined to be correctly rounded.
The requirements of IEEE 854 over the use of the terms single precision and double precision are not followed in this specification because since that standard was published these terms have become synonymous with particular sizes of encodings (32-bit and 64-bit respectively).
[1] IEEE 754-2008 – IEEE Standard for Floating-Point Arithmetic, The Institute of Electrical and Electronics Engineers, Inc., New York, 2008. (In press.)
[2] Sometimes called ‘fixed-point’ decimal arithmetic.
[3] The IEEE 754 decimal encodings for interchange formats are described in:
[4] This is because the conventional implementation of this operator would be unacceptably long-running for the range of numbers allowed by this specification (with up to nine digits of exponent). For restricted-range numbers, an implementation can easily be made to conform to IEEE 754 in this respect.

[previous | contents | next]