UNPKG

phpjs

Version:

php.js offers community built php functions in javascript

58 lines (41 loc) 2.03 kB
<!-- Generated by Rakefile:build --> <strong> <a href="http://an3m1.com/" rel="nofollow">????? ????? ???</a> </strong> on 2012-04-17 15:30:12 <br /> I agree it is a very informative article and I actually enjoy reading good stuff unlike all the crap out there on the internet <hr /> <strong> <a href="http://brett-zamir.me" rel="nofollow">Brett Zamir</a> </strong> on 2011-07-25 07:24:00 <br /> @dude: OK!!!! :) (I also applied in Git to some other functions using PI or LN10.) <hr /> <strong> dude </strong> on 2011-06-30 15:34:27 <br /> just go with &quot;return 3.141592653589793&quot; BECAUSE IT NEVER CHANGES!!!! <hr /> <strong> Onno Marsman </strong> on 2008-10-15 09:25:45 <br /> 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) <hr /> <strong> Philip Peterson </strong> on 2008-10-14 23:42:49 <br /> I guess similarly, shouldn't all numbers (e.g. square roots) be truncated to 14 digits? <hr /> <strong> Philip Peterson </strong> on 2008-10-14 23:33:36 <br /> Since PHP defaults to float 14, shouldn't we use the PHP-standard value of pi, 3.1415926535898 ? <hr />