MATLAB 中的浮点设定
创建和使用浮点数据类型,如单精度和半精度
由于单精度数只使用 32 位,因此它们所需的内存少于双精度数,但仍具有浮点算术的许多优点。半精度数据类型仅占用 16 位内存,但其浮点表示使其能够处理比相同大小的整数或定点数据类型更宽的动态范围。您可以使用 CustomFloat
对象定义具有指定字长和尾数长度的浮点数值数据类型。
类
Simulink.NumericType | 指定浮点数、整数或定点数据类型 |
target.FloatingPointDataType | Describe floating point data type implemented by compiler for target hardware (自 R2021b 起) |
函数
命名空间
target | 管理目标硬件和构建工具信息 |
主题
- Floating-Point Numbers
Representation and manipulation of floating-point numbers.
- What is Half Precision?
Introduction to the half-precision data type in MATLAB® and Simulink®.
- Half Precision Code Generation Support
C/C++ and GPU code generation support for functions that support half-precision inputs.
- Generate Native Half-Precision C Code Using MATLAB Coder
Generate C code for embedded hardware targets that natively supports half precision floating-point data types.