this post was submitted on 12 Nov 2025
434 points (99.3% liked)

Programmer Humor

27322 readers
2024 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 2 years ago
MODERATORS
top 14 comments
sorted by: hot top controversial new old
[–] ArbitraryValue@sh.itjust.works 73 points 3 days ago* (last edited 3 days ago) (2 children)

Things that are numbers:

  • a memory address
  • the letter B
  • an error encountered when trying to open a file
  • the concept of being false, as opposed to being true

Things that are not numbers:

  • this particular floating-point ~~number~~
[–] Arghblarg@lemmy.ca 6 points 3 days ago (1 children)

Things that are numbers

...

the concept of being false, as opposed to being true

? If your're referring to the C language convention that anything nonzero is 'true'... false itself is exactly zero. Zero is a number. Perhaps I miss something here?

[–] ArbitraryValue@sh.itjust.works 20 points 3 days ago (1 children)
[–] Arghblarg@lemmy.ca 5 points 2 days ago

Ah. OK. I re-read your comment :) Silly me.

[–] marcos@lemmy.world 4 points 2 days ago* (last edited 2 days ago) (1 children)
>> typeof(NaN)
<- "number"

It's valid for C too, but it will be either a double or a float.

[–] zerofk@lemmy.zip 2 points 2 days ago (1 children)
#include <cmath>
#include <iostream>
#include <numbers>

int main()
{
  decltype ( NAN ) f { std::numbers::pi };
  std::cout << f << std::endl;
} 
[–] marcos@lemmy.world 2 points 2 days ago (1 children)

Dude, after forcing -std=c++20, the compiler still can't find a reference for std::ostream::operator<<(float)...

Do I have to link with some non-standard library? There doesn't seem to have any numbers.a included with gcc.

[–] zerofk@lemmy.zip 3 points 2 days ago* (last edited 2 days ago) (1 children)

Weird, it should be standard C++20. Hope are you invoking gcc?

godbolt link: https://godbolt.org/z/6Tn4Kcjrs

Edit: be sure to call g++, not gcc.

[–] marcos@lemmy.world 3 points 2 days ago

Oh, that's right, I was using gcc.

[–] Kolanaki@pawb.social 28 points 3 days ago

accidentally double types the a and suddenly his program is baking flatbread

[–] fibojoly@sh.itjust.works 11 points 3 days ago (1 children)

That makes sense though. Two things can be "not number" yet be different.

[–] Cevilia@lemmy.blahaj.zone 6 points 2 days ago (1 children)

But two things cannot be "not number" and be the same.

[–] LodeMike@lemmy.today 2 points 2 days ago

And they should still fail == because that's the behavior of IEEE 754 numbers.

[–] marcos@lemmy.world 7 points 2 days ago

At least NaNs are different from each other and themselves.

SQL's null would like a word here.