[Bug c/39878] gcc 4.3.2 converts Decimal FP constants wrong

janis at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Wed Jun 24 22:03:00 GMT 2009



------- Comment #1 from janis at gcc dot gnu dot org  2009-06-24 22:03 -------
GCC defines DEC_EVAL_METHOD to be 0: "evaluate all operations just to the range
and precision of the type".

The arithmetic/comparison/conversion functions in libgcc (for DPD, not sure
about BID) use the range and precision of the type, which matches 0.

Except for compile-time constants, use of hardware DFP support for POWER6
matches 1: "evaluate operations [and constants] of type _Decimal32 and
_Decimal64 to the range and precision of the _Decimal64 type, evaluate
_Decimal128 operations [and constants] to the range and precision of the
_Decimal128 type".

Within the compiler, decimal float constants are evaluated and folded using
128-bit precision, which matches 2: "evaluate all operations and constants to
the range and precision of the _Decimal128 type".

We could cop out and set DEC_EVAL_METHOD to -1 (indeterminable) but it would be
better to pick one of the other values and honor it consistently.


-- 

janis at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bje at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39878



More information about the Gcc-bugs mailing list