MCPcopy Create free account
hub / github.com/FastLED/FastLED / parse_as_float

Function parse_as_float

tests/fl/stl/ieee754_string.cpp:20–23  ·  view source on GitHub ↗

Convenience: parse a literal and reinterpret the result as a float for comparison against host strtof. The bit-cast itself does not anchor any libgcc soft-FP helper; the host `float` comparison does (cheap on host).

Source from the content-addressed store, hash-verified

18// comparison against host strtof. The bit-cast itself does not anchor any
19// libgcc soft-FP helper; the host `float` comparison does (cheap on host).
20static float parse_as_float(const char* s) {
21 u32 bits = ieee754_parse_decimal(s, fl::strlen(s));
22 return fl::bit_cast<float>(bits);
23}
24
25FL_TEST_CASE("ieee754_parse_decimal -- well-known constants") {
26 FL_SUBCASE("zero") {

Callers 1

FL_TEST_FILEFunction · 0.85

Calls 2

ieee754_parse_decimalFunction · 0.85
strlenFunction · 0.85

Tested by

no test coverage detected