Nyquist / XLISP 2.0  -  Contents | Tutorials | Examples | Reference

read-float


Type:   -   function (subr)
Source:   -   xlfio.c

Syntax

(read-float [stream [length]])
stream - the input stream (default is standard input)
length - the length of the float in bytes [default is 4, legal values are -4, -8, 4, and 8]
returns - the float

Description

The 'read-float' function reads a binary floating point number from an input stream, created by the open-binary function.

Note: Integers and floats are assumed to be big-endian [high-order byte first] and signed, regardless of the platform. To read little-endian format, use a negative number for the length, e.g. '-4' indicates a 4-bytes, low-order byte first. The file should be opened in binary mode.

Examples


See also read-int, write-int, write-float, bigendianp, open-binary.

  Back to Top


Nyquist / XLISP 2.0  -  Contents | Tutorials | Examples | Reference