lua-users home
lua-l archive

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



On Apr 29, 2014, at 1:09 AM, Dirk Laurie <dirk.laurie@gmail.com> wrote:

2014-04-29 3:39 GMT+02:00 Tim Hill <drtimhill@gmail.com>:

On Apr 28, 2014, at 7:14 AM, Leo Razoumov <slonik.az@gmail.com> wrote:



As others pointed out already, integer exponentiation with full 64 bits
is useful (not to mention that it is usually faster, too). To make 2^3
an integer and 2^-3 a float breaks that guideline. But maybe that case
is worth the break.

I think that the "principle of least surprise" would favor 2^-3 == 0.125

--Leo--


I think the principle of least surprise here is consistency. I’m with Roberto on this one, in that it should only be the types that affect the outcome. If you really wanted to be consistent, you would have ^ that coerced both values to float and ^^ that coerced both (or one??) to integer, mirroring the new model for division. This would also, interestingly, not break existing 5.2 code.

It is your right to value consistency above usefulness — but not to claim
Roberto's support in doing so. Read that quote of his again. Roberto has
left the question open. "But maybe".

“I agree with the original rationale (as outlined by Roberto, with some reservations) that only the types of values affect the outcome, not the values”.

To say I was "claiming Roberto’s support” is just silly.