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 / DWord Maths issue

Author
Message
RiiDii
20
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 19th Feb 2009 02:49
I have upgraded to 1.072
I checked the bug boards too
Here is another math issue

a as DWord
b as DWord
c as DWord
a=Rgb(255,255,255)
b=5 (or pick a number)
c=a/b
I get c=0




Open MMORPG: It's your game!
James H
18
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 19th Feb 2009 04:44 Edited at: 19th Feb 2009 04:45
This is weird, same results here but when I replaced "rgb(255,255,255)" with just "5", the resolution matches my desktop, if I don`t it runs at 640*480. Using standard ide and synergy(not DGS version) with same update version - windowed fullscreen is selected, yet both the window and fullscreen options are set to 640*480. Anyone else get the same?
If I change "rgb(255,255,255)" with r or g values of 254 I get a number thats the same value as the variable "A" except the last digits are different.R value 254=changes last 5 digits, G value 254=changes last 3 digits. B value of 254 returns a result of 0.
RiiDii
20
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 21st Feb 2009 17:57 Edited at: 21st Feb 2009 17:59
James H, that is very weird.

For those not sure what the issue is. The resolution changes based on the value of variable 'a' - either RGB(255,255,255) or 5.

Run this first with attention to the resolution:



Then run this with attention to the resolution:



If you add this line in, the resolution doesn't change.

Print Screen Width()


Open MMORPG: It's your game!
calcyman
17
Years of Service
User Offline
Joined: 31st Aug 2007
Location: The Uncertainty Principle
Posted: 22nd Feb 2009 19:52
No, the resolution does not change based on the contents of a - it changes because of the RGB() function. By setting a to the value of 4294967295 (2^32-1), it behaves the same as setting it to 5.

Personally this appears obvious - the RGB() command uses the bit depth of the screen, which is directly related to the screen resolution.

Compare these, which have different resolutions, despite maintaining the same value in a.





The optimist's right, The pessimist's right.
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 28th Feb 2009 00:12
There is a bug here, but it's not RGB. The resolution change is simply happening because DirectX is being initialised. Without that then DBPro sticks with the standard windows GDI.

Here's code showing the issue:


What I've discovered is happening is that 'a' contains the equivalent of the signed integer value -1. -1/5 in integer maths is zero.

If you look at the .dbm file generated for this code, you'll see the assembly instruction 'IDIV' - integer division.

YarSnez
22
Years of Service
User Offline
Joined: 9th Apr 2003
Location:
Posted: 27th Mar 2009 11:53
DB DWORDS seem to have the curious range 0 to 2,147,483,647
instead of 0 to 4,294,967,295 ?

I have very simple tastes, I am always satisfied with the very best.

Oscar Wilde.
n008
18
Years of Service
User Offline
Joined: 18th Apr 2007
Location: Chernarus
Posted: 27th Mar 2009 16:24 Edited at: 27th Mar 2009 16:25
Weird.

"I have faith, that I shall win the race, even though I have no legs, and am tied to a tree." ~Mark75

Login to post a reply

Server time is: 2025-06-04 18:38:06
Your offset time is: 2025-06-04 18:38:06