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
35 ! Recent versions of the PGI compilers apparently still
do not fully support
36 ! the use of all intrinsics in
parameter statements
, though this is part of
38 ! real, parameter :: two23
=scale
(1.0,23)
39 ! real, parameter :: two126
=scale
(1.0,126)
44 two126
=scale
(1.0,-126)
48 ! Transfer IEEE bit string
to integer variable
50 ieee
=transfer
(rieee
(j
),ieee
)
52 ! Extract sign bit
, exponent
, and mantissa
54 isign
=ibits
(ieee
,31,1)
56 imant
=ibits
(ieee
,0,23)
58 if (isign
.eq
.1) sign
=-1.0
60 if ( (iexp
.gt
.0).and
.(iexp
.lt
.255) ) then
62 a
(j
)=sign*temp*
(1.0+(two23*real
(imant
)))
64 elseif
( iexp
.eq
.0 ) then
65 if ( imant
.ne
.0 ) then
66 a
(j
)=sign*two126*two23*real
(imant
)
71 elseif
( iexp
.eq
.255 ) then