public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* decimal float support for C++
@ 2009-07-08 22:33 Janis Johnson
  2009-07-14 15:16 ` Jason Merrill
  0 siblings, 1 reply; 4+ messages in thread
From: Janis Johnson @ 2009-07-08 22:33 UTC (permalink / raw)
  To: gcc, libstdc++

I'm investigating support for decimal floating-point arithmetic in G++.

GCC currently supports this functionality in C for several targets based
on ISO/IEC TR 24732.  The C support adds 3 new scalar types: _Decimal32,
_Decimal64, and _Decimal128.  With support for mangling those types and
defining typedefs to the underlying type modes, G++ already passes
almost all of GCC's decimal float tests.

The C++ standards committee defined quite different support for C++ in
ISO/IEC DTR 24733, "Extension for the programming language C++ to
support decimal floating-point arithmetic".  It defines the support in
terms of classes decimal32, decimal64, and decimal128 in namespace
decimal, defined in <decimal>, and allows decimal floating-point
literals as a conforming extension.

If libstdc++ support can depend on compiler support for the decimal
float type modes then the support is straightforward, with classes that
contain a data member of the type mode.  The only tricky part is
passing arguments and return values in a way that is compatible with C,
since one is a scalar and the other is a class.  This affects not just
intercallability between user code written in C and C++, but also
access to the decimal float math functions defined for both C and C++.

Given that libstdc++ is used with compilers other than G++, is it
allowable to depend on non-standard C++ compiler support?  An
alternative is for the libstdc++ support to use decNumber and/or libbid,
but that would be less efficient and more time-consuming to implement.

Both TRs are available online:
C:   http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1312.pdf
C++: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2849.pdf
  
Janis


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: decimal float support for C++
  2009-07-08 22:33 decimal float support for C++ Janis Johnson
@ 2009-07-14 15:16 ` Jason Merrill
  2009-07-14 17:36   ` Janis Johnson
  0 siblings, 1 reply; 4+ messages in thread
From: Jason Merrill @ 2009-07-14 15:16 UTC (permalink / raw)
  To: janis187; +Cc: gcc, libstdc++

On 07/09/2009 12:32 AM, Janis Johnson wrote:
> Given that libstdc++ is used with compilers other than G++, is it
> allowable to depend on non-standard C++ compiler support?

Seems reasonable to me, but we may want to standardize the support in 
the ABI.

Jason

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: decimal float support for C++
  2009-07-14 15:16 ` Jason Merrill
@ 2009-07-14 17:36   ` Janis Johnson
  2009-07-14 18:24     ` Jason Merrill
  0 siblings, 1 reply; 4+ messages in thread
From: Janis Johnson @ 2009-07-14 17:36 UTC (permalink / raw)
  To: Jason Merrill; +Cc: gcc, libstdc++

On Tue, 2009-07-14 at 17:16 +0200, Jason Merrill wrote:
> On 07/09/2009 12:32 AM, Janis Johnson wrote:
> > Given that libstdc++ is used with compilers other than G++, is it
> > allowable to depend on non-standard C++ compiler support?
> 
> Seems reasonable to me, but we may want to standardize the support in 
> the ABI.

What's the forum for discussions about the C++ ABI?

Janis

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: decimal float support for C++
  2009-07-14 17:36   ` Janis Johnson
@ 2009-07-14 18:24     ` Jason Merrill
  0 siblings, 0 replies; 4+ messages in thread
From: Jason Merrill @ 2009-07-14 18:24 UTC (permalink / raw)
  To: janis187; +Cc: gcc, libstdc++

On 07/14/2009 07:35 PM, Janis Johnson wrote:
> What's the forum for discussions about the C++ ABI?

cxx-abi-dev@codesourcery.com

Jason

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-07-14 18:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-08 22:33 decimal float support for C++ Janis Johnson
2009-07-14 15:16 ` Jason Merrill
2009-07-14 17:36   ` Janis Johnson
2009-07-14 18:24     ` Jason Merrill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).