Forum Discussion
Altera_Forum
Honored Contributor
15 years agoNIOS2 HW & DIV Instructions + FPU
Hello i am in charge of designing a system that does a lot of complex sin/cos/* instructions and i need them to be fast. I am using NIOS2-F at 100mhz in a Cyclone IV. I've enabled HW and DIV ...
Altera_Forum
Honored Contributor
15 years agoOne other heads up, when you add the FPU floating point constants are treated as single precision. The 'normal' behavior is to have floating point constants treated as type double. So if you have constants in your code and you want to keep them represented as constants use the 'l' suffix which will ensure the constant is treated as a long double (Nios II doesn't support long doubles so this will become a double).
So instead of this: double a = 2.3; // with the FPU enabled you'll end up with a single precision 2.3 type cast over to a double precision 2.3 (truncation could happen if the constant was very large) Do this: double a = 2.3l; // no type casting will occur