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
This commit is contained in:
Alan Modra 2005-11-15 20:33:48 +00:00 committed by Alan Modra
parent 13b3c36228
commit c69cb92fa0
2 changed files with 15 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2005-11-16 Alan Modra <amodra@bigpond.net.au>
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 <coudert@clipper.ens.fr>
* intrinsic.c (add_functions): Add COMPLEX, FTELL, FGETC, FGET,

View File

@ -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;
}