Re: integer exponentiation with negative exponent
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: integer exponentiation with negative exponent
- From: Thomas Jericke <tjericke@...>
- Date: 2014年4月14日 12:28:27 +0200
On 04/14/2014 10:19 AM, Justin Cormack wrote:
I agree with Roberto, consistent types is more important. If you
cannot tell if something will return float or int you can then no
longer reason about other stuff that depends on it. Anyone trying to
do static analysis on Lua code will have a hard time too.
Justin
As soon as any static analizer hits a function call, it wont be able to
decide this anyway.
The power operater can either be:
float ^ float -> float
int ^ int -> int
or
float ^ float -> float
int ^ int -> number
Where number is defined as (float | int).
I am not conviced by either option. The most consistent IMO would be an
additional ^^ (int exponent) operator, and apply the same rules for
power as for division.
--
Thomas