What am I missing here...?

0 favourites
  • 6 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • I'm trying to work with Pi to produce a series of numbers in a predictable pattern.

    I thought Pi would be perfect, but I'm facing 2 issues. If I ask Construct to display Pi, for some reason it only shows the first 11 numbers, the last of which is seemingly rounded up. Anyway to get it to display more?

    3.1415926536

    instead of

    3.141592653589

    When I ask it to display each number one by one, via a mouse click, it will display the first few, but then start going wrong, and eventually just displaying a whole load of zeros.

    3.14159265358979300000000000000000000000000000000000000000000000000000000000

    I can't exactly figure out what's going on. Was going to post this in the "How do I section" but I feel my code is OK. Not sure what else to do.

    http://bearboxmedia.com/apps/Temp/Pi.capx

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Numbers are stored in 64bit numbers so that gives only about 15 digits. That seems like that’s what you are seeing.

    If you want more digits of pi you’ll need find an algorithm to calculate digits of pi, and a way to do it without the limits of 64bit numbers.

    The simplest solution would be to just store pi to as many digits as you need in a text variable and use the mid function to get digits.

  • I only need 1 digit of pi at a time, which is why I'm already using the mid function to get the number. If I can't get it directly from that, how would I achieve that using a text variable?

  • I was going to link to some of the seeded random plugs but the forums just opening blank pages.

  • You’d get pi from some place like this:

    geom.uiuc.edu/~huberty/math5337/groupe/digits.html

    And copy paste it, or a portion of it into a variable.

  • I understand now. I thought telling Construct which digit of pi to produce would work, but it seems it's for mathematical equations instead.

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