I am running into a problem. I was trying to assign the value 128 * 16777216 to a C# long data type. I always got overflow error. I checked the range of the long data type, the overflow shouldn't occur in my case. Anyone has any suggestion?
Thanks for the quick response. Actually I tried this and it works! But why should I do this? Isn't it supposed to implicitly convert to long data type?
When you write long lv = 128 * 16777216 ; the evaluation is made from right to left, that means first multiply 128 by 16777216 as integer numbers and the result is assigned (and converted) to a long. But the result cannot be calculated due to overflow.
-obislavu-
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.