From 04388516db30df7184bd4eb3ef36498af9b9d9c7 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Wed, 4 Nov 2015 21:51:18 -0800 Subject: nan --- src/wasm-s-parser.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/wasm-s-parser.h') diff --git a/src/wasm-s-parser.h b/src/wasm-s-parser.h index 26abdec8e..81c0e73b4 100644 --- a/src/wasm-s-parser.h +++ b/src/wasm-s-parser.h @@ -33,7 +33,8 @@ IString MODULE("module"), CALL_IMPORT("call_import"), CALL_INDIRECT("call_indirect"), INFINITY_("infinity"), - NEG_INFINITY("-infinity"); + NEG_INFINITY("-infinity"), + NAN_("nan"); // // An element in an S-Expression: a list or a string @@ -517,6 +518,14 @@ private: } return ret; } + if (s[1]->str() == NAN_) { + switch (type) { + case f32: ret->value.f32 = std::nan(""); break; + case f64: ret->value.f64 = std::nan(""); break; + default: abort(); + } + return ret; + } } const char *str = s[1]->c_str(); std::istringstream istr(str); -- cgit v1.2.3