Problem with a division of a value bigger than 127

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Problem with a division of a value bigger than 127

1,505 Views
dvw
Contributor I
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!
 
 
 
 
 
Labels (1)
0 Kudos
Reply
1 Reply

678 Views
CrasyCat
Specialist III
Hello
 
- Which CPU are you targeting (HC08, HC12, Coldfire, ..)
- Which version of CodeWarrior are you using?
To retrieve that info:
- Start CodeWarrior
- Select Help -> About Freescale CodeWarrior
- Click on "Install Products"
- CodeWarrior version used is displayed on top in the Installed Products dialog.
 
CrasyCat
0 Kudos
Reply