[R126] Angle & Var Never Equal

Bugs will be moved here once resolved.

Post » Sat Apr 20, 2013 8:33 am

Link to .capx file (required!):
https://dl.dropboxusercontent.com/u/11212446/r126_bug_or_mistake.capx

Steps to reproduce:
1. Comparing Angle
2. See CAPX


Observed result:
It may be user error - but it appears to me that Angle is never = to Var even though I've tried this a various ways.

Expected result:

Bounces back between less than and more than but never equal to.

Browsers affected:
Chrome: yes/no Chrome TESTED ONLY 27.0.1453.56 beta-m
Firefox: yes/no
Internet Explorer: yes/no

Operating system & service pack:
Win 7

Construct 2 version:
R126
B
13
S
1
Posts: 17
Reputation: 946

Post » Sat Apr 20, 2013 2:33 pm

Closing as not a bug; by default the & operator slightly rounds numbers for display. If you use str(), e.g. str(Sprite.angle) instead, it shows the full number, which is about 0.999999999998. Computers don't do floating point math to infinite precision since they have a limited amount of memory, so you should not expect floating point numbers to equal exactly. Instead use something like abs(a - b) < 0.001.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 0 guests