PACK_REAL
signatureThe PACK_REALsignature specifies the interface for packing and unpacking floating-point numbers into Word8 vectors and arrays. This provides a mechanism for transmitting floating-point values over a network.
For each optional Real{N} structure provided by an implementation, the implementation may also provide a pair of structures PackReal{N}Big and PackReal{N}Little. These structures share the real type defined in Real{N}. The PackReal{N}Big structures perform big-endian packing and unpacking, and the PackReal{N}Little structures perform little-endian packing and unpacking.
In addition, an implementation should provide the structures PackRealBig and PackRealLittle, which are aliases for the PACK_REAL structures related to the default Real structure.
signature PACK_REAL
structure PackRealBig
: PACK_REAL
structure PackRealLittle
: PACK_REAL
structure PackReal{N}Big
: PACK_REAL
structure PackReal{N}Little
: PACK_REAL
type real
val bytesPerElem : int
val isBigEndian : bool
val toBytes : real -> Word8Vector.vector
val fromBytes : Word8Vector.vector -> real
val subVec : (Word8Vector.vector * int) -> real
val subArr : (Word8Array.array * int) -> real
val update : (Word8Array.array * int * real) -> unit
type real
bytesPerElem
isBigEndian
toBytes r
fromBytes vec
subVec (arg, i)
subArr (arg, i)
arg[bytesPerElem*i .. bytesPerElem*i+bytesPerElem-1]
of the aggregate arg and converts it into a real according to the endianess of the structure. Raise exception Subscript if i < 0, or if (len
) / bytesPerElem
) <= i, where len
is the length of arg.
update (arr, i, r)
bytesPerElem*i
through bytesPerElem*(i+1)-1
of the array arr, according to the structure's endianess. Raises exception Subscript if i < 0 or if (Word8Array.length
(arr) / bytesPerElem
) <= i.
PACK_WORD, REAL
Last Modified January 20, 1996
Comments to John Reppy.
Copyright © 1997 Bell Labs, Lucent Technologies