Nios II Custom Instruction User Guide

ID 683242
Date 4/27/2020
Public
Document Table of Contents

6.7.2. -fsingle-precision-constant

From the GCC documentation:
“Treat floating-point constants as single-precision constants instead of implicitly converting them to double-precision constants.”

For FPH2, the Nios II SBT omits -fsingle-precision-constant from the makefile GCC command line by default. This behavior contrasts with SBT support for FPH1, which sets this option with -mcustom-fpu-cfg. The SBT does not use -fsingle-precision-constant for FPH2 because it can cause problems for double-precision code.

You can enable -fsingle-precision-constant if you are sure it will not cause problems for your code. In general, it is better to cast floating point constants to the float type, or use the 'f' suffix (for example 3.14f), because these approaches are localized and independent of compiler options.