-
I came across a rounding error in the iPad Pro 11" mode (with ratio 199:139).
If an object is at the Y position Height/2
And I try the if statement
{ if Obj.pos.y = height/2 }
It turns out they are not equalThis is because:
The height/2 = 18.65625
The obj.pos.y = 18.6563So it seems that the position of objects are rounded to the 4th digit.
Is there anyway that you guys could make the precision better?
Thank you! -
iPad Model: iPad Pro 10.5" 2nd Generation
iOS version: 12.1
hyperPad Version: 1.22
Description: Object's positions are rounded to the 4th digit automatically instead of saving exact position
Steps to reproduce:
0- Set aspect ratio to 199:139 (iPad Pro) in the editor
1- Set an object's y position to height/2
2- Create an if statement that says { if object.pos.y = height/2 }
Additional info:
One workaround is to round both values to the 4th digit and then do the if statement comparing the rounded values. However, since I have many if statements, making the app compatible for 199:139 devices will be tricky. -
@davio said in Rounding Error for Object Positions on iPad Pro 11":
1- Set an object's y position to height/2
@Davio you really shouldn't be doing this because there will always be floating point rounding errors like this.
If you really need to check positions like that, I suggest checking for a range of values eg. If y > height / 2 + 2 and If y < height / 2 - 2.