large_real_kind_1.f90 & huge()

Janne Blomqvist jblomqvi@cc.hut.fi
Thu Sep 8 18:42:00 GMT 2005


On Thu, Sep 08, 2005 at 11:10:09AM -0700, Steve Ellcey wrote:
> 
> I was wondering what the standard is for what value the huge() intrinsic
> should return.  The Fortran test gfortran.dg/large_real_kind_1.f90 is
> failing on HPPA HP-UX because huge() is returning " +Infinity" and the
> test seems to be expecting a large (non-infinite) number.
> 
> This works in IA64 Linux & HP-UX because on those systems huge() returns
> "0.1189731495E+04933" and things work OK.  On HPPA HP-UX I get +Infinity.
> 
> Is it OK for huge() to return +Infinity?

No, it's a bug. The F2003 draft says (13.7.44, page 319):

"Returns the largest number of the model representing numbers of the
same type and kind type parameter as the argument."

Specifically, for real "The result has the value
... (1-b^-p)*b^emax". That is, e.g. for a 32-bit real the result is
(1-2^-24)*2^127.

> Where is this intrinsic handled?  I couldn't find the source for it.

Paul B already answered this one.


-- 
Janne Blomqvist



More information about the Fortran mailing list