If writing 'foo'.startsWith('foo') instead of 'foo'.indexOf('foo')==0 worth extending String's prototype (which IS a big deal), another math constant is worth it (since it is actually useful, see Rick's googling results).
If _javascript_ was a language with tiny api, yes, your argument will hold. But currently includes anything more or less useful for programmer's convenience, and since Math utils becoming more important (people start to write complex math in it which was impossible a few years ago due to performance... is webgl in use already?), adding tau is well worth it.
> Remembering that PI*2 is TAO is required to even make use of it, unless/until mathematicians, books, and wikipedia start using TAO where 2 PI is currently used, you have to convert them.
Nope. It is the length of the unit circle, end of story. I don't need to remember what is it to start writing `if (x >= Math.TAU) x -= Math.TAU` for boundary check for example.
Also... it TAU, not TAO. If you don't know what it is and use 2*PI all over the place, of course it won't be useful for you. But it doesn't mean that it's silly.
01.07.2014, 04:26, "Frankie Bagnardi" <f.bagna...@gmail.com>:
String.prototype.endsWith and Object.is are functions, and their JS implementations are nontrivial to memorize and type (although not the worst examples). Memorizing PI to more than a few digits is nontrivial. Same with Math.E, or Math.atan2, or most of the other Math functions and properties.Remembering that PI*2 is TAO is required to even make use of it, unless/until mathematicians, books, and wikipedia start using TAO where 2 PI is currently used, you have to convert them. So if you decide to used it, you already know the definition. The alternative to other things in _javascript_ (for the most part) spending time researching how to implement it, comparing existing implementations, or having to look up a constant value (e.g. 3.141592653589793).Seems a little silly, and I'd rather see some of the use cases for it end up on Math if anything.On Mon, Jun 30, 2014 at 4:55 PM, Alex Kocharin <a...@kocharin.ru> wrote:30.06.2014, 21:09, "C. Scott Ananian" <ecmascr...@cscott.net>:On Mon, Jun 30, 2014 at 1:01 PM, Rick Waldron <waldron.r...@gmail.com> wrote:Just because other languages don't include a TAU constant doesn't mean ECMAScript cannot.Just because "serious mathematicians" think this is "crackpot territory", doesn't mean it's not useful (the condescension of that claim certainly isn't).As I mentioned, although I am a pi-ist, I think Math.TAU is harmless. But I will qualify the "not useful" part -- there is no numerical accuracy benefit to using Math.TAU (only the floating point exponent changes), nor is there likely to be any emitted-code improvement (constant propagation being a standard part of any reasonable runtime). So the benefit is solely the single character minimized code size improvement from '2*Math.PI' to 'Math.TAU' (if this were significant wouldn't the minimizers be assigning this to a single-character variable already?)It's not about code size or numerical accuracy. When developing HTML5 games where a lot of trigonometric calculus takes place, I'm used to see 2*Math.PI more often than Math.PI by itself. People usually treat it as one single constant (which is prone to errors if someone writes 1/2*Math.PI instead of 1/(2*Math.PI)). It's just better to replace it with one constant than having this multiplication appear everywhere.So I'd like to see this make its way to the standard... it's certainly more useful than, say, String.prototype.endsWith or Object.is :)// alex
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss