LF Fortran 95

HUGE Function


The HUGE function returns the largest representable number of the argument's data type.


HUGE (x)


x is an INTENT(IN) scalar or array of type REAL or INTEGER.


The result is of the same type and kind as x. Its value is the value of the largest number representable by the data type of x.


real(kind(1.e0)) :: r10 real(kind(1.d0)) :: r100 real(kind(1.q0)) :: r1000 integer(selected_int_kind(r=1)) :: i1 integer(selected_int_kind(r=4)) :: i4 integer(selected_int_kind(r=7)) :: i7 integer(selected_int_kind(r=12)) :: i12 write(*,*) huge(r10) ! writes 3.40282347e+38 write(*,*) huge(r100) ! writes 1.797693134862316e+308 write(*,*) huge(r1000) ! writes 1.18973....28007e+4932 write(*,*) huge(i1) ! writes 127 write(*,*) huge(i4) ! writes 32767 write(*,*) huge(i7) ! writes 2147483647 write(*,*) huge(i12) ! writes 9223372036854775807