lambdamoo
lambdamoo copied to clipboard
Power operator is broken for −1^b when b < 0
The following change to the numbers.c
function do_power()
is erroneous:
- ans.v.num = (b % 2 == 0 ? 1 : -1);
+ ans.v.num = (b & 1) ? 1 : -1;
As a result, negative powers of −1 have the wrong sign.