Sending a floating point number from python to arduino
Floating point numbers are (should) be stored in IEEE 754 format.

If you simply write the binary bytes of a floating point number down the serial line, it should be possible to unpack them at the other end.

To do this (Arduino C/C++), make a pointer from your variable, by casting the address of it to char*. Void* would probably work too.

 float my_value = 22.812;
 my_port.write((const char *)&amp;my_value, sizeof(float)/*4*/);


And the unpacking - there's a few ways to do this, but I like:

 float incoming_value;
 unsigned char buffer[4];

 // If we read enough bytes, unpacked it
 if (my_serial.readBytes(buffer, sizeof(float)) == sizeof(float))
     memcpy(&amp;incoming_value, buffer, sizeof(float));
 else
     // I/O error - no data, not enough bytes, etc.
     incoming_value = 0


On the other end (python), bytes are best handled with the struct module.  This will handle the packing and unpacking for you.

import struct
...

try:
    ieee754_data = my_serial.read(4)
    my_float = struct.unpack('f', ieee754_data)
catch:
    # I/O Error, or junk data
    my_float = 0.0


And packing:

 ieee754_data = struct.pack('f', my_float)
 try:
     my_serial.write(ieee754_data)
 catch:
     pass #TODO - I/O Error


One more note - You might consider using doubles instead of floats for extra precision.  Python floats have the precision of a C/C++ double already.