메인 콘텐츠로 건너뛰기
Knowledgebase
Home
Renesas Korea

Why I got an incorrect result by multiplying 32 bit by 32bit (long*long)

Latest Updated:09/10/2007

Question:

I got an incorrect result by multiplication 32 bit * 32bit (long*long). Why?

Answer:

To handle the operation target value in long type, use a character of "L".

[For example]  

a = 0x000010ffL * 0x0000fff0L;
a = 0x000010ffL * 0x00001210L;

Or you can also cast the target using "long".

a = (long)0x000010ff * 0x0000fff0;
a = (long)0x000010ff * 0x00001210;

Suitable Products
C/C++ Compiler Package for SuperH Family
C/C++ Compiler Package for H8SX, H8S, H8 Family
  • 이 기사가 도움이 되셨나요?