MCPcopy Create free account
hub / github.com/ARM-software/astc-encoder / is_float

Function is_float

Source/astcenccli_toplevel.cpp:214–225  ·  view source on GitHub ↗

* @brief Test if a string argument is a well formed float. */

Source from the content-addressed store, hash-verified

212 * @brief Test if a string argument is a well formed float.
213 */
214static bool is_float(
215 std::string target
216) {
217 float test;
218 std::istringstream stream(target);
219
220 // Leading whitespace is an error
221 stream >> std::noskipws >> test;
222
223 // Ensure no remaining string, in addition to checking for parse failure
224 return stream.eof() && !stream.fail();
225}
226
227/**
228 * @brief Test if a string ends with a given suffix.

Callers 1

init_astcenc_configFunction · 0.85

Calls 1

eofMethod · 0.45

Tested by

no test coverage detected