I am using a PLC that uses a STM32F4 as its processor. The PLC software has Integer and Float calculation commands. When I work with floating point numbers I usually try to use integer calculations and the result is divided by 1000 to get the final result. I think this method saves program execution time and will be able to get a faster cycle time in the PLC program.
Ex: If I want to multiply a value (x) by constant (1.234567),
- Multiply x by 1234567
- divide the result by 1000000
- get final result
But, STM32F4 has a hardware floating point unit (FPU). So, I wonder if the above method actually makes the program faster.
will my integer calculation method actually save program execution time, compared to the floating point calculation method?