For data type 32bit reals in fortran, how could you move the first and last 16 bits into integer values? I've tried a number of methods, but can only figure this out if the input is of integer type. Fortran seems to have a limitation working with real types.
example:
decimal 1.0 in binary is : 0011 1111 1000 0000 0000 0000 0000 0000
set HIGH_WORD = 0011 1111 1000 0000
set LOW_WORD = 0000 0000 0000 0000
SUBROUTINE TEST(INPUT, LOW, HIGH)
REAL*4 INPUT
INTEGER*4 LOW
INTEGER*4 LOW_MASK
INTEGER*4 HIGH
INTEGER*4 HIGH_MASK
! METHOD1: ONLY WORKS ON INTS
HIGH = IBITS(INPUT, 0, 16)
LOW = IBITS(INPUT, 16, 16)
! METHOD2: ALSO ONLY WORKS ON INTS
LOW_MASK = 65535
HIGH_MASK = -65536
LOW = LOW_MASK.AND.IN
HIGH = HIGH_MASK.AND.IN
HIGH = JISHFT(HIGH, -16)
END