;+
; NAME:
;	Compute VMS Floats
; PROCEDURE:
;	The array of byte given as parameter is transformed in 
;	array of reals, with dimensions nx,ny (if present).
; CALLING SEQUENCE:
; 	result = VMSFloat( array )
; INPUT:
;	array: an array of bytes (one dimensional) The number of
;		bytes must be a multiple of four.
; RESULT OF FUNCTION:
;	The array of reals resulting from the conversion of the 
;	array of bytes.
;-
; MODIFICATION HISTORY:
;	Created in September 1991 by A.Csillaghy
;		Inst. of Astronomy, ETH Zurich

FUNCTION VMSFloat, bytes


  memLimit = 363600L

  totalEls = N_Elements(bytes)
  nElems = totalEls < memLimit
  offset = 0L
  nb = FltArr( totalEls / 4 )
  elsConverted = 0

  REPEAT 	BEGIN
    firstEl = offset*memLimit
    indices = LIndGen( nElems/4 )*4 + firstEl

    nb(firstEl/4) = Float( (-1)^(bytes(indices+1) / 128)* $
	( 0.5D + ((bytes(indices) MOD 128)*2D^16 + $
	bytes(indices+3)*2D^8 + bytes(indices+2))*2D^(-24) )* $
	2D^( (bytes(indices+1) MOD 128)*2 + $
	bytes(indices)/128 - 128)  )* $
	(((bytes(indices+1) MOD 128)*2 + $
	bytes(indices)/128 ) NE 0)

   elsConverted = elsConverted + nElems
   offset = offset+1
   nElems =  memLimit < (totalEls - nElems*offset) 
     
  END UNTIL elsConverted EQ totalEls

 siz = SIZE( nb )
 IF  (siz(0) EQ 1) AND (siz(1) EQ 1) THEN  nb = nb(0)
 RETURN, nb

END ; VMS Float