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

Reply via email to