Possible firmware bug

The String class is unreliable and char arrays (c-strings) are more portable. For most instances of string formatting, snprintf() does the job well. You can find numerous examples on the forum where this has been pointed out.


String(test,DEC);

In this string constructor, the helper function used is flawed, as I’ve discovered in this post.


Serial.println(test,DEC);

In this println() method, the helper function used is similar.


It looks like you’re using 10 for DEC, which explains why you’re seeing the error, because that string constructor will produce incorrect results when you specify 10 or more decimal places.


My only suggestion at the time would be to use snprintf() until the helper function is fixed.

For example:

char buff[33];
snprintf(buff, sizeof(buff), "%1.10f", test);
5 Likes