Skip to content

Extended math support

Additional math functions and constants as expressions and conditions.

Authors and contributors to this community extension: Add00, Jurfix.


Expressions:

  • Mathematical constants
  • Greatest common factor/Lowest common multiple
  • Factorial
  • Coordinates conversion for polar and isometric systems
  • ToFixedString: Formats a number into a string with the specified number of decimal places
  • ToFixed: (Deprecated) Formats a number to use the specified number of decimal places

Conditions:

  • IsEven: Check if the number is even (divisible by 2)

Release Notes:

Version 1.0.7

  • Added ToFixedString()
  • Deprecated ToFixed() because it does not show any trailing zeros for whole numbers. Prefer using ToFixedString() to set values in text objects.

Tip

Learn how to install new extensions by following a step-by-step guide.

Conditions

Is even?
Check if the number is even (divisible by 2). To check for odd numbers, invert this condition.

Expressions

Expression Description
ExtendedMath::E() Returns the natural logarithm of e. (Euler's number).
ExtendedMath::Factorial(number) Returns the input multiplied by all the previous whole numbers.
number Any positive integer
ExtendedMath::Fibonacci(number) Returns a term from the Fibonacci sequence.
number The desired term in the sequence
ExtendedMath::Gcf(number, number) Returns the greatest common factor of two numbers.
number Any integer
number Any integer
ExtendedMath::GoldenRatio() Returns the golden ratio.
ExtendedMath::HalfPi() Returns half Pi.
ExtendedMath::Hypot(number, number) Returns the value of the length of the hypotenuse.
number First side of the triangle
number Second side of the triangle
ExtendedMath::IisoToCartesianY(number, number) Converts a isometric coordinate into the Cartesian y value.
number Position on the x axis
number Position on the y axis
ExtendedMath::IsoToCartesianX(number, number) Converts a isometric coordinate into the Cartesian x value.
number Position on the x axis
number Position on the y axis
ExtendedMath::Lcm(number, number) Returns the lowest common multiple of two numbers.
number Any integer
number Any integer
ExtendedMath::Ln10() Returns the natural logarithm of 10.
ExtendedMath::Ln2() Returns the natural logarithm of 2.
ExtendedMath::Log10e() Returns the base 10 logarithm of e. (Euler's number).
ExtendedMath::Log2e() Returns the base 2 logarithm of e. (Euler's number).
ExtendedMath::Map(number, number, number, number, number) Converts a number of one range e.g. 0-1 to another 0-255.
number The value to convert
number The lowest value of the first range
number The highest value of the first range
number The lowest value of the second range
number The highest value of the second range
ExtendedMath::Pi() Returns Pi (π).
ExtendedMath::PolarToCartesianX(number, number) Converts a polar coordinate into the Cartesian x value.
number Radius
number Angle or theta in radians
ExtendedMath::PolarToCartesianY(number, number) Converts a polar coordinate into the Cartesian y value.
number Radius
number Angle or theta in radians
ExtendedMath::QuarterPi() Returns quarter Pi.
ExtendedMath::Slope(number, number, number, number) Calculates the steepness of a line between two points.
number X value of the first point
number Y value of the first point
number X value of the second point
number Y value of the second point
ExtendedMath::Sqrt1_2() Returns square root of 1/2.
ExtendedMath::Sqrt2() Returns square root of 2.
ExtendedMath::ToFixedString(number, number) Formats a number to a string with the specified number of decimal places.
number The value to be rounded
number Number of decimal places

This page is an auto-generated reference page about the Extended math support extension, made by the community of GDevelop, the open-source, cross-platform game engine designed for everyone. Learn more about all GDevelop community-made extensions here.