
Ralph Hempel wrote:
Glenn McAllister wrote:We've been having some odd problems with the exponent operator ('^') and<snip>Host: ppc 32bitGiven 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 = 8However, 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) 19942008 Lua.org, PUCRio > x = 2^3 > =x 8 > y = 10 % x > =y 2 > z = 2^3 > =z 4.0096609170284What happens if you run the "morally equivalent" script from a file?
Sorry, I had changed around some of the variable for the interactive session to show that its any assignment of 2^3 that triggers the issue, and not just resetting y.
If I change the script to: x = 2^3 print('x = ', x) y = 10 % x print('y = ', y) z = 2^3 print('z = ', z) I get the expected output: x = 8 y = 2 z = 8
And is the last step z = 2^3 or is it z = y^3
Its z = 2^3, which should have the value of 8. So I'm using constants, not the variable.
But interestingly, if I change the last assignment in the script from z = 2 ^ 3 to be z = y ^ 3 I now get the broken output: x = 8 y = 2 z = 4.0096609170284 Adding the following to the end of the script: a = 2 ^ 3 print ('a = ', a) Gives me the following: x = 8 y = 2 z = 4.0096609170284 a = 8 WTF?  Glenn McAllister <glenn@somanetworks.com> +1 416 348 1594 SOMA Networks, Inc. http://www.somanetworks.com/ +1 416 977 1414