HUGE intrinsic function

Standard: F77 F90 F95 F2003 F2008 F2018 Example program


<Syntax>

HUGE ( X )

X : Integer or Real;
Result : Scalar, same type and kind as X.

<Semantics>

This function returns the largest “model number” for the type and kind of X.

This is an inquiry function, so X need not be defined; indeed, it is permitted to be disassociated, unallocated, or absent.

The model for integer type is as a sign together with DIGITS(X) digits of radix RADIX(X); the HUGE value is therefore DIGITS(X) digits that are all equal to RADIX(X)−1. For example, the model for 8-bit integers has 7 digits of radix 2, and therefore HUGE(0_int8) is equal to B'01111111'.

The model for real type is that it may be zero or a signed fraction between 1 and 1/RADIX(X) consisting of DIGITS(X) digits, multiplied by an exponent RADIX(X)**e with MINEXPONENT(X)≤e≤MAXEXPONENT(X). Thus the largest model number is the value obtained for the fraction just less than 1 (i.e. all digits set to RADIX(X)−1) and with e equal to MAXEXPONENT(X).

Note that HUGE(X) is not necessarily the largest possible value for X; for example, with IEEE floating-point, the largest possible value is +∞, which is infinitely bigger than HUGE(X). It is, however, likely to be the largest value for which the full precision of DIGITS(X) of radix RADIX(X) is available.

<Related>

DIGITS intrinsic function, EPSILON intrinsic function, INTEGER type, MAXEXPONENT intrinsic function, MINEXPONENT intrinsic function, RADIX intrinsic function, REAL type, TINY intrinsic function