Seltsames Problem mit float
-
Hallo, folgendes Programm compiliere ich mit gcc
int main() { float f = 1e32; for(unsigned int j = 0; j != 3; ++j) for(unsigned int i = 0; i != 2147483648U; ++i) f+=1.0f; std::cout<<f; std::cin.get(); }
Die Ausgabe ist "1 e32". Dabei sollte doch 1,3 e32 herauskommen (1 e32 + (3 * 1 e31) ??????
-
http://de.wikipedia.org/wiki/Gleitkommazahl#Grundlagen
dort steht, wieso das so ist