this post was submitted on 14 Nov 2026
394 points (97.4% liked)

Programmer Humor

34156 readers
867 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 3 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] ThunderComplex@lemmy.today 19 points 2 days ago (1 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.

[–] threeonefour@piefed.ca 9 points 2 days ago (2 children)

NaN is a error

Error.isError(NaN)
// False
[–] lime@feddit.nu 17 points 2 days ago* (last edited 2 days 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.