[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: integer exponentiation with negative exponent
- From: Dirk Laurie <dirk.laurie@...>
- Date: Tue, 29 Apr 2014 10:09:21 +0200
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".