Sandroelec
New member
Hi all,
i've written a simple code
the result was 45.0001182
After i tried to do the same operation with double variables:
at the end the result was correct 45.0001200
I need the result in a float variable because i've to send this value through a serial port.
How is possble to do that?
Why the same operation using floating point variables doesn't work? the number of decimals that i need it's 6 and i think it's good for float variables it's right?
Many thanks
Sandro
i've written a simple code
HTML:
float K_longitude ;
float longitude;
longitude=45.0;
K_longitude =(longitude+(1.2/10000.0));
Serial.println(K_longitude);
the result was 45.0001182
After i tried to do the same operation with double variables:
HTML:
doubleK_longitude ;
double longitude;
longitude=45.0;
K_longitude =(longitude+(1.2/10000.0));
Serial.println(K_longitude,7);
I need the result in a float variable because i've to send this value through a serial port.
How is possble to do that?
Why the same operation using floating point variables doesn't work? the number of decimals that i need it's 6 and i think it's good for float variables it's right?
Many thanks
Sandro