# $$\text{FileWriteReal}$$¶

You can use the $$\text{FileWriteReal}$$ function to write a real value to a file in single precision or double precision format.

You can use the \filewritereal backslash command to insert this function.

The following variants of this function are available:

• $$\text{boolean } \text{FileWriteReal} \left ( \text{<file number>}, \text{<real value>} \right )$$

• $$\text{boolean } \text{FileWriteReal} \left ( \text{<file number>}, \text{<real value>}, \text{<size/endian>} \right )$$

The $$\text{<file number>}$$ parameter is an integer value returned by the $$\text{FileOpenWrite}$$ or $$\text{FileOpenWriteTruncate}$$ functions. The $$\text{<real value>}$$ parameter holds the real value to be written. The $$\text{<size/endian>}$$ parameter can be used to specify how the real value should be written.

If the $$\text{<size/endian>}$$ parameter is excluded or if the $$\text{size/endian}$$ parameter is zero, the function will write the real value as a decimal string using either a fixed point notation such as -123.4 or in scientific notation such as -1.234E2.

If the $$\text{<size/endian>}$$ parameter is +4 or +8, the real value will be written in single precision or double precision little-endian floating point format conforming with IEEE 754-2008.

If the $$\text{<size/endian>}$$ parameter is -4 or -8, the real value will be written in single precision or double precision big-endian floating point format conforming with IEEE 754-2008.

The $$\text{FileWriteReal}$$ function returns true on success or false on failure.

The Figure 135 shows how you can use the $$\text{FileWriteReal}$$ function.