Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Bug Reports / division error

Author
Message
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 12th Jun 2010 00:46
I've checked my math multiple times, and the final answer I should be getting is 187, however, after the division in the equations below, I'm getting over 4 billion, greater than the original number I divided into. My comments on each line show what should be the answer, except 'a' is not coming out as expected





"Any sufficiently advanced technology is indistinguishable from magic" ~ Arthur C. Clarke
Kevin Picone
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 12th Jun 2010 05:21
Looks like it's using signed division. ANDing A with $ff will remove the top bits. But if you just want to grab A from an ARGB , then shifting is it down by 24 bits a lot less hassle. A= MyColour >> 24

Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 16th Jun 2010 02:05
That's what I ended up doing anyway. So is this considered a bug or just a limitation?


"Any sufficiently advanced technology is indistinguishable from magic" ~ Arthur C. Clarke
Diggsey
17
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 22nd Jun 2010 19:49
IMO, it's a bug since dividing two DWORD values should perform unsigned division, not signed division.

Login to post a reply

Server time is: 2024-04-19 15:41:04
Your offset time is: 2024-04-19 15:41:04