mecej4
Joined: 31 Oct 2006 Posts: 1886
|
Posted: Sat Apr 09, 2022 9:05 pm Post subject: Error in documentation of intrinsic function RANGE |
|
|
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
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. |
|