0

I just try to calculate this on my microcontroller programm:

uint16_t aOffset = 0;
uint16_t bOffset = 0;
uint16_t a = 530;
uint16_t b = 530;
int16_t aReal = a - aOffset;
int16_t bReal = b - bOffset;
int32_t c = (int32_t) aReal * bReal;

printf("%d, %d, %d\n", aReal, bReal, c);

And the output is:

530, 530, 18756

But the output should be:

530, 530, 280900

What's wrong here?

stonar96
  • 1,359
  • 2
  • 11
  • 39

0 Answers0