diff --git a/src/core/impl/utils/json.cpp b/src/core/impl/utils/json.cpp index c2a4028182f1897b092eabd897e74e8798913cb3..7172ee7556065c216b5676db1fdda82ee7efac9b 100644 --- a/src/core/impl/utils/json.cpp +++ b/src/core/impl/utils/json.cpp @@ -52,6 +52,14 @@ void Value::writeto_fpath(const char* fout_path, int indent) const { } void Number::writeto(std::string& fout, int) const { + if (std::isinf(m_val)){ + fout += "\"inf\""; + return ; + } + if (std::isnan(m_val)){ + fout += "\"nan\""; + return ; + } static char fmt[16]; static Spinlock fmt_mtx; if (!fmt[sizeof(fmt) - 1]) {