-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support TAU getting added to the JavaScript standard #1
Comments
anything that makes my code simpler has my vote. long live |
I'm finding myself always having to set Math.TAU as a constant, or to include a constant definition library to achieve something similar. I for one would much rather work out the area of a circle with var area = 0.5 * (Math.TAU * r) * r because that shows incredibly clearly that you are working out the triangular area under a graph of the circumference. To achieve something similar with Math.PI results in either confusing duplication var area = 0.5 * (2 * Math.PI * r) * r or an opaque formula that says little of its origin var area = Math.PI * r * r |
Haha, I found this while searching for an ES Dicuss thread about adding |
did you find any? I saw a discussion about adding it to Dart, but nothing in es-discuss. ps: +1 for the idea of couse |
I didn't, sadly. But there are very few constants in |
In the quickly expanding WebGL using Javascript community 2 * Math.PI is everywhere, and I'd much rather see Math.TAU. Tau is such an integral part of so many equations when dealing with circles, radians, and whatnot. I'm sort of wondering how it hasn't been added into the original standard, it's so easy to implement. |
This was proposed to ES Discuss a few days ago: http://esdiscuss.org/topic/math-tau |
Patch to firefox: https://bugzilla.mozilla.org/show_bug.cgi?id=1032203 |
Awesome! |
Nice! Keep us updated on your progress |
So, I've finally gotten around to tinkering with Meanwhile, I'm not familiar enough with JS yet... is it possible for one to add as Math.TAU before it's actually in the standard? In ruby, for example, I could simply do |
Oh, hey, looks like |
The standard technique is to check it it's not already defined, before adding it.
|
@lindes TAU.js is more of a joke trying to show that the usage of You are quite right and simply defining it in your code via Still glad you found this thread though. |
The usage of TAU is also makes the formulas more consistent throughout. Using diameter for the circumference and then shifting to using the radius for area and volume is a strong indicator that the radius should be used as well in the circumference. C = πd = π·2r = 2πr Due to the radius being consistent now with other formulas like area and volume, we can see if 2π is easily available from those ones too. A = πr² = ½·2πr² V = 4/3·πr³ = 2/3·2πr³ The improvement when using TAU With τ = 2π we have: C = τ·r Integrate τ·r over the radius and we get A = ½·τ·r² Integrate the equation of a circle (x²+y²=r²) over the radius, to get V = ⅔·τ·r³ The math becomes more beautiful, and the clean clear path is easier to follow from one stage to another, when we start with the correct constants and derive the rest by simple integration. There is nothing joke-like about these improvements. They can greatly enhance the understanding of the formulas, and the lessons learned can be applied in the same way across many other math disciplines. |
@pmw57 thanks for the beautiful write up and the much more in depth explanation. I wanted to add that the 'joke' part of my previous message is not about the usage of TAU over PI in math, which I strongly support for reasons you have nicely explained, but rather making it a JavaScript framework. I simply meant that there is no need bringing in a 3rd party library that just defines one constant. 👬 |
👍 |
|
are there more ways to push for this? official channels? |
Not sure but I don't think it's very likely to happen 😞 |
But frankly what's the argument against having Math.TAU in the standard and letting the benighted who like to see lots of unnecessary doubling in their code use |
This issue is dedicated to gather support among developers, that
TAU
gets added to the JavaScript standard asMath.TAU
, so there is no longer the need of a library.Show your support through leaving a comment.
Thank you!
The text was updated successfully, but these errors were encountered: