you are viewing a single comment's thread
view the rest of the comments
[–] 17 points 1 day ago (4 children)

NaN is a error and it’s your responsibility to handle it gracefully. No need to halt the entire program when you fuck up some maths.

  • source
  • parent
  • hideshow 4 child comments
  • [–] 12 points 1 day ago (3 children)

    NaN is a error

    Error.isError(NaN)
    // False
    
  • source
  • parent
  • hideshow 3 child comments
  • [–] 14 points 23 hours ago*

    nan is a ieee754-defined error. what javascript calls errors these days (it tends to change a lot) has little to nothing to do with that. it's on every developer to familiarise themself with ieee754, it's one of the most important documents in the profession.

    while nan is an invalid floating-point number, it is a valid value for a float-typed field. making it into an error is like adding a bit labelled "crash" to every number in your program.

  • source
  • parent