[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: integer exponentiation with negative exponent
- From: Justin Cormack <justin@...>
- Date: Mon, 14 Apr 2014 09:19:27 +0100
On Mon, Apr 14, 2014 at 8:53 AM, Dirk Laurie <dirk.laurie@gmail.com> wrote:
> 2014-04-14 9:29 GMT+02:00 Tim Hill <drtimhill@gmail.com>:
>
>> .. it really comes down to two choices:
>>
>> 1 / (x^(-n) … invert the sign and do floating point division
>> -or-
>> error
>>
>> As Roberto said, work1 did the former, work2 the latter.
>
> >From a pedantic point of view, inverting the sign and doing
> integer division is the only consistent option.
>
> But from a practical point of view, particularly the non-breaking
> of existing programs, floating-point division is the only useful
> option.
>
> So which is more typical of The Lua Way: consistent but useless,
> or pragmatic and useful?
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