On Sat, Jun 15, 2013 at 12:03 PM, Cameron Simpson <c...@zip.com.au> wrote: > On 15Jun2013 01:34, Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info> > wrote: > | Everyone is aware that there is more than one NAN, right? > > I was not. Interesting. > > | If my > | calculations are correct, there are 9007199254740992 distinct float NANs > | in Python (although there is no direct way of distinguishing them). > > Wouldn't id() do it? At least in terms of telling them apart? > I gather they're not inspectable in Python?
You could recognize one float object as distinct from another, but that's true of all floats: >>> float("1.0") is float("1.0") False All NaNs are different in terms of the == operator, so conceptually there are an infinite number of unique NaNs. The fact that they're stored in memory using a certain number of bits means that there must be a finite number of possible representations, but that's really an implementation detail. I suppose you could figure out the representation differences by fiddling with ctypes (in C I'd just use a union), but that's really all. ChrisA -- http://mail.python.org/mailman/listinfo/python-list