String constructor doesn't convert float type correctly

If you specify more than 7 decimal places for string constructor it doesn't convert it properly.

  String fltstring;
  float test = 0.000123456789;
  fltstring = String(test,7);
  Serial.print("Test String: ");
  Serial.println(fltstring)

;

The code above produces expected output:

Test String: 0.0001234

Now if we change the number of decimal places to 8:

  String fltstring;
  float test = 0.000123456789;
  fltstring = String(test,8);
  Serial.print("Test String: ");
  Serial.println(fltstring)

;

We get:

Test String: 0.00012346

For 9 decimal places we get output:

Test String: 0.000123457

I can understand if the constructor limits conversion to 7 decimal places (although it is not mentioned anywhere). However it still should handle correctly float type if more decimal places are specified.

Delta_G:
Floats aren't accurate past 6 or 7 places. The String constructor is accurately handling the float variable, but the float variable isn't accurately holding the number you're trying to put in.

Incorrect. Floats are accurate up to ~7 non-zero places. All leading zeros will be dropped after exponential scaling. In other words you can have as many leading zeros before first non-zero digit and still have ~7 digits after them. I intentionally used four leading zeros in my example. The number 1234567e-10 should be correctly represented by a float variable and convert to 0.000123456, which, as you can see in the example above, is not the case. It seems that the conversion that's taking place in the the constructor incorrectly takes first six decimal places even if they are zeros and then does something funky with the last digit.

It seems that the conversion that's taking place in the the constructor incorrectly takes first six decimal places even if they are zeros and then does something funky with the last digit.

You do have the source code, so there is no reason to guess what the String class is doing.

Like mentioned before, read the source code. My guess is the digit specified get used to generate digits after decimal.