Debugger Making No Sense?

I am using a Constructor and when I look up the stack trace at the previous method, it shows that I am clearly passing in .5, .5 as the parameters. so it’s like ‘MYPOINT = new Point(.5, .5)’ but the debugger shows the x, y parameters as having the value of 0? The parameters do have the same name as the properties of the class x, y apart from the properties of the class have capitalized names.

Is this a bug in Xojo or is there something I am doing wrong here?

Thanks

Whats the code in your constructor for “Point” look like ?
properties & params with the same name will be confusing

[quote=212313:@Norman Palardy]Whats the code in your constructor for “Point” look like ?
properties & params with the same name will be confusing[/quote]
Sub Constructor(x As integer, y As integer)
me.X = x
me.Y = y
End Sub

Changed the name from x and y to xx and y. Still does not work though. Thanks

Integer rounds down… Use double

That makes sense now. Thanks

Integer TRUNCATES
Try this

[code] dim i as integer
dim d as double

d = -.75

i = d[/code]

if integers rounded then i should be -1
They dont - they simply truncate the value to be an integer effectively dropping everything after the decimal
Its a significant difference

Passing a floating point value (.5) using an integer declared param will give you subtle bugs like this

Not at my computer so: Is there a compiler warning for this?

Project > Analysis Warnings…

check on
“Converting from Item1 to Item2 causes a possible loss of precision, which can lead to unexpected results”

Thanks Will.