Why does 20150813.00
convert to 20150812.000000
and 20150708.000000
convert properly to 20150708.000000
?
Code Sample:
#include <stdio.h>
#include <iostream>
int main()
{
double one_o = 20150813.00;
double two_o = 20150708.00;
float one = (double)one_o;
float two = (double)two_o;
std::cout << std::fixed << "one_o = " << one_o << " one = " << one << std::endl;
std::cout << "two_o = " << two_o << " two = " << two << std::endl;
return 1;
}
Output is --
one_o = 20150813.000000 one = 20150812.000000
two_o = 20150708.000000 two = 20150708.000000
Help me understand double to float type conversion!
Edit:
std::numeric_limits<float>().max()
reports 340282346638528859811704183484516925440.000000
as the maximum to store in a float
, which is far beyond what I'm attempting to store: