claude.pache at gmail.com
Mon Sep 16 04:40:44 PDT 2013
Le 16 sept. 2013 à 11:30, raul mihaila <raul.mihaila at gmail.com> a écrit :
> I think the definition of modulo is wrong. http://people.mozilla.org/~jorendorff/es6-draft.html#sec-5.2
> k should be of the same sign as x not as y.
I think the definition is correct, and is more useful than the opposite convention. It is indeed the opposite convention of the one used by the remainder operator (`%` in JS), but it is not the remainder operator. (BTW, is there any chance that the modulo operator  will be introduced in EcmaScript, rather sooner than later?)
In fact, since `x modulo y` is apparently only use with positive (and integral) `y` in the specification, the definition should be simplified, by restricting to the case where `y` is positive.
> Also, shouldn't ToUint32 and ToUint16 return only positive numbers? If the argument is, for example, -3, the result will be -3 (assuming that the modulo definition is wrong). Or maybe the argument will never be negative?
Assuming the modulo definition is correct, `ToUint32` and `ToUint16` work as expected (if the argument is `-3` the result is `2^32-3`, resp. `2^16-3`.
> Raul M
> es-discuss mailing list
> es-discuss at mozilla.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss