Matlab/Simulink Coder: What type is real_T under the hood?
Simulink Coder uses the real_T
type to represent real numbers in generated C/C++ code.
By using a custom main()
function, we can see the underlying type of real_T
in the generated code:
int_T main(int_T argc, const char *argv[])
{
printf("%d", sizeof(real_T));
}
This prints 8
, hence real_T
is a double-precision floating-point type, equivalent to double
in C/C++.
There is some possibility that you can change this to either float
or some integer type, but the most common and default type is double
.
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow