- 7 months
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
- 7 months
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?
- 7 months
>> typeof(NaN) <- "number"It’s valid for C too, but it will be either a double or a float.
- 7 months
#include <cmath> #include <iostream> #include <numbers> int main() { decltype ( NAN ) f { std::numbers::pi }; std::cout << f << std::endl; }- 7 months
Dude, after forcing
-std=c++20, the compiler still can’t find a reference forstd::ostream::operator<<(float)…Do I have to link with some non-standard library? There doesn’t seem to have any
numbers.aincluded with gcc.- 7 months
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.
- 🇰 🌀 🇱 🇦 🇳 🇦 🇰 🇮 @pawb.socialEnglish7 months
accidentally double types the a and suddenly his program is baking flatbread
- 7 months
That makes sense though. Two things can be “not number” yet be different.
- 7 months
But two things cannot be “not number” and be the same.
- 7 months
And they should still fail == because that’s the behavior of IEEE 754 numbers.
- 7 months
At least NaNs are different from each other and themselves.
SQL’s null would like a word here.