Commit 8158c216 authored by Frank Tang's avatar Frank Tang Committed by Commit Bot

Fix format of -NAN in toLocaleString()

Bug: chromium:1030160
Change-Id: I4e1b762b10c77ec671712355c61cdbb0b5f033da
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2068725Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66411}
parent 31b34fe9
......@@ -1252,7 +1252,9 @@ Maybe<icu::UnicodeString> IcuFormatNumber(
formatted = number_format.formatDecimal(
{big_int_string->ToCString().get(), big_int_string->length()}, status);
} else {
double number = numeric_obj->Number();
double number = numeric_obj->IsNaN()
? std::numeric_limits<double>::quiet_NaN()
: numeric_obj->Number();
formatted = number_format.formatDouble(number, status);
}
if (U_FAILURE(status)) {
......
// Copyright 2020 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
assertEquals("NaN", (null/null).toLocaleString());
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment