On Wed, Dec 03, 2025 at 10:13:26AM -0500, Steve Summit via Gcc wrote:
> Jonathan Wakely wrote:
> > On Wed, 26 Nov 2025 at 03:07, Steve Summit <[email protected]> wrote:
> >>> ...Implementing decimal floating point must have been a ton of
> >>> not-immediately-rewarding work, and I'm impressed that it has
> >>> been completed already.
> >>
> >> They've been supported for many many years, but it's based on the
> >> N1312 proposal from 2008, not on C23:
> >> https://gcc.gnu.org/onlinedocs/gcc/Decimal-Float.html
> >
> > Support seems to have been first added to GCC 4.2.0, based on the
> > earlier N1176 draft:
> > https://gcc.gnu.org/onlinedocs/gcc-4.2.0/gcc/Decimal-Float.html#Decimal-Float
>
> Thanks for the historical info. (And I had no idea it had been
> in there for that long! :-) )
>
> My next question is, does anyone know how the decision is made
> about which dfp intrinsics to build into libgcc? For x86_64,
> at least, it seems to use some Intel-derived code underneath
> libgcc/config/libbid. But there's also a copy of libdecnumber,
> which I believe is based on Cowlishaw's work at IBM. (Perhaps
> libdecnumber is used on platforms where DPD is required?)
The basic DFP support is in libgcc (again, for many years), but
intentionally only in libgcc.a and not in libgcc_s.so.1, because it would
quadruple the size of .text section of that library and add further
more than 2MB in .rodata (current library has < 3KB .rodata), for something
that 99.99% programs don't use.
For the printf/scanf etc. support, right now you need libdfp not maintained
as part of GCC (nor glibc). I don't know what the glibc projects plans to
do for _Decimal* support if anything, and in what way it will handle it such
that all users don't need to pay the huge costs when it is only rarely used.
Jakub