I was trying some values for printing and got to a point where the value of x and the one that is printed in the Serial monitor differ.
In 1. (from the image below) the value is 9999999 (seven 9s).
In 2. (from the image below) the value is 99999999 (eight 9s). Same happens with nine 9s.
With ten 9s a message appears "integer constant is too large for 'long' type".
I don't thing that seven digits is out of the proposed IEEE standard for float.
I'm using Arduino Mega 2560.
First, if you want to print a floating point constant, write it as:
9999999.0
so the compiler doesn't think it's a long. Next, the float data type has 7 digits of precision, so if you exceed this number, the compiler makes it's best guess as to the number. You can see this in the following program:
void setup() {
// put your setup code here, to run once:
char buffer[12];
Serial.begin(9600);
float x = 9999999.0;
Serial.println(x); // prints 9999999.00
x *= 1000.0;
Serial.println(x); // prints ovf (overflow)
dtostrf(x, 11, 2, buffer);
Serial.println(buffer); // prints 9999999000.00
}
void loop() {
}