Silverfrost Forums

Welcome to our forums

Error in documentation of intrinsic function RANGE

9 Apr 2022 8:05 #28889

The FTN95 documentation gives a definition of the the intrinsic RANGE that is not quite correct for arguments of type REAL.

The Fortran Standard says that RANGE(X) = INT (MIN (LOG10 (HUGE (X)), −LOG10 (TINY (X))))

For an X86/X64 processor 64-bit real, that evaluates to INT(Min(308.2, 307.6)) = 307, which agrees with the output for

     print *,range(1d0)

The FTN95 documentation says, 'The result is a scalar integer giving the difference between the largest (positive) exponent and the smallest (largest negative) exponent that is used by the compiler for numbers of the given type and kind type.' That would be 308 - (-307) = 615.

10 Apr 2022 7:55 #28893

Thanks mecej4. I will make a note of this.

Please login to reply.