lua-users home
lua-l archive

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


Hi,

this works (Lua 5.3.0 (work2)):
> =1 / 4
0.25

but the same calculation just written differently gives an error:
> =4^-1
stdin:1: integer exponentiation with negative exponent

This error case looks counter-intuitive to me. E. g. calc is happy:

; 4^-1
	0.25

same with awk:

$ awk 'BEGIN{print(4^-1)}'
0.25

(I already had to change existing Lua code to get it running with
work2.) Wouldn't it be more logical, if exponentiation with negative
exponent would convert the base argument to float, similar to the
division case?

Regards, Hartmut