parseFloat of Class Stream long int overflow
benfre opened this issue · 0 comments
benfre commented
Stream::parseFloat method use long value;
to store temporary value before completion. But when encountering stream of number more than 2^32, this variable will overflow, and generate wrong results. Expect result should be returning float number with less precision, with correct orders of magnitude.
To replicate this bug: call Serial.parseFloat()
when there is a number of more than 9 digits (include fraction digits) on a Serial stream.
One easy solution I can think of, is make the temporary variable float
type.
Our solution for now is to read the whole number into a buffer, and use other method to convert to float.