On Wed, 26 Nov 2025 at 09:52, Jonathan Wakely <[email protected]> wrote:
>
> On Wed, 26 Nov 2025 at 03:07, Steve Summit <[email protected]> wrote:
> >
> > I have some questions about decimal floating point ("dfp")
> > support, specifically the new _Decimal32, _Decimal64, and
> > _Decimal128 types introduced in C23.  I'm hoping to talk to
> > someone familiar with their implementation in gcc.
> >
> > If nothing else, I want to say, Thank you!  Implementing decimal
> > floating point must have been a ton of not-immediately-rewarding
> > work, and I'm impressed that it has been completed already.
> > (I suppose there was experimental work already being performed
> > in advance of C23's ratification.)
>
> 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
Although it wasn't mentioned in the release notes until GCC 4.3:
https://gcc.gnu.org/gcc-4.3/changes.html (under "C family").

>
>
> >
> > What's disappointing, however -- and no fault of gcc's -- is that
> > it's difficult to actually usefully *use* the decimal floating
> > point types.  As far as I know you can assign them, and add and
> > subtract them, and multiply and divide them, but you can't call
> > scanf or strtod64 to get one into your program, or printf to
> > print one back out -- because glibc doesn't support them yet.
> > (And then there are considerably thornier problems if you want to
> > be able to use decimal versions of all the <math.h> functions.)
>
> Yes, as noted at the link above.
>
> > I guess anyone who wants to start using the decimal types
> > with gcc today has to separately download and install libdfp
> > (https://github.com/libdfp/libdfp), which though a valiant
> > effort, is still a separate project, and unavoidably somewhat
> > incomplete.
> >
> > So I have an interest -- it may be foolhardy -- in trying to
> > get some decent decimal floating point support built natively
> > into glibc.  However, the folks on the glibc mailing list have
> > suggested that coordination -- closer than I had imagined --
> > with gcc might be necessary.  Specifically, they're concerned
> > about correct rounding, and user-settable rounding modes, and
> > libgcc, and related issues.
> >
> > I'm not going to plough ahead with those questions just now --
> > I'm not necessarily conversant enough on some of the issues to
> > even present them intelligibly -- but I would like to start a
> > dialog with any gcc maintainers who have an interest in dfp.
> > I'm guessing the library problem has been thought about;
> > I suspect there are probably plans or at least ideas for how
> > dfp might best be supported in the library.  So if you have
> > any knowledge of those plans, and some time to discuss them,
> > please let me know, because I'd like to help figure out how
> > to get decimal floating point better supported, if possible.

Reply via email to