On Sat, Jul 09, 2016 at 05:19:49AM -0700, Itsuki Toyota wrote:
> See the following results
> 
> $ perl6 -e 'say -1 ** -0.1'
> -1
> $ perl6 -e 'say reduce * ** *, -1, (-0.1)'
> NaN

This is not a bug in "reduce" itself.  Exponentiation has higher 
precedence than unary minus, so the first expression is being
parsed and executed as -(1 ** -0.1)  and not  (-1) ** -0.1.
>From my rakudo (ver 2016.06-50-g5a4963f):

$ ./perl6 -e 'say -1 ** -0.1'
-1
$ ./perl6 -e 'say (-1) ** -0.1'
NaN

So, the reduce subroutine is doing exactly the same thing as &infix:<**> here 
does with a negative base.

At the moment I'm inclined to believe that a negative integer with
negative exponent should return NaN, but someone with more mathematics
sense than I would have to make that call.

Pm

Reply via email to