Bug? Global declarations with assigned computations

Previous topic - Next topic

Moru

Not to make anyone cry again but...

Why is it I can't assign a value to a global and at the same time compute a new value, like this:

Code (glbasic) Select
GLOBAL x = y / zIf I look into variable x now with debug I get the answer -1.#IND

if I do this it works as expected:

Code (glbasic) Select
GLOBAL x
x =  y / z
I saw you Gernot use the first line in your examples so I started doing this myself and at the last update my game broke down :-)


(And no, this is not the actual program, just the simplest recreation of the problem, you know who you are :-)

Do we get a bug-report forum? And can we start posting bugs in separate threds so they are easier to keep track of? Not bake them into the announcement thread of an old version? (Never wanted to be a forum moderator but I'm used to nicely moderated forums :-)

BumbleBee

A bug report forum!?  I'm for it. Anyone else? :D

Cheers
The day will come...

CPU Intel(R) Core(TM) i5-3570k, 3.4GHz, AMD Radeon 7800 , 8 GB RAM, Windows 10 Home 64Bit

Kitty Hello


Moru

z was not zero, the only thing I had to do to fix it was to move down the "= y / z" on the line below, put an x in front and then it worked.

Kitty Hello

strange. Can you provide a complete mini-sample?

Moru

Mini example
but after updating to IDE version 5.040 it seems to be working fine, thanks!

Code (glbasic) Select
// IDE Version: 5.037

GLOBAL sx,sy,width
GETSCREENSIZE sx, sy
width = 40

// This gets the wrong result
GLOBAL y1 = sx / width
DEBUG " y1=" + y1 + " sx=" + sx + " width=" + width + "\n"

// If I do the same but split the line I get the correct result
GLOBAL y2
y2 = sx / width
DEBUG " y2=" + y2 + " sx=" + sx + " width=" + width + "\n"

Kitty Hello

Right. The GLOBAL was wrong internally. Oh dear, this was such a bed error. It left out the whole line and led to great confusions...