On Jul 12, 2013, at 4:18 PM, Jeff Walden wrote:

> On 07/12/2013 04:03 PM, Allen Wirfs-Brock wrote:
>> are you suggesting that if we want such an function, it should be named 
>> something else, such as isExactInteger,  isPreciseInteger, 
>> isUnambiguousInteger, etc?
> 
> Possibly, but I don't think so.  Whether a value is exact or precise is a 
> function not of the value itself, but of how it was computed.  Math.pow(2, 
> 53) computed that way is an exact value.  Math.pow(2, 53) - 1 + 2 is (in 
> IEEE-754 terms) the same value.  But it is not exact, because it derived from 
> an inexact computation.  It all depends how you got the value you're passing 
> in.
> 
> "isUnambiguousInteger" is in a different league from exact/precise.  Assuming 
> a definition like so, it might be reasonable:
> 
>  function isUnambiguousInteger(n)
>  {
>    if ((n % 1) !== 0)
>      return false;
>    return Math.abs(n) < Math.pow(2, 53);
>  }
> 
> I'm not sure whether it would be useful enough to carry weight, tho, given it 
> has fairly esoteric use cases.  And anyone asking these sorts of questions 
> really needs to know the IEEE-754 design well enough to understand how/why 
> things go wrong, well enough that they could code it themselves.  The 
> existence of such a method doesn't make it any more likely that they will 
> understand these details.

So the other thread was a discussion concerning the appropriate value of 
Number.MAX_INTEGER. Do you think it should be 2^53-1, or 2^53, or the same 
thing as Math..MAX_VALUE.

Allen



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

Reply via email to