Issue 050317.1: Extensions for decimal floating point

Author: Ben Elliston
Champion: Ben Elliston
Date submitted: 2005-03-17
Date revised:
Date closed:
Type: Enhancement
Status: Accepted with modifications
DWARF Version: 3
Reference: Section: 5.1, page 61

There are three new first-class decimal float types proposed for C99
(please refer to ISO/IEC DTR 24732, WG14 N1107).

While C99 permits an implementation to choose the representation of
float, double and long double, the proposal sets out three distinct
types for radix 10 floating point numbers:

   _Decimal32, _Decimal64, _Decimal128

We would like DWARF3 to be able to record debugging information about
locations that store decimal floating point values.


Proposed enhancement to DWARF3
------------------------------

All that is needed to support decimal floating point is a new encoding
attribute (I propose \"DW_ATE_decimal_float\").  The DW_AT_byte_size
attribute would be used to further identify each of these C99 types:

1. The C99 type _Decimal32 will be represented by a base type entry
   with a name attribute whose value is \"_Decimal32\", an encoding
   attribute whose value is DW_ATE_decimal_float and a byte size
   attribute whose value is 4.

2. The C99 type _Decimal64 will be represented by a base type entry
   with a name attribute whose value is \"_Decimal64\", an encoding
   attribute whose value is DW_ATE_decimal_float and a byte size
   attribute whose value is 8.

3. The C99 type _Decimal128 will be represented by a base type entry
   with a name attribute whose value is \"_Decimal128\", an encoding
   attribute whose value is DW_ATE_decimal_float and a byte size
   attribute whose value is 16.


Values (in source)
------------------

Decimal floating point values in C99 are the same as the existing
floating point literal syntax, with the exception of one of the
following suffixes denoting decimal floating point values:

  df, dd, dl, DF, DD, DL


Values (encoded)
----------------

These types correspond to the following encodings.  The precise
encoding is specified in IEEE 754R.

  _Decimal32  is an IEEE-754R decimal32 number  (4 bytes)
  _Decimal64  is an IEEE-754R decimal64 number  (8 bytes)
  _Decimal128 is an IEEE-754R decimal128 number (16 bytes)


Debugger display
----------------

These values should be displayed just as binary floating point values
are displayed today.  Perhaps optionally, the debugger could append
the decimal float suffixes (as listed above) on values displayed to
the user to differentiate them from binary floating point values. 


===============================

Revised proposal:

Define DW_ATE_decimal_float, description of IEEE-754R types
or debugger functionality is not needed.