On Jul 12, 2013, at 10:19 AM, Mark S. Miller <[email protected]> wrote:

> No. Even if toInteger meant "no fractional component", I would still expect 
> it only to return true if there is some specific mathematical integer that 
> the JS number can be said to exactly represent. For the same reason, I think 
> isInteger(-0) should be true and isInteger(NaN) should be false.

Oh i agree with that, i was making an observation that the behaviour (i think) 
will confuse people just on the basis of people equating Int32 with Integer

--Oliver

> 
> 
> On Fri, Jul 12, 2013 at 10:16 AM, Oliver Hunt <[email protected]> wrote:
> 
> On Jul 12, 2013, at 8:58 AM, Luke Hoban <[email protected]> wrote:
> 
> >> From: Allen Wirfs-Brock [mailto:[email protected]]
> >>
> >> On Jul 11, 2013, at 9:01 PM, Luke Hoban wrote:
> >>
> >>> Two questions on new Number APIs:
> >>>
> >>> 1) Is it intentional that clz is on Number.prototype instead of Number?  
> >>> Why?
> >>
> >> I think there is a stronger case to me made for Math.clz(number).  
> >> Number.prototype and Math both seem like plausible homes for clz.  In the 
> >> end, I placed it on Number prototype because it is an operation that is 
> >> specific to a particular numeric encoding rather than an implementation of 
> >> a general mathematical function.
> >>
> >
> > Yeah, I think Math would have been less surprising.  I don't feel strongly, 
> > but Number.prototype wasn't what I had expected.
> 
> I agree with luke, Math.clz seems like a better place than the prototype, 
> otoh there's a nice conciseness to foo.clz() …
> 
> 
> >
> >>>
> >>> 2) Is it intentional that Number.toInteger(Infinity) returns true?
> >> Huh? How's that?
> >>
> >> Number.toInteger is specified as the single step:
> >>
> >>   1 Return ToInteger(number)
> >>
> >> and step 4 of the abstract operation ToInteger(number):
> >>
> >> 4 If number is +0, -0, +∞, or -∞, return number.
> >>
> >
> > Sorry, I meant 'isInteger'.  Per your quoted section, toInteger(Infinity) 
> > is Infinity, so isInteger(Infinity) is true.
> 
> I agree with MarkM that it seems bizarre that non-finite numbers may return 
> true, but i think this is rooted in .isInteger() sounding like it means a 
> 32bit integer (such that bitops won't modify the value) when it is actually a 
> "no fractional component" test.
> 
> --Oliver
> 
> > _______________________________________________
> > es-discuss mailing list
> > [email protected]
> > https://mail.mozilla.org/listinfo/es-discuss
> 
> _______________________________________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
> 
> 
> 
> -- 
>     Cheers,
>     --MarkM

_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to