1 subroutine rdieee
(rieee
,a
,num
)
2 !$$$ SUBPROGRAM DOCUMENTATION BLOCK
5 ! PRGMMR
: Gilbert ORG
: W
/NP11
DATE: 2000-05-09
7 ! ABSTRACT
: This
subroutine reads a list of
real values in
8 ! 32-bit IEEE floating point
format.
10 ! PROGRAM HISTORY LOG
:
13 ! USAGE
: CALL rdieee
(rieee
,a
,num
)
14 ! INPUT ARGUMENT LIST
:
15 ! rieee
- Input array of floating point values in
32-bit IEEE
format.
16 ! num
- Number of floating point values
to convert
.
18 ! OUTPUT ARGUMENT LIST
:
19 ! a
- Output array of
real values
.
24 ! LANGUAGE
: Fortran
90
29 real(4),intent
(in
) :: rieee
(num
)
30 real,intent
(out
) :: a
(num
)
31 integer,intent
(in
) :: num
37 integer,save
:: once
=0
39 if ( once
.EQ
. 0 ) then
42 two126
=scale
(1.0,-126)
47 ! Transfer IEEE bit string
to integer variable
49 ieee
=transfer
(rieee
(j
),ieee
)
51 ! Extract sign bit
, exponent
, and mantissa
53 isign
=ibits
(ieee
,31,1)
55 imant
=ibits
(ieee
,0,23)
57 if (isign
.eq
.1) sign
=-1.0
59 if ( (iexp
.gt
.0).and
.(iexp
.lt
.255) ) then
61 a
(j
)=sign*temp*
(1.0+(two23*real
(imant
)))
63 elseif
( iexp
.eq
.0 ) then
64 if ( imant
.ne
.0 ) then
65 a
(j
)=sign*two126*two23*real
(imant
)
70 elseif
( iexp
.eq
.255 ) then