Single-Precision Design for MATLAB Code

Convert double-precision MATLAB code to single-precision MATLAB code

Because single precision numbers use only 32 bits, they require less memory than double-precision numbers while still offering many of the benefits of floating point arithmetic. You can convert your double-precision MATLAB code to single-precision using the convertToSingle function at the command line.


expand all

convertToSingleConvert double-precision MATLAB code to single-precision MATLAB code
coder.configCreate configuration object for fixed-point or single-precision conversion
CustomFloatNumeric object with a custom floating-point data type
halfConstruct half-precision numeric object
pow10Base 10 power and scale half-precision numbers
rsqrtReciprocal square root
fmaMultiply and add using fused multiply add approach


coder.SingleConfigDouble-precision to single-precision conversion configuration object


Generate Single-Precision MATLAB Code

Generate single-precision MATLAB® code from double-precision MATLAB code.

MATLAB Language Features Supported for Single-Precision Conversion

For single-precision conversion, use supported MATLAB language features.

Single-Precision Conversion Best Practices

Generate single-precision MATLAB code or single-precision C/C++ code according to best practices.