Added ARDUINOJSON_ENABLE_INFINITY to enable Infinity in JSON

This commit is contained in:
Benoit Blanchon
2019-05-19 15:48:27 +02:00
parent 7427888e05
commit 80a02cd90d
8 changed files with 107 additions and 10 deletions

View File

@ -71,11 +71,16 @@ inline ParsedNumber<TFloat, TUInt> parseNumber(const char *s) {
s++;
break;
}
#if ARDUINOJSON_ENABLE_NAN
if (*s == 'n' || *s == 'N') return traits::nan();
#endif
#if ARDUINOJSON_ENABLE_INFINITY
if (*s == 'i' || *s == 'I')
return is_negative ? -traits::inf() : traits::inf();
#endif
if (!isdigit(*s) && *s != '.') return return_type();
mantissa_t mantissa = 0;