Comment

Comment by kittenfluff

Responds "Yes" to

  9007199254740990, 9007199254740991, 9007199254740992
but "No" to

  9007199254740991, 9007199254740992, 9007199254740993
Presumably this is due to how Javascript handles integers, i.e. it uses the integer part of a float64, to wit

  > parseInt('9007199254740992')
  9007199254740992
  > parseInt('9007199254740993')
  9007199254740992
Edit: I think this is the code that actually reads the numbers the user enters, see [0]

  function l(){
      var a=h.exec(m[1]),f=null,g=null,n=null;
      return a&&(null!==a[1]&&a[1]&&(f=parseInt(a[1],10)),
          null!==a[2]&&a[2]&&(g=parseInt(a[2],10)),
          null!==a[3]&&a[3]&&(n=parseInt(a[3],10))),
      new e(f,g,n)
  }
Edit(2): Actually, I'm not so sure that's the correct code at all. They NYT game is capable of parsing floats correctly (e.g. it accepts 1.1, 1.2, 1.3 as a "Yes") so it's not just using parseInt.

[0] http://a1.nyt.com/assets/interactive/20150612-151638/js/foun...

parent kittenfluff 11 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton