I was wondering if adding Tau (2.0 * PI) to std::f64::consts has been considered. It’s a very common constant and there are already several other constants which are fractions of PI, for example std::f64::consts::FRAC_PI_8.
As a small data point, Python recently added math.tau.
In principle, a math constant with the value 2∙π would be a Good Thing, as it would have one or two more bits of precision. [This is wrong, see below.]
In practice, I’m worried about confusion with the existing consts::FRAC_2_PI and with C’s M_2_PI, which are both 2/π instead. (And FRAC_PI_2 and M_PI_2 are π/2.)
I object on principle to the name tau; the tau campaign is quixotic and should not be encouraged, and τ has several other established uses in mathematics (most prominently the scale factor in a Lorentz transform).
I don't exactly even disagree with the assertion that 2π is in some sense "more fundamental" than π; it's just that we have 3,800 years worth of mathematical writings that use π, making the tau proposal a strong contender for the biggest proposed backward compatibility break in written history, and the benefits are not nearly worth it.
Gotcha! The existing constant with that name is 2 over pi.
I think such a constant would be useful given that there are already similar constants in place.
As for the symbol itself: ‘τ’ is a cute idea, but in practice I have never seen a mathematician or physicist use it in a non-humorous manner … assuming they are even aware of it! The whole “τ vs π debate” seems nothing more than a bikeshedding contest, on par with “spaces vs tabs”.
Unfortunately 2_PI is not a valid identifier because it starts with a number. It would need to be something like PI_MULT_2 or PI_TIMES_2. Can anyone think of a better name for the PI-named variant?