MCPcopy Create free account
hub / github.com/WasmVM/WasmVM / parse_f32

Method parse_f32

src/lib/parse/ParseContext.cpp:344–351  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

342 return (u64_t)std::stoull(removeUnderscore(tok_.expect(TokenType::Integer).text), nullptr, 0);
343}
344f32_t ParseContext::parse_f32() {
345 std::string text = removeUnderscore(tok_.expect(TokenType::Float).text);
346 if (text.find("nan:0x") != std::string::npos) {
347 size_t pos = text.find("nan:0x");
348 return (f32_t)std::nanf(text.substr(pos + 4).c_str());
349 }
350 return (f32_t)std::stof(text);
351}
352f64_t ParseContext::parse_f64() {
353 std::string text = removeUnderscore(tok_.expect(TokenType::Float).text);
354 if (text.find("nan:0x") != std::string::npos) {

Callers

nothing calls this directly

Calls 2

removeUnderscoreFunction · 0.85
expectMethod · 0.80

Tested by

no test coverage detected