Hi,
triggered by a recent discussion (e2e.ti.com/.../713771), I wonder why there is no F32TOI32R instruction (and an intrinsic long __f32toi32r(double src))?
This would remove the nonlinearity around zero that the F32TOI32 instruction has: both positive and negative floats are rounded (truncated) towards zero.
Something like float f; long l; l = (int32_t)(f >= 0.0 ? f + 0.5 : f - 0.5) does it, and there is the F32TOI16R instruction that does it, but for 16 bit values only.
An idea for a next release?
See SPRU514P, Table 7-7. C/C++ Compiler Intrinsics for FPU.
Regards,
Frank