next up previous contents
Next: THE NUM_ FUNCTIONS
Up: THE VEC_ ROUTINES
Previous: VEC_ Arithmetic and Mathematical Routines

VEC_ Type Conversion Routines

Conversion of vectorised arrays between numerical data types may be performed by invoking the appropriate VEC_ type conversion routines, using statements such as:

CALL VEC_$<$T$_{1}>$TO$<$T$_{2}>$ ( BAD, N, ARG, RESULT, IERR, NERR, STATUS )

Here, the VEC_ routine takes a vectorised input argument array with N elements of type $<$T$_{1}>$ and returns a vectorised result array of type $<$T$_{2}>$, having performed type conversion on each array element. The data type codes $<$T$_{1}>$ and $<$T$_{2}>$ may be any of those specified in Table [*].

Thus, for example, the subroutine VEC_BTOUW converts a vectorised array of byte data into unsigned word data, while VEC_DTOI converts a vectorised array from double precision to integer.

Note that conversions from floating point types (_REAL or _DOUBLE) to non-floating point types result in rounding of the data (not truncation as would happen with a Fortran assignment statement).


next up previous contents
Next: THE NUM_ FUNCTIONS
Up: THE VEC_ ROUTINES
Previous: VEC_ Arithmetic and Mathematical Routines

PRIMDAT --- Processing of Primitive Numerical Data
Starlink User Note 39
R F Warren-Smith
28 February 1995
E-mail:ussc@star.rl.ac.uk

Copyright © 2009 Science and Technology Facilities Council