????? ????? ??? on 2012-04-17 15:30:12
I agree it is a very informative article and I actually enjoy reading good stuff unlike all the crap out there on the internet
Brett Zamir on 2011-07-25 07:24:00
@dude: OK!!!! :) (I also applied in Git to some other functions using PI or LN10.)
dude on 2011-06-30 15:34:27
just go with "return 3.141592653589793" BECAUSE IT NEVER CHANGES!!!!
Onno Marsman on 2008-10-15 09:25:45
My opinions: 1. We don't want to actually recreate PHP. We want to make PHP functions available for javascript, so a function that returns Pi, should return the javascript representation of Pi. The same goes for sqrt(2). 2. I doubt that an increase in precision will bother anybody, or that a decrease will help anybody. 3. There is a more obvious type representation difference between PHP and javascript that is bothering a lot of people: associative arrays. In JS we need objects to do this. I would like to make all array functions in a way they can handle these objects next to the normal arrays, but of course we'll never make a new Array object which handles associative arrays as well. And that's basically what you're asking here: to create a new Number type, which behaves differently than the JS native one. Could we and would we want to change the outcome of something like 1+pow(10, -15) ? I think not. (I haven't tested this for differences but you'll get the idea)
Philip Peterson on 2008-10-14 23:42:49
I guess similarly, shouldn't all numbers (e.g. square roots) be truncated to 14 digits?
Philip Peterson on 2008-10-14 23:33:36
Since PHP defaults to float 14, shouldn't we use the PHP-standard value of pi, 3.1415926535898 ?