lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Glenn McAllister wrote:
We've been having some odd problems with the exponent operator ('^') and

<snip>

Host: ppc 32-bit

Given the following script, it produces the correct results on both x86 and ppc:

 y = 2^3
 print('y = ', y)

 x = 10 % y
 print('x = ', x)

 y = 2^3
 print('y = ', y)

The output on both platforms is:

 y =     8
 x =     2
 y =     8

However, if we run the morally equivalent series of operations directly in the lua interpreter on the target ppc system, we get a different result:

 Lua 5.1.3  Copyright (C) 1994-2008 Lua.org, PUC-Rio
 > x = 2^3
 > =x
 8
 > y = 10 % x
 > =y
 2
 > z = 2^3
 > =z
 4.0096609170284

What happens if you run the "morally equivalent" script from a file?

And is the last step z = 2^3 or is it z = y^3

Ralph