Skip to content

Commit 737ff0a

Browse files
committed
[fix] Loss of precision in Number.parseInt()
1 parent ddd5f55 commit 737ff0a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/pjs/types.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ auto Str::parse_int(int base) const -> double {
245245
char *p = nullptr;
246246
auto n = std::strtoll(c_str(), &p, base);
247247
while (*p && std::isblank(*p)) p++;
248-
return *p ? NAN : n;
248+
return *p ? std::numeric_limits<double>::quiet_NaN() : n;
249249
}
250250

251251
bool Str::parse_int64(int64_t &i, int base) {

0 commit comments

Comments
 (0)