re PR c/34252 (DEC32_MIN_EXP, DEC32_MAX_EXP don't match TR 24732)
gcc/ PR c/34252 * ginclude/float.h: Rename DECnn_DEN to DECnn_SUBNORMAL_MIN. * real.c (decimal_single_format): Correct values of emin and emax. (decimal_double_format): Ditto. (decimal_quad_format): Ditto. * c-cppbuiltin.c (builtin_define_decimal_float_constants): Adjust computation of DECnn_MIN and DECnn_MAX for corrected values of emin and emax. Define __DECnn_SUBNORMAL_MIN__ instead of __DECnn_MIN__, and adjust its computation for the corrected value of emin. gcc/testsuite/ PR c/34252 * gcc.dg/dfp/decfloat-constants.c: Check for DECnn_SUBNORMAL_MIN instead of DECnn_DEN. Support -DDBG to list lines that fail. From-SVN: r143128
This commit is contained in:
parent
300240e181
commit
c52ec94809
6 changed files with 78 additions and 44 deletions
|
@ -1,3 +1,16 @@
|
|||
2009-01-06 Janis Johnson <janis187@us.ibm.com>
|
||||
|
||||
PR c/34252
|
||||
* ginclude/float.h: Rename DECnn_DEN to DECnn_SUBNORMAL_MIN.
|
||||
* real.c (decimal_single_format): Correct values of emin and emax.
|
||||
(decimal_double_format): Ditto.
|
||||
(decimal_quad_format): Ditto.
|
||||
* c-cppbuiltin.c (builtin_define_decimal_float_constants): Adjust
|
||||
computation of DECnn_MIN and DECnn_MAX for corrected values of
|
||||
emin and emax. Define __DECnn_SUBNORMAL_MIN__ instead of
|
||||
__DECnn_MIN__, and adjust its computation for the corrected value
|
||||
of emin.
|
||||
|
||||
2009-01-06 Jan Hubicka <jh@suse.cz>
|
||||
|
||||
PR target/38744
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Define builtin-in macros for the C family front ends.
|
||||
Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008
|
||||
Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
@ -279,7 +279,7 @@ builtin_define_decimal_float_constants (const char *name_prefix,
|
|||
|
||||
/* Compute the minimum representable value. */
|
||||
sprintf (name, "__%s_MIN__", name_prefix);
|
||||
sprintf (buf, "1E%d%s", fmt->emin, suffix);
|
||||
sprintf (buf, "1E%d%s", fmt->emin - 1, suffix);
|
||||
builtin_define_with_value (name, buf, 0);
|
||||
|
||||
/* Compute the maximum representable value. */
|
||||
|
@ -292,8 +292,9 @@ builtin_define_decimal_float_constants (const char *name_prefix,
|
|||
*p++ = '.';
|
||||
}
|
||||
*p = 0;
|
||||
/* fmt->p plus 1, to account for the decimal point. */
|
||||
sprintf (&buf[fmt->p + 1], "E%d%s", fmt->emax, suffix);
|
||||
/* fmt->p plus 1, to account for the decimal point and fmt->emax
|
||||
minus 1 because the digits are nines, not 1.0. */
|
||||
sprintf (&buf[fmt->p + 1], "E%d%s", fmt->emax - 1, suffix);
|
||||
builtin_define_with_value (name, buf, 0);
|
||||
|
||||
/* Compute epsilon (the difference between 1 and least value greater
|
||||
|
@ -302,8 +303,8 @@ builtin_define_decimal_float_constants (const char *name_prefix,
|
|||
sprintf (buf, "1E-%d%s", fmt->p - 1, suffix);
|
||||
builtin_define_with_value (name, buf, 0);
|
||||
|
||||
/* Minimum denormalized positive decimal value. */
|
||||
sprintf (name, "__%s_DEN__", name_prefix);
|
||||
/* Minimum subnormal positive decimal value. */
|
||||
sprintf (name, "__%s_SUBNORMAL_MIN__", name_prefix);
|
||||
p = buf;
|
||||
for (digits = fmt->p; digits > 1; digits--)
|
||||
{
|
||||
|
@ -312,7 +313,7 @@ builtin_define_decimal_float_constants (const char *name_prefix,
|
|||
*p++ = '.';
|
||||
}
|
||||
*p = 0;
|
||||
sprintf (&buf[fmt->p], "1E%d%s", fmt->emin, suffix);
|
||||
sprintf (&buf[fmt->p], "1E%d%s", fmt->emin - 1, suffix);
|
||||
builtin_define_with_value (name, buf, 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2002, 2007 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 2002, 2007, 2009 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
|
@ -214,13 +214,13 @@ Boston, MA 02110-1301, USA. */
|
|||
#define DEC64_MIN __DEC64_MIN__
|
||||
#define DEC128_MIN __DEC128_MIN__
|
||||
|
||||
/* Minimum denormalized positive floating-point number. */
|
||||
#undef DEC32_DEN
|
||||
#undef DEC64_DEN
|
||||
#undef DEC128_DEN
|
||||
#define DEC32_DEN __DEC32_DEN__
|
||||
#define DEC64_DEN __DEC64_DEN__
|
||||
#define DEC128_DEN __DEC128_DEN__
|
||||
/* Minimum subnormal positive floating-point number. */
|
||||
#undef DEC32_SUBNORMAL_MIN
|
||||
#undef DEC64_SUBNORMAL_MIN
|
||||
#undef DEC128_SUBNORMAL_MIN
|
||||
#define DEC32_SUBNORMAL_MIN __DEC32_SUBNORMAL_MIN__
|
||||
#define DEC64_SUBNORMAL_MIN __DEC64_SUBNORMAL_MIN__
|
||||
#define DEC128_SUBNORMAL_MIN __DEC128_SUBNORMAL_MIN__
|
||||
|
||||
/* The floating-point expression evaluation method.
|
||||
-1 indeterminate
|
||||
|
|
16
gcc/real.c
16
gcc/real.c
|
@ -1,6 +1,6 @@
|
|||
/* real.c - software floating point emulation.
|
||||
Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
||||
2000, 2002, 2003, 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
|
||||
Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2002,
|
||||
2003, 2004, 2005, 2007, 2008, 2009 Free Software Foundation, Inc.
|
||||
Contributed by Stephen L. Moshier (moshier@world.std.com).
|
||||
Re-written by Richard Henderson <rth@redhat.com>
|
||||
|
||||
|
@ -4447,8 +4447,8 @@ const struct real_format decimal_single_format =
|
|||
10,
|
||||
7,
|
||||
7,
|
||||
-95,
|
||||
96,
|
||||
-94,
|
||||
97,
|
||||
31,
|
||||
31,
|
||||
false,
|
||||
|
@ -4469,8 +4469,8 @@ const struct real_format decimal_double_format =
|
|||
10,
|
||||
16,
|
||||
16,
|
||||
-383,
|
||||
384,
|
||||
-382,
|
||||
385,
|
||||
63,
|
||||
63,
|
||||
false,
|
||||
|
@ -4491,8 +4491,8 @@ const struct real_format decimal_quad_format =
|
|||
10,
|
||||
34,
|
||||
34,
|
||||
-6143,
|
||||
6144,
|
||||
-6142,
|
||||
6145,
|
||||
127,
|
||||
127,
|
||||
false,
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
2009-01-06 Janis Johnson <janis187@us.ibm.com>
|
||||
|
||||
PR c/34252
|
||||
* gcc.dg/dfp/decfloat-constants.c: Check for DECnn_SUBNORMAL_MIN
|
||||
instead of DECnn_DEN. Support -DDBG to list lines that fail.
|
||||
|
||||
2009-01-06 Dominique Dhumieres <dominiq@lps.ens.fr>
|
||||
|
||||
* gfortran.dg/implicit_12.f90: Add space around dg directive.
|
||||
|
|
|
@ -14,36 +14,50 @@
|
|||
#include <float.h>
|
||||
|
||||
extern void abort (void);
|
||||
static int failcnt;
|
||||
|
||||
/* Support compiling the test to report individual failures; default is
|
||||
to abort as soon as a check fails. */
|
||||
#ifdef DBG
|
||||
#include <stdio.h>
|
||||
#define FAILURE { printf ("failed at line %d\n", __LINE__); failcnt++; }
|
||||
#else
|
||||
#define FAILURE abort ();
|
||||
#endif
|
||||
|
||||
int main ()
|
||||
{
|
||||
if (DEC32_MANT_DIG != 7) abort();
|
||||
if (DEC64_MANT_DIG != 16) abort();
|
||||
if (DEC128_MANT_DIG != 34) abort();
|
||||
if (DEC32_MANT_DIG != 7) FAILURE
|
||||
if (DEC64_MANT_DIG != 16) FAILURE
|
||||
if (DEC128_MANT_DIG != 34) FAILURE
|
||||
|
||||
if (DEC32_MIN_EXP != -95) abort();
|
||||
if (DEC64_MIN_EXP != -383) abort();
|
||||
if (DEC128_MIN_EXP != -6143) abort();
|
||||
if (DEC32_MIN_EXP != -94) FAILURE
|
||||
if (DEC64_MIN_EXP != -382) FAILURE
|
||||
if (DEC128_MIN_EXP != -6142) FAILURE
|
||||
|
||||
if (DEC32_MAX_EXP != 96) abort();
|
||||
if (DEC64_MAX_EXP != 384) abort();
|
||||
if (DEC128_MAX_EXP != 6144) abort();
|
||||
if (DEC32_MAX_EXP != 97) FAILURE
|
||||
if (DEC64_MAX_EXP != 385) FAILURE
|
||||
if (DEC128_MAX_EXP != 6145) FAILURE
|
||||
|
||||
if (DEC32_MAX != 9.999999E96DF) abort();
|
||||
if (DEC64_MAX != 9.999999999999999E384DD) abort();
|
||||
if (DEC128_MAX != 9.999999999999999999999999999999999E6144DL) abort();
|
||||
if (DEC32_MAX != 9.999999E96DF) FAILURE
|
||||
if (DEC64_MAX != 9.999999999999999E384DD) FAILURE
|
||||
if (DEC128_MAX != 9.999999999999999999999999999999999E6144DL) FAILURE
|
||||
|
||||
if (DEC32_EPSILON != 1E-6DF) abort();
|
||||
if (DEC64_EPSILON != 1E-15DD) abort();
|
||||
if (DEC128_EPSILON != 1E-33DL) abort();
|
||||
if (DEC32_EPSILON != 1E-6DF) FAILURE
|
||||
if (DEC64_EPSILON != 1E-15DD) FAILURE
|
||||
if (DEC128_EPSILON != 1E-33DL) FAILURE
|
||||
|
||||
if (DEC32_MIN != 1E-95DF) abort();
|
||||
if (DEC64_MIN != 1E-383DD) abort();
|
||||
if (DEC128_MIN != 1E-6143DL) abort();
|
||||
if (DEC32_MIN != 1E-95DF) FAILURE
|
||||
if (DEC64_MIN != 1E-383DD) FAILURE
|
||||
if (DEC128_MIN != 1E-6143DL) FAILURE
|
||||
|
||||
if (DEC32_DEN != 0.000001E-95DF) abort();
|
||||
if (DEC64_DEN != 0.000000000000001E-383DD) abort();
|
||||
if (DEC128_DEN != 0.000000000000000000000000000000001E-6143DL) abort();
|
||||
if (DEC32_SUBNORMAL_MIN != 0.000001E-95DF) FAILURE
|
||||
if (DEC64_SUBNORMAL_MIN != 0.000000000000001E-383DD) FAILURE
|
||||
if (DEC128_SUBNORMAL_MIN != 0.000000000000000000000000000000001E-6143DL)
|
||||
FAILURE
|
||||
|
||||
if (failcnt != 0)
|
||||
abort ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue