Increase buffer size for converting floats + doubles to String's#5369
Increase buffer size for converting floats + doubles to String's#5369sandeepmistry wants to merge 1 commit intoarduino:masterfrom
Conversation
| { | ||
| init(); | ||
| char buf[33]; | ||
| char buf[FLT_MAX_10_EXP + 4 + decimalPlaces]; // +4, one for: 10, -, ., \0 |
There was a problem hiding this comment.
What do you mean with "10" there? I can understand how -, . and \0 are added to the number of digits that FLT_MAX_10_EXP represents, but not what 10 means.
There was a problem hiding this comment.
10 as in ascii 10, being a LineFeed perhaps ?
There was a problem hiding this comment.
On AVR DBL_MAX_10_EXP is 38 and Serial.println(String(-DBL_MAX)); prints out -340282350000000000000000000000000000000.00.
Which is 43 characters in length, then you need an extra byte for the \0, which brings us to 44.
44 - 38 - 2 = 4. Maybe, I was thinking the extra character was for the 1's digit ...
|
Partially moved to arduino/ArduinoCore-sam#32 |
|
❌ Build failed. |
|
|
Port of arduino/ArduinoCore-samd#163
Troublesome sketch: