float to double conversion in sqrtf
Asked by
benjamin
Hello,
while I was trying to optimize my code for a Cortex-M4 MCU to use only float variables to take advantage of the FPU, I noticed that still float to/from double conversion and double operations functions were still used. So I investigated a little bit with objdump and I found that sqrtf was calling __aeabi_f2d somewhere in it's code.
Is there a reason to use doubles inside a function that takes and returns a float? If it's not necessary, it's time and space consuming. And why not using the VSQRT.F32 instruction on Cortex-M4 to calculate the square root? In my program, the FPU is used for all the common operations (add, multiply, etc) except for the square root so I had to implement a C/ASM function to do it with the FPU.
Question information
- Language:
- English Edit question
- Status:
- Solved
- Assignee:
- No assignee Edit question
- Solved by:
- Joey Ye
- Solved:
- Last query:
- Last reply:
To post a message you must log in.