Power operator, why does -2**3 throws?

Rick Waldron waldron.rick at gmail.com
Fri Oct 14 14:38:41 UTC 2016


On Fri, Oct 14, 2016 at 7:31 AM Cyril Auburtin <cyril.auburtin at gmail.com>
wrote:

> I would expect `-2**3` to return -8, or `-2**2 == -4`, since it should be
> like `-(2**3)`
>

This was discussed extensively during the design process and determined
that requiring user code to be explicit about its intention was the only
sane design.

-
https://github.com/rwaldron/tc39-notes/blob/master/es7/2015-09/sept-23.md#exponentiation-operator
-
https://github.com/rwaldron/tc39-notes/blob/master/es7/2015-09/sept-24.md#exponentiation-operator


Rick


>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20161014/dbd8da95/attachment.html>


More information about the es-discuss mailing list