Hacker News new | ask | show | jobs
by tlb 2740 days ago
JSON doesn't support NaN or infinity, so most JS implementations emit null for NaN, +Inf, -Inf. In Node:

  > JSON.stringify({nan: 0/0, inf: 1/0, neginf:-1/0})
  '{"nan":null,"inf":null,"neginf":null}'
I'm not sure if throwing an exception is better or worse.
1 comments

Ok, but the line I quoted wasn't about infinity, it was about numbers that were "too large", which I assume means bignums.