Michael Hoffman schrieb: > What's the best way to portably generate binary floating point infinity > and NaNs? I only know two solutions: > > 1. Using the fpconst module proposed in IEEE 754, which I believe shifts > bits around. > > 2. Using an extension module (for example, numarray.ieeespecial will do > it).
Use the struct module to pack/unpack a double value. On an IEEE 754 system, this should work - on a non-IEEE-754 system, it's not clear that +/-inf and NaN actually exist. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list