This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/34252] New: DEC32_MIN_EXP, DEC32_MAX_EXP don't match TR 24732


I discovered a few differences in the gcc implemenation of the <float.h>
macros, as compared with the ISO C Tr24732 paper. It may be more likely that
the gcc implementation is incorrect.

In any case, here's what I see in the decfloat-constants.c test from the gcc
4.3 testsuite:

  if (DEC32_MIN_EXP != -95) abort();
  if (DEC64_MIN_EXP != -383) abort();
  if (DEC128_MIN_EXP != -6143) abort();

  if (DEC32_MAX_EXP != 96) abort();
  if (DEC64_MAX_EXP != 384) abort();
  if (DEC128_MAX_EXP != 6144) abort();

Here's the info from Tr24732:

- minimum exponent

DEC32_MIN_EXP -94
DEC64_MIN_EXP -382
DEC128_MIN_EXP -6142

- maximum exponent

DEC32_MAX_EXP 97
DEC64_MAX_EXP 385
DEC128_MAX_EXP 6145

As you can see, they appear to be off-by-one (gcc is always one less). The
constants are generated by the gcc compiler (at least gcc 4.3.0 20071012, which
I am using), so the decfloat-constants test passes.

Also, gcc sets DEC32_DEN, etc:

  if (DEC32_DEN != 0.000001E-95DF) abort();
  if (DEC64_DEN != 0.000000000000001E-383DD) abort();
  if (DEC128_DEN != 0.000000000000000000000000000000001E-6143DL) abort();

Tr24732 specifies these as DEC32_SUBNORMAL_MIN, etc:

DEC32_SUBNORMAL_MIN 0.000001E-95DF
DEC62_SUBNORMAL_MIN 0.000000000000001E-383DD
DEC128_SUBNORMAL_MIN
0.000000000000000000000000000000001E-6143DL

See http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1241.pdf

It looks like the gcc values came from the <decfloats.h> implementation and not
TR 24732.


-- 
           Summary:  DEC32_MIN_EXP, DEC32_MAX_EXP don't match TR 24732
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jeff dot sullivan at intel dot com


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]