So, today I was just having fun with my first progam on my computer class, when suddenly I got a really weird output with it. Here it is:
[user@M110-07 Terminal]$ ./FirstProgram
Press return after entering a number.
Enter the number of pods:
100000000000000
Enter the number of peas in a pod:
If you have 2147483647 pea pods
and 134514000 peas in each pod, then
you have -134514000 peas in all the pods.
According to my professor, we need 47 bits for processing 100000000000000 in C++. Since the CPU is only 32bit, the processor can't process that number with C++. That's why With Maple (or any other math-oriented software) is possible, but not with C++.
I just thought I'd leave here as a reminder.
No comments:
Post a Comment