On 06/18/2012 10:51 PM, Franz Fehringer wrote:
> Hi,
> 
> I am investigating the possibilities of using decimal floating point
> arithmetic with gcc (on Linux / x86_64 to be explicit).

I'm a little rusty on this and my information might be out of date, but
this should be a good start.  If I say something horribly wrong I hope
to be corrected.

> Are _Decimal32/_Decimal64/_Decimal128 available as builtin types without
> further action or do i as a DFP consumer have to issue the correspondent
> typedef/float/attributeS by myself (as is done in the testcases and the
> std::decimal headerS)?
> How do i convert _Decimal32/_Decimal64/_Decimal128/std::decimal from/to
> string/char* (and do cout/stdout I/O)?
> Can the (internal?) std::decimal method __getval (giving one of
> _Decimal32/_Decimal64/_Decimal128) be used by me as a user?

The types _Decimal32, _Decimal64, and _Decimal128 are builtin types for 
C with "gcc --std=gnu99".  Those types are not in the C++ language
extension for decimal float.  With G++ you can use typedefs with modes
SD/DD/TD to use those types for source code shared with C.  G++ treats
the decimal classes as the underlying scalars for passing arguments,
returning function values, and assignments between the classes and the
scalar types; there's no need to use __getval.

> Are there plans to add DFP support to glibc?

I don't know about the current status of decimal floating-point support
in the C library (glibc in particular). For status of GCC's C++ support see
<http://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html#status.iso.tr24733>.

> Are there good examples out there showing the superiority of DFP
> arithmetic over ordinary (binary) FP arithmetic in the domain of
> monetary calculations?

For general information about decimal floating-point arithmetic see
<http://speleotrove.com/decimal/>.  From what I understand, serious
monetary calculations are never done with binary floating-point
arithmetic and most business applications use some sort of software
emulation of decimal floating-point or decimal fixed-point arithmetic.

Janis

Reply via email to