A signed decimal datatype to support writing userland accounting programs (major business application area), without loss of accuracy (including losses caused by not all 'decimal decimals' having exact 'binary decimal' representation).

Syntax:

dec(a,b) foo;

Where a is an integer 1<=a<=99 (total no of digits, including any decimal digits).
b is also an integer 0 <= b <= a (no. of decimal digits);

b = 0 implies b can be omitted e.g. 'dec(4,0) foo;' can also be written 'dec(4) foo;'.

Basic arithmetic supported.
Normal assignment rule is truncation/padding, but a 'round(d)' function to round to d decimal places provided. Also provide a formatting function to convert dec type to printable character string.

Not very interesting from a theoretical viewpoint (just COBOL or PL/I datatype),
but (I think) of practical value in encouraging D adoption.

Reply via email to