Variable not posting/storing properly.

Bugs will be moved here once resolved.

Post » Thu Mar 26, 2015 2:10 pm

Problem Description
A INT variable with the value of 11111... that is 16 digits in length or higher does not post properly with a string attached.
A INT variable with the value of 11111... that is larger than 16 digits doesn't store properly.

Attach a Capx
https://dl.dropboxusercontent.com/u/729 ... ength.capx

Description of Capx
Contains 4 variables of the value 1111... repeating in differing lengths 15,16,17 and 18.
Contains 4 groups with two types of displays a straight Set Text to Variable and a Set Text to a String+Variable that update every tick.



Steps to Reproduce Bug
  • Create an INT variable with a value of 1111....repeating in any length greater than or equal to 16.
  • Create a Text Object
  • Set the text, using any type of event, to "String"&variable

Observed Result
____ The variable flop16 posts as 1111111111111111.1
____ The variable flop17 stores as 11111111111111110
____ The variable flop18 stores as 111111111111111100

Expected Result
____ The variable be posted as it is stored, and be able to store a repeating 1111.... past 17 digits in length ____

Affected Browsers
  • Chrome: (YES)
  • FireFox: (YES)
  • Internet Explorer: (YES)

Operating System and Service Pack
____ Windows 8 ____

Construct 2 Version ID
____ r200 Construct 2 Built at 14:47:58 on Mar 16 2015____
Image
B
33
S
16
G
2
Posts: 185
Reputation: 4,036

Post » Thu Mar 26, 2015 5:22 pm

It's one of those number precision things with computers. There is a limit to the number of digits of a number can be stored. JavaScript uses 64-bit floating point numbers to store numbers and according to this:
http://en.wikipedia.org/wiki/Double-pre ... int_format
It can store 15-17 significant digits, which is on par from what you found.
B
83
S
27
G
69
Posts: 4,905
Reputation: 48,977

Post » Mon Mar 30, 2015 1:53 pm

Closing as not a bug, you've just discovered the double floating point precision limit.
Scirra Founder
B
366
S
217
G
82
Posts: 23,243
Reputation: 183,484


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 1 guest