Rename Number.prototype.clz to Math.clz

Jason Orendorff jason.orendorff at gmail.com
Fri Jan 17 09:11:06 PST 2014


On Fri, Jan 17, 2014 at 7:07 AM, Jens Nockert <jens at nockert.se> wrote:
> On 2014/01/17, at 13:24, Jason Orendorff <jason.orendorff at gmail.com> wrote:
>> Then you could write: Math.bitlen(x >>> 0)
>>
>> That would return 32 if x is a negative 32-bit signed int, because
>> ">>> 0" converts ToUint32.
>
> Yeah, but when would I need to calculate it on a floating-point number?

No one cares about fractions here; the question is about integer
values beyond 0xffffffff. These exist in the "safe integer" range of
JS numbers and will exist in future uint64 and bigint types. (Note
that the whole point of settling on bitlen, as opposed to clz32, would
be future compatibility with such types.)

-j


More information about the es-discuss mailing list