help about a math operation ( division )

0 favourites
  • 2 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • Hello my friends . i have a question about a math operation . how to make a division operation look like this for example ? number/other number = 1/3 and not a long number like that : 0.33333333333333333 in construct 2 and thank you in advanced

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Two ideas come to mind.

    One is to think back to grade school and just use two numbers, the numerator and denominator, for each number. Then you’d never actually do a divide, just multiply the denominator.

    You’ll probably need to simplify the fractions, before displaying them. But algorithms for that are easily found. It’s GCD (greatest common denominator) as I recall.

    The other idea is to find an algorithm to find the closest matching fraction to a decimal number. I used one before.

    Google is your friend here. Both ideas would be the same in most programming languages.

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