Davdi Varga

Problem with a division of a value bigger than 127

Discussion created by Davdi Varga on May 13, 2008
Latest reply on May 14, 2008 by CrasyCat
This is my problem:
 
static int a;
a=127/2;
ok, a=63
 
static int a;
static int b;
a=127;
b=a/2;
ok, a=63
 
static int a;
a=128/2;
ok, a=64
 
static int a;
static int b;
a=128;
b=a/2;
Problem: a=193
 
I've tryied different types like floats, signed and unsigned int, but nothing worked...
Could someone help me to find the problem?
 
Thanks!
 
 
 
 
 

Outcomes