Variable not posting/storing properly.

0 favourites
  • 3 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • 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____

  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Closing as not a bug, you've just discovered the double floating point precision limit.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)