Whether log(0) is -Infinity or NaN should depend in some sense on what side
you approach 0 from (I arbitrarily claim to be approaching it from the left
in my formula, to give a NaN result there too).

I feel Math.log(-0) should be NaN in js for that reason, but it is defined
to be -Infinity in the standard. Maybe there are industry standards
pertaining to floating point transcendental functions that mandate this?
Similarly, Math.sqrt(-0) is -0 rather than NaN. Perhaps using the more
correct NaN values in these cases have caused more problems than they have
solved in practice?

Nick



On 17 January 2014 20:16, Adam Ahmed <[email protected]> wrote:

>
>
> On 18 January 2014 06:25, Jason Orendorff <[email protected]>wrote:
>
>>
>> Except I think we want bitlen(0) === 0 for consistency with clz.
>>
>>
> Just noting that this actually works:
>  Math.ceil(Math.log(0 + 1) / Math.LN2) === 0
>
> However:
>  Math.ceil(Math.log(-1 + 1) / Math.LN2) === -Infinity
>
> Not sure how that affects a Negative NaN-cy option :)
>
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to