Python 3.6+mathterm
math.tau
constants
The mathematical constant τ = 2π ≈ 6.283185307179586. Convenient in formulas where 2π keeps coming up.
Syntax
math.tau
Added in Python 3.6, so code that must run on older interpreters still writes 2 * math.pi. The equality math.tau == 2 * math.pi is exact rather than accidental: doubling a float loses no bits, so both constants round to the same double. The payoff is readability — tau/8 reads as one eighth of a full turn — not extra precision.
Examples
import math
print(math.tau) # → 6.283185307179586
print(math.tau == 2 * math.pi) # → True
print(math.tau / 4) # → 1.5707... (π/2)
print(math.sin(math.tau)) # → ? (значение зависит от системной libm — карточка учит наличию погрешности, а не её цифрам)
print(math.cos(math.tau)) # → 1.0
print(math.tau * 5) # → 31.41592653589793
See also
Open in the full glossarydocs.python.orgReport an inaccuracy