GCC decimal floating point support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello gcc-help,

I found janis187@xxxxxxxxxx address in the decimal.h header file. But that
address doesn't seem to work.
I have some questions about decimal floating point support in GCC which I
hope you could clarify.

I work in a C++ financial project and we're considering switching to some
decimal floating point type.
I found there are new types decimal32, decimal64 and decimal128 along with
some related functions, mainly conversions from/to other types.
However, I didn't find any string conversions or math functions related to
these new types. I tried different ways of including system headers, like

#define __STDC_WANT_DEC_FP__
#include <stdlib.h>

but this didn't work for me.
It is stated at
https://gcc.gnu.org/onlinedocs/gcc-11.2.0/gcc/Decimal-Float.html (other GCC
versions as well) that the support is incomplete. Same seems to be true for
the latest available GCC 14.2 on godbolt. I looked through GCC release
changes at https://gcc.gnu.org/gcc-<N>/changes.html but there seems to be
little information on decimal support as well.

1. Could you please confirm that there is still only limited support for
these types in GCC? Or I just didn't enable it in some proper way?
2. Is there currently any way to convert decimal<N> types to/from string?
3. Are you aware of when full support is going to be implemented?

I did some research and found two major decimal libraries that conform to
IEEE 754-2019.
These are DecNumber from https://speleotrove.com/decimal/ and Intel Decimal
Floating Point library from https://www.netlib.org/misc/intel/

However, I found these libraries exist on GitHub at different places:
  https://github.com/gcc-mirror/gcc/tree/master/libdecnumber vs
  https://github.com/libdfp/libdfp/tree/master/libdecnumber
and
  https://github.com/gcc-mirror/gcc/tree/master/libgcc/config/libbid vs
  https://github.com/libdfp/libdfp/tree/master/libbid

I did contact Marius Cornea from Intel, mentioned in the Intel sources, and
he confirmed netlib sources to be the primary.
At the same time GCC mirror sources have Free Software Foundation copyright
and the code has differences, which I'm not sure to be fixes or related to
some integration process.

My current understanding is GCC is planning to add support for decimal
types via the mentioned two libraries. But I'm a bit lost on which part
goes where and when.

4. Could you please clarify on how these libraries are related and which
source is a better choice if I decide to use one or another as a standalone
library for our purposes?

Regards,
Eugene



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux