Variable size/Get: Difference between revisions

Content added Content deleted
m (→‎{{header|NS-HUBASIC}}: NS-HUBASIC example added)
m (→‎{{header|Fortran}}: corrected a misspelling.)
Line 451: Line 451:
=={{header|Fortran}}==
=={{header|Fortran}}==
{{works with|Fortran|90 and later}}
{{works with|Fortran|90 and later}}
The intrinsic functions bit_size and digits can be used to find the size of an integer. Bit_size returns the number of bits in an integer while digits returns the number of significant digits in the integer. Because of the use of signed intergers this will be one less than the bit size. Digits can be used on real variables where it returns the number of significant figures in the mantissa.
The intrinsic functions bit_size and digits can be used to find the size of an integer. Bit_size returns the number of bits in an integer while digits returns the number of significant digits in the integer. Because of the use of signed integers this will be one less than the bit size. Digits can be used on real variables where it returns the number of significant figures in the mantissa.
<lang fortran>INTEGER, PARAMETER :: i8 = SELECTED_INT_KIND(2)
<lang fortran>INTEGER, PARAMETER :: i8 = SELECTED_INT_KIND(2)
INTEGER, PARAMETER :: i16 = SELECTED_INT_KIND(4)
INTEGER, PARAMETER :: i16 = SELECTED_INT_KIND(4)