[Solution] warning C4305: ‘initializing’ : truncation from ‘double’ to ‘float’
VC++ Compiler throws warning C4305: ‘initializing’ : truncation from ‘double’ to ‘float’ warning when we try to declare float variable as double.
Remember
float M_PI = 3.1428571428571428 // This is actually double variable
will throw the warning: warning C4305: ‘initializing’ : truncation from ‘double’ to ‘float’
The right way to do declare float varible is
float M_PI = 3.1428571428571428f //Right way to declare float variable
We only added a f at the end of the value.
This is our solution to the above problem :: warning C4305: ‘initializing’ : truncation from ‘double’ to ‘const float’