Get the value of Pi?

For questions about using Classic.

Post » Fri Nov 05, 2010 6:52 am

Is there a way to use Pi in a formula? There doesn't seem to be anything under System/Math and entering wacky python things like math.pi doesn't work either. I'm looking for as precise a value as possible since typing 3.14etc causes misalignments fast.
B
3
S
1
G
4
Posts: 42
Reputation: 1,609

Post » Fri Nov 05, 2010 8:31 am

You can initialize a script which contains the following at the start of the layout:
import math

And then you can use Python("math.pi") to retrieve the value of pi. It also works in equations like Python("math.pi") /2 so it should work for whatever you want it to.

Since pi value is constant, it would be easier to just define a global variable, call it pi and set its value to 3.1415926535897931, Python's pi value.

Why not go a step further:
3.1415926535897932384626433832795028841971693993751058...... :P

Or you could remember it up to three or four decimals (3.1416) and reuse that, which should suffice for many calculations.

Hope that helps!
B
2
S
2
G
3
Posts: 143
Reputation: 1,536


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 8 guests