On Fri, Apr 11, 2014 at 9:05 PM, Peng Zhicheng
<pengzhicheng1986@gmail.com> wrote:
It may be faster. but it is the semantic difference that I was concerned.
I suppose the pow function would quite usually overflow a integer(even
64-bit long),
do we really need a dedicated `pow' for integers?
Consider (this is Lua 5.1):
x = 2^56
y = x + 1
=x
7.2057594037928e+16
=y
7.2057594037928e+16
=x == y
true
The actual value is 72057594037927936. This is an exact number, with
no precision loss, but the float version gets it wrong.
Now, I don't have 5.3work installed, but I do have Python, which uses
integer exponentiation: