On Jul 12, 2013, at 9:01 AM, Mark Miller wrote:

> 
> 
> 
> On Fri, Jul 12, 2013 at 8:58 AM, Luke Hoban <lu...@microsoft.com> wrote:
> >From: Allen Wirfs-Brock [mailto:al...@wirfs-brock.com]
> >
> 
> >>
> >> 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.
> 
> And I find that equally bizarre and unpleasant.

ToInteger is an internal operation.  Algorithms that call it can explicitly 
check for infinities if it is important to them.  However, a quick scan of its 
current uses shows that passing through infinities is exactly want is needed in 
most cases.

Number.toInteger is a language level function and it is certainly reasonable to 
explicitly discuss what it should  return for infinities (and for that matter 
NaN and -0).  So what do you think it should do for those cases?

Also, the current Math.isInteger spec. is just plan bogus:

    3.   If integer is not equal to number, return false.

What (in the spec.) does "not equal" mean?  I must have been asleep at the 
keyboard or  maybe it's strawman language that slipped through into the spec. 
without adequate review...

Allen




_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to