FastLED 3.9.15
Loading...
Searching...
No Matches

◆ operator>>() [8/10]

istream_real & fl::istream_real::operator>> ( float & f)

Definition at line 302 of file istream.cpp.

302 {
303 string token;
304 if (readToken(token)) {
305 // Use the existing toFloat() method
306 f = token.toFloat();
307 // Check if parsing was successful by checking for valid float
308 // toFloat() returns 0.0f for invalid input, but we need to distinguish
309 // between actual 0.0f and parse failure
310 if (ALMOST_EQUAL_FLOAT(f, 0.0f) && token != "0" && token != "0.0" && token != "0." && token.find("0") != 0) {
311 failed_ = true;
312 }
313 } else {
314 failed_ = true;
315 }
316 return *this;
317}
bool readToken(string &token)
Definition istream.cpp:173
#define ALMOST_EQUAL_FLOAT(a, b)
Definition math_macros.h:63

References istream_real(), ALMOST_EQUAL_FLOAT, failed_, fl::StrN< SIZE >::find(), readToken(), and fl::StrN< SIZE >::toFloat().

+ Here is the call graph for this function: