double to float conversion error

Feb 7, 2014 at 9:33pm
 
float w = 0.80;


this gives an error: warning C4305: 'initializing' : truncation from 'double' to 'float'.
please tell me about this.
Feb 7, 2014 at 9:43pm
That's not an error, that's a warning. Warnings don't stop compilation. In order for the literal value to be of type float you need to append a "f" at the end of it.

float w = 0.80f;
Topic archived. No new replies allowed.