Printing a float variable

I'm trying to develop a system for monitoring temperatures based on RS485.Since a float need 4 bytes of data when I do something like Serial.print(float variable) how many bytes it will send to serial representing the float value ?
An example, I have a float variable with a value -10.5 and I want send it via serial port.
I need to know this because of the RS485 structure

Since a float need 4 bytes of data when I do something like Serial.print(float variable) how many bytes it will send to serial representing the float value ?

You are asking the wrong question. When you Serial.print() anything, the value is converted to a string. and the string representation of the value is put on the serial port.

If the value is something like 1.02, then 4 bytes are sent. If the value is 1.0031, then, 4 bytes are sent. If the value is something like 1010.34, then 7 bytes are sent.

If you use the optional second argument, the value defines how many decimal places of output are used in the string representation. This affects how many bytes are output.

Please note that there is a difference between the print() and write() functions.
print = "Prints data to the serial port as human-readable ASCII text"
write = "Writes binary data to the serial port."

It sounds like you are after the write() function so that you can send the binary representation of the variable, as opposed to the human readable string of characters that the variable gets converted to for display on a screen.

Thanks Paul it clarify me. Also if I use the - sign it will also print another byte corresponding to the ascci (0x2D) representation right?

The Serial.print(float) will convert the value to ASCII and send it. If you have a quick look at Print.h, you'll see that the default decimal places is 2. So your problem in this situation would be the integer part and sign, because the decimal places will be two.

But with an RS485, you may be wanting to send it in a format that the other side (not sure if it's a computer or not), in which case the solution would be something like:

//be aware of endianness

float myVar = 10.5; 
unsigned char myArray[4];//be aware of casts, although this isn't really needed. 
...
for (int i = 0; i<=3; i++) {
    Serial.print((char)((myVar>>i)&0xff));
    }
...

Not sure if this would be possible with pointers, but it's worth a try.

??? I don't understand your suggestion ???

do you mean

union 
{ 
  float myVar ; 
  char myArray[4];
} u;
u.myVar = 10.5;
...
for (int i = 0; i<=3; i++) {
    Serial.write(  u.myArray[i] );
}

with (i =3; i >=0; i--) you could even translate littleEndian to bigEndian or vice versa ?