io@piefed.blahaj.zone to Programmer Humor@programming.devEnglish · 15 hours agoNaN Postingpiefed.cdn.blahaj.zoneimagemessage-square14fedilinkarrow-up1392arrow-down13file-text
arrow-up1389arrow-down1imageNaN Postingpiefed.cdn.blahaj.zoneio@piefed.blahaj.zone to Programmer Humor@programming.devEnglish · 15 hours agomessage-square14fedilinkfile-text
minus-squareArbitraryValue@sh.itjust.workslinkfedilinkEnglisharrow-up66·edit-213 hours agoThings 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
minus-squaremarcos@lemmy.worldlinkfedilinkarrow-up2·edit-28 hours ago>> typeof(NaN) <- "number" It’s valid for C too, but it will be either a double or a float.
minus-squarezerofk@lemmy.ziplinkfedilinkarrow-up2·3 hours ago#include <cmath> #include <iostream> #include <numbers> int main() { decltype ( NAN ) f { std::numbers::pi }; std::cout << f << std::endl; }
minus-squaremarcos@lemmy.worldlinkfedilinkarrow-up1·3 hours agoDude, 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.
minus-squarezerofk@lemmy.ziplinkfedilinkarrow-up2·edit-22 hours agoWeird, 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.
minus-squareArghblarg@lemmy.calinkfedilinkarrow-up7arrow-down1·13 hours ago 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?
minus-squareArbitraryValue@sh.itjust.workslinkfedilinkEnglisharrow-up20·13 hours agoThat’s what I’m saying.
minus-squareArghblarg@lemmy.calinkfedilinkarrow-up4·13 hours agoAh. OK. I re-read your comment :) Silly me.
Things that are numbers:
Things that are not numbers:
numberIt’s valid for C too, but it will be either a double or a float.
#include <cmath> #include <iostream> #include <numbers> int main() { decltype ( NAN ) f { std::numbers::pi }; std::cout << f << std::endl; }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.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.
Oh, that’s right, I was using gcc.
…
? 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?
That’s what I’m saying.
Ah. OK. I re-read your comment :) Silly me.