C++ question
-
// This program is a test to verify whether or not the theory illustrated // in Digital Fundamentals pg60 of 32 bit binary number recognition, is // applicable with regards to an AMD 1.4 Ghz processor. #include #include #include using namespace std; int mantissa; int max_integer=0; int temp=0; int main() { mantissa = 30; while(mantissa!= -1) { temp = pow(2,mantissa); max_integer = max_integer + temp; --mantissa; } cout<
-
// This program is a test to verify whether or not the theory illustrated // in Digital Fundamentals pg60 of 32 bit binary number recognition, is // applicable with regards to an AMD 1.4 Ghz processor. #include #include #include using namespace std; int mantissa; int max_integer=0; int temp=0; int main() { mantissa = 30; while(mantissa!= -1) { temp = pow(2,mantissa); max_integer = max_integer + temp; --mantissa; } cout<
// So if the maximum integer possible on this machine uses 31 bits, and this is a 32 bit // processor, what is the other bit used for? For the sign. Compare this with
unsigned int
s, which, as they do not store any sign, can be twice as large (plus one) as the maximumint
. PS: I don't really understand the code, though, looks interesting, will have a look at it. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo