title: Curious arithmetic error- 255x256x256x256=18446744073692774400
body: <p>I encountered a strange thing when I was programming under c++.  It's about a simple multiplication.</p>
  
  <p>Code:</p>
  
  <pre><code>unsigned __int64 a1 = 255*256*256*256;
  unsigned __int64 a2= 255 &lt;&lt; 24; // same as the above
  
  cerr()&lt;&lt;"a1 is:"&lt;&lt;a1;
  cerr()&lt;&lt;"a2 is:"&lt;&lt;a2;
  </code></pre>
  
  <p>interestingly the result is:</p>
  
  <pre><code>a1 is: 18446744073692774400 
  a2 is: 18446744073692774400 
  </code></pre>
  
  <p>whereas it should be:(using calculator confirms)</p>
  
  <pre><code>4278190080
  </code></pre>
  
  <p>Can anybody tell me how could it be possible?</p>