Jump to content

Dividing Gives Wrong Result.


Recommended Posts

Bug description:

 

Dividing a member of an array of signed long's gives wrong result.

 

Steps to reproduce:

 

  unsigned char i;

 signed long array[3];

 i = 2;

 array[i] = 107643;
 array[i] /= 377;

 

Expected behaviour:

After running this code array[2] should have the value 285

but instead it has the value 486646907.

 

Is the problem 100% reproduceable:

 

Yes, this problem happens every time.

 

IDE version: 6.40

Compiler: BoostC

Compiler version: 6.40

Target device: PIC18F4620

OS: Windows XP

 

Comments:

This is a very annoying bug!

 

 

Regards, Teuniz

 

(edit: typing error)

Edited by teunizz
Link to post
Share on other sites
  • 2 months later...

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...