dravisher

Possible to suppress the "double precision const is represented as single-precision" warning?

Discussion created by dravisher on Nov 12, 2010
Latest reply on Nov 17, 2010 by nou
Or else a good way to avoid it?

Hello. I'm writing a program which I want to be able to switch easily between 32-bit and 64-bit floating point (i.e. float and double), and I'm finding it a bit annoying having my build-log flooded with these warnings:

double-precision constant is represented as single-precision constant because double is not enabled

This warning appears even if I use an explicit cast. So all the below produce the same warning:

float a = 0.1;

float a = (float)(0.1);

float a = as_float(0.1);

Basically, is there some way to avoid the warning, either by disabling it or by doing the casts in some way I havent thought of? It's not a major problem, but it's annoying to get all these non-interesting warnings whenever I'm compiling without double precision support enabled.

Outcomes