Open jhirth opened 8 years ago
I tried to propose this a few years ago, but it was rejected :(
FWIW, I agree with you and the rationale
Well, Python got it now. Maybe that would convince some people.
Anyhow, I kinda agree that it's somewhat gimmicky, but on the other hand I always think it's silly that I have to define it myself. It's the math constant I use most frequently.
I made nearly the same argument. The "Python has it" point might be compelling
you could always const {PI, TAU=2*PI} = Math;
in the files that need it, but I don't find it useful to add it in Math
+1 for Tau. I'll call it that from now on instead of TWO_PI
;)
+1 link for TAU
Tau replaces Pi - Numberphile: https://www.youtube.com/watch?v=83ofi_L6eAo
The last time Math.TAU was rejected because
"one letter shorter, not well known, not well taught. PI is known, taught and ubiquitous."
(See meeting notes https://esdiscuss.org/notes/2014-07-31)
I don't see how any of this has changed. And as Brendan wrote:
Don't rehash. New insights (they had better be new and good) in new thread.
(See https://mail.mozilla.org/pipermail/es-discuss/2014-August/038635.html)
And as there are no new and good insight, I doubt, that this will be accepted.
Let us focus on more important additions to the Math object.
FWIW, CSS has an angular unit turn
that effectively is τ and the CSS folks are reluctant to add any other way to use π. https://github.com/w3c/csswg-drafts/issues/309
This means, you should reconsider whether rad↔deg is really all that should be added, and whether the conversion functions make sense as proposed when considering more than two angular units.
Math.RAD_PER_TURN
would be 2*Math.PI
, i. e. τ.
With a TAU constant, defined as 2 PI, a lot of the PI-related math becomes simpler. Furthermore, existing APIs, which use radians, such as
CanvasRenderingContext2D.arc()
, become easier to use because you can now express things in terms of turns. E.g. half a turn (TAU 0.5) is half a circle.Canvas example (JSFiddle):
As one would expect, the result is half a circle going from 12 o'clock to 6 o'clock.
http://tauday.com/tau-manifesto https://en.wikipedia.org/wiki/Turn_(geometry)#Tau_proposal
Processing: https://processing.org/reference/TAU.html Python recently added TAU: https://docs.python.org/3.6/library/math.html#math.tau
tl;dr: Vi Hart - Pi Is (still) Wrong. https://www.youtube.com/watch?v=jG7vhMMXagQ