File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change 2020*/
2121
2222#include " WString.h"
23+ #include < float.h>
2324
2425/* ********************************************/
2526/* Static Member Initialisation */
@@ -114,7 +115,7 @@ String::String(unsigned long value, unsigned char base)
114115
115116String::String (float value, unsigned char decimalPlaces)
116117{
117- static size_t const FLOAT_BUF_SIZE = 38 + FLT_MAX_DECIMAL_PLACES + 1 /* '-' */ + 1 /* '.' */ + 1 /* '\0' */ ;
118+ static size_t const FLOAT_BUF_SIZE = FLT_MAX_10_EXP + FLT_MAX_DECIMAL_PLACES + 1 /* '-' */ + 1 /* '.' */ + 1 /* '\0' */ ;
118119 init ();
119120 char buf[FLOAT_BUF_SIZE];
120121 decimalPlaces = decimalPlaces < FLT_MAX_DECIMAL_PLACES ? decimalPlaces : FLT_MAX_DECIMAL_PLACES;
@@ -123,7 +124,7 @@ String::String(float value, unsigned char decimalPlaces)
123124
124125String::String (double value, unsigned char decimalPlaces)
125126{
126- static size_t const DOUBLE_BUF_SIZE = 38 + DBL_MAX_DECIMAL_PLACES + 1 /* '-' */ + 1 /* '.' */ + 1 /* '\0' */ ;
127+ static size_t const DOUBLE_BUF_SIZE = DBL_MAX_10_EXP + DBL_MAX_DECIMAL_PLACES + 1 /* '-' */ + 1 /* '.' */ + 1 /* '\0' */ ;
127128 init ();
128129 char buf[DOUBLE_BUF_SIZE];
129130 decimalPlaces = decimalPlaces < DBL_MAX_DECIMAL_PLACES ? decimalPlaces : DBL_MAX_DECIMAL_PLACES;
You can’t perform that action at this time.
0 commit comments