Re: Power function as operator
| From: | Thomas Hruska | Date: | Fri, 22 Nov 2013 21:40:10 +0000 |
| Subject: | Re: Power function as operator | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-70297@lists.php.net to get a copy of this message | ||
On 11/22/2013 2:06 PM, Chris London wrote:
On Fri, Nov 22, 2013 at 12:56 PM, Sherif Ramadan <theanomaly.is@gmail.com>wrote:SpeedCrunch also reports 512. It is my current desktop calculator of choice (except for decimal/hex conversions) but it hasn't been updated in a while, which is an indicator of a dead project. IMO, things that "look very wrong" are better written with parenthesis. Parenthesis = clarification. 2 ** (3 ** 2) is probably clearer to read than 2 ** 3 ** 2 even though they have the same result. -- Thomas Hruska CubicleSoft President I've got great, time saving software that you might find useful. http://cubiclesoft.com/On Fri, Nov 22, 2013 at 1:03 PM, Tjerk Meesters <tjerk.meesters@gmail.comI don't know if we consider Google to be the authority but they also do 512: 2 ^ 3 ^ 2 = 512 https://www.google.com/search?q=2+%5E+3+%5E+2wrote:2 ** 3 ** 2 == 512That looks very wrong. pow(pow(2,3),2) == 64 Exponent precedence should always be one higher than multiplication precedence.