From: Alan Modra Date: Tue, 15 Nov 2005 20:33:48 +0000 (+0000) Subject: re PR fortran/24096 (huge() returns infinity for long doubles) X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c69cb92fa0080b53fbdd10fb249b0da62b039dec;p=platform%2Fupstream%2Fgcc.git re PR fortran/24096 (huge() returns infinity for long doubles) PR fortran/24096 * trans-types.c (gfc_init_kinds): Use one less for max_exponent of IBM extended double format. From-SVN: r107041 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 0a24084..7e22961 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2005-11-16 Alan Modra + + PR fortran/24096 + * trans-types.c (gfc_init_kinds): Use one less for max_exponent + of IBM extended double format. + 2005-11-13 Francois-Xavier Coudert * intrinsic.c (add_functions): Add COMPLEX, FTELL, FGETC, FGET, diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c index 81a90f1..6aaf81a 100644 --- a/gcc/fortran/trans-types.c +++ b/gcc/fortran/trans-types.c @@ -192,6 +192,15 @@ gfc_init_kinds (void) gfc_real_kinds[r_index].digits = fmt->p; gfc_real_kinds[r_index].min_exponent = fmt->emin; gfc_real_kinds[r_index].max_exponent = fmt->emax; + if (fmt->pnan < fmt->p) + /* This is an IBM extended double format (or the MIPS variant) + made up of two IEEE doubles. The value of the long double is + the sum of the values of the two parts. The most significant + part is required to be the value of the long double rounded + to the nearest double. If we use emax of 1024 then we can't + represent huge(x) = (1 - b**(-p)) * b**(emax-1) * b, because + rounding will make the most significant part overflow. */ + gfc_real_kinds[r_index].max_exponent = fmt->emax - 1; gfc_real_kinds[r_index].mode_precision = GET_MODE_PRECISION (mode); r_index += 1; }