Hi All Is there a simple way to twiddle the bits of a float? In particular, I would like to round my float to the n most significant bits.
For example - 0.123 in binary is 0.000111111 Rounding to 4 bits I get 0.0001. I can pack and unpack a float into a long e.g. struct.unpack('I',struct.pack('f',0.123))[0] but then I'm not sure how to work with the resulting long. Any suggestions? -- http://mail.python.org/mailman/listinfo/python-list