Hi,
K3 like K1 seem having single precision FPU. But if you wonder about S32 DS, it supports software emulated double precission math.
- library based on doubles.
It isn't based on doubles, it is full featured by default: single precision functions sinf(), cosf(), etc utilizing SP FPU, and double precision functions sin(), cos(), .. using software FP emulation for double precision math.
- I'm wondering how much precision is lost when using the double precision math library on a single precision FPU with the S32K344 (per the S32K3xx datasheet)?
Hm. If vendor would take source code for DP FP math and just replaced all DP objects with SP objects, it would be not only much slower due to extra pointless multiplies and additions, but as well calculation accuracy would be worse than using SP optimized library.
- Or do I have to cast all doubles to floats and loose precision in regard to using the C math library functions? Or does the NXP compiler handle double precision math with additional ARM instructions for the single precision FPU?
Hm, I fear I don't understand these questions.
If you need double precision then just use doubles. If single precision is enough, then just switch Float ABI setting in your project to "FPU SP only". It will make all doubles treated as floats.
