== Can I use double precision floating point math with OpenECU? == <> == Overview == Normally, OpenECU does not allow the use of double-precision floating point values. OpenECU tries to restrict floating point numbers to 32-bit single floating points. During the build process, most signals of type '''double''' will be automatically converted to type '''single'''. However, some built-in Simulink math blocks will not be automatically converted and this may result in your code running much slower than it would with single precision calculations. These functions can be converted to single-precision versions using the custom code tab in the Simulation Configuration dialog. The following figure shows how to do this. {{attachment:custom_code.jpg}} == Note to Embedded Coder users == Embedded coder users must have Data Type Replacement turned on in order to automatically substitute 32-bit floats in place of double floats. The image below shows how Data Type Replacement must be configured for automatic floating point substitution. '''Note:''' When your model is configured for Embedded Coder using the OpenECU setup scripts (or by double clicking the [[doc_user/openecu_user_guide_simulink_chunk/prtw_config_using_ert.html|prtw_ConfigUsingRtwEc]] block), then Data Type Replacement is automatically enabled. {{attachment:DataTypeReplacement.jpg}} == Further information == In most cases, 32-bit floating point numbers are sufficient. If 64-bit floating point math is absolutely required, please [[OpenECU Support Contact|contact Pi Innovo]] for more information.