cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
double to float conversion error
double to float conversion error
Feb 7, 2014 at 9:33pm UTC
praneshiitm
(83)
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 UTC
Vlad Licker
(6)
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.