I'm curious why we have not-a-number, but not not-a-string, not-a-boolean, not-an-enum, and not-a-mycustomtype.
Itanium had a bit for "not a thing" for integers (and perhaps some older hardware from around the time floats started being a thing had similar things), so the idea of hardware support for not-a-* isn't exclusive to floats, but evidently this hasn't caught on; generally it's messy because it needs a bit pattern to yoink, but many types already use all possible ones (whereas floats already needed to chop out some for infinities).
Are there any common string operations with similar behavior?
Unicode’s � is basically a symbol for not-a-char.
For example:
for i in range(0, 10):
print(i/0.0)
In this case it should probably print +inf when i == 0.But:
for i in range(-10, 10):
print(i/0.0)
Now it is not clear, but at least we know it's an infinity so perhaps we need a special value +-inf.And:
for i in range(-10, 10):
print(i/i)
In this case, the value for 0/0 can be 1.https://www.gnu.org/software/libc/manual/html_node/Infinity-...