Math constants

Math constants

Math constants

Function

Math provides commonly used mathematical constants, which can be read in attribute form.

Syntax

Parameters

ParametersTypeRequiredDefault valueDescription
None-NoNoneConstant properties require no parameters.

Return value

TypeDescription
Int/FloatReturns the corresponding mathematical constant.

Constant list

ConstantDescription
Math.EThe natural constant e.
Math.LN2The natural logarithm of 2.
Math.LN10The natural logarithm of 10.
Math.LOG2EThe base 2 logarithm of e.
Math.LOG10EBase 10 logarithm of e.
Math.PIPi.
Math.SQRT1_2The reciprocal of the square root of 2.
Math.SQRT2The square root of 2.
Math.TAU2 times pi.

Example

Notes

  • Math constants are read-only static properties and do not require calling math() to create objects.