Math.TAU
Frankie Bagnardi
f.bagnardi at gmail.com
Mon Jun 30 17:26:37 PDT 2014
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 <alex at kocharin.ru> wrote:
>
>
> 30.06.2014, 21:09, "C. Scott Ananian" <ecmascript at cscott.net>:
>
> On Mon, Jun 30, 2014 at 1:01 PM, Rick Waldron <waldron.rick at 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 at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140630/c1a20132/attachment.html>
More information about the es-discuss
mailing list