'A double is written as 8 bytes.
The double is converted into a 64-bit integer using a method equivalent to
Java\'s doubleToLongBits and then encoded in little-endian format.'

def write_double(self, datum):

    bits = STRUCT_LONG.unpack(STRUCT_DOUBLE.pack(datum))[0]
    self.write(chr((bits & 255)))
    self.write(chr(((bits >> 8) & 255)))
    self.write(chr(((bits >> 16) & 255)))
    self.write(chr(((bits >> 24) & 255)))
    self.write(chr(((bits >> 32) & 255)))
    self.write(chr(((bits >> 40) & 255)))
    self.write(chr(((bits >> 48) & 255)))
    self.write(chr(((bits >> 56) & 255)))
