IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /docs/manual/basics.md). For the complete Mojo documentation index, see llms.txt.
Skip to main content
Version: 1.0
For the complete Mojo documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /docs/manual/basics.md).

constants

Defines math utilities.

You can import these APIs from the math package. For example:

from std.math import pi

comptime values

e

comptime e = 2.7182818284590451

The euler constant e = 2.718281...

log2e

comptime log2e = 1.4426950408889634

The value of log2(e), where e is Euler's constant.

pi

comptime pi = 3.1415926535897931

The mathematical constant π = 3.141592...

tau

comptime tau = 6.2831853071795862

The mathematical constant τ = 6.283185.... Tau is a circumference of a circle (2π).