I find some strange behavior when I try to calculate the equation with
the casting of long interger.  By using the casting to long integer in
the calculation, sometime it give me the wrong result.  While I am assign
the integer variable to the long variable first and then using that variable
in the calculation give me the correct result.  I try some simple example
and look inside the list file. It seems to be that compiler calling the different
multiplication routine.  I am using the lastest win32 compiler.
Following is the example

void main() {
 int j,a;
 j=5;
 a=((long)j*4059L)/20;
  }

and

void main() {
 int j,a;
 long k;
 j=5;
 k=j;
 a=(k*4059L)/20;
  }

Regards,
Kittiphan Techakittiroj


Reply via email to