Main Content

Construct half-precision numeric object

Use the `half`

constructor to assign a half-precision data type
to a number or variable. A half-precision data type occupies 16 bits of memory, but its
floating-point representation enables it to handle wider dynamic ranges than integer or
fixed-point data types of the same size. For more information, see Floating-Point Numbers (Fixed-Point Designer) and
What is Half Precision? (Fixed-Point Designer).

For a list of functions that support code generation with half-precision inputs, see Half Precision Code Generation Support.

These functions are supported for simulation with half-precision inputs in MATLAB^{®}. For a list of functions that support code generation with half-precision
inputs, see Half Precision Code Generation Support (Fixed-Point Designer).

To display a list of supported functions, at the MATLAB Command Window, enter:

methods(half(1))

Arithmetic operations which combine half-precision and logical types are not supported.

For additional usage notes and limitations, see Half Precision Code Generation Support.

- Half Precision Code Generation Support
- Floating-Point Numbers (Fixed-Point Designer)
- What is Half Precision? (Fixed-Point Designer)
- Generate Code for Sobel Edge Detection That Uses Half-Precision Data Type