Pi - hpgDesigns/hpgdesigns-dev.io GitHub Wiki

PI is the mathematical constant, commonly denoted π, which expresses the ratio of the circumference of a circle to its diameter (or twice the radius). It is useful in trigonometric calculations and functions (like sine), and an intrinsic part of vector-coordinate conversion (such as lengthdir_x, lengthdir_y, and point_direction), as well as degree-radian conversion. PI is an irrational number, so most applications will settle for an accurate estimate.

The constants pi and M_PI are both defined in EDL, so you can use them in your code. Game Maker only defines pi.

  • In GM, pi = 3.141592653589793280 (Accurate to 15 places, precise to 16)
  • In ENIGMA, pi = M_PI = 3.1415926535897931159979634685441851615905761718750000000000000000 (Accurate to 15 places and precise to 48. This is the most accurate and precise representation of PI that a double can hold)
  • In Math, pi = 3.14159265358979323846... (Accurate and precise to 20 places. Attempting to use or memorize any more than 20 places is quite difficult.)

Tau

Tau (or τ) is commonly suggested as an alternative to pi, defined as 2 pi (the ratio of the circumference of a circle to its radius), as it is more common to use the radius of a circle in trigonometry rather than its diameter. Despite this, most applications do not define this as a constant (including GM and EDL)