perl6: Cannot unbox 65536 bit wide bigint into native integer

前端 未结 2 1405
广开言路
广开言路 2021-01-18 03:50

I try some examples from Rosettacode and encounter an issue with the provided Ackermann example: When running it \"unmodified\" (I replaced the utf-8 variable names by latin

2条回答
  •  滥情空心
    2021-01-18 04:31

    Array subscripts use native ints; that's why you get the error in line 3, when you use the big ints as array subscripts. You might have to define a new BigArray that uses Ints as array subscripts.

    The second problem arises in the ** operator: the result is a Real, and when the low-level operations returns a Num, it throws an exception. https://github.com/rakudo/rakudo/blob/master/src/core/Int.pm6#L391-L401

    So creating a BigArray might not be helpful anyway. You'll have to create your own ** too, that always works with Int, but you seem to have hit the (not so infinite) limit of the infinite precision Ints.

提交回复
热议问题