/**************************************************************** * * The author of this software is David M. Gay. * * Copyright (c) 1991, 2000, 2001 by Lucent Technologies. * Copyright (C) 2002, 2005, 2006, 2007, 2008, 2010, 2012 Apple Inc. * All rights reserved. * * Permission to use, copy, modify, and distribute this software for any * purpose without fee is hereby granted, provided that this entire notice * is included in all copies of any software which is or includes a copy * or modification of this software and in all copies of the supporting * documentation for such software. * * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED * WARRANTY. IN PARTICULAR, NEITHER THE AUTHOR NOR LUCENT MAKES ANY * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. * ***************************************************************/ /* Please send bug reports to David M. Gay (dmg at acm dot org, * with " at " changed at "@" and " dot " changed to "."). */ /* On a machine with IEEE extended-precision registers, it is * necessary to specify double-precision (53-bit) rounding precision * before invoking strtod or dtoa. If the machine uses (the equivalent * of) Intel 80x87 arithmetic, the call * _control87(PC_53, MCW_PC); * does this with many compilers. Whether this or another call is * appropriate depends on the compiler; for this to work, it may be * necessary to #include "float.h" or another system-dependent header * file. */ #ifdef UNSAFE_BUFFERS_BUILD // TODO(crbug.com/351564777): Remove this and convert code to safer constructs. #pragma allow_unsafe_buffers #endif #include "third_party/blink/renderer/platform/wtf/dtoa.h" #include <string.h> #include "base/numerics/safe_conversions.h" #include "base/third_party/double_conversion/double-conversion/double-conversion.h" #include "third_party/blink/renderer/platform/wtf/wtf_size_t.h" namespace WTF { namespace { double ParseDoubleFromLongString(const UChar* string, size_t length, size_t& parsed_length) { … } const double_conversion::StringToDoubleConverter& GetDoubleConverter() { … } } // namespace const char* NumberToString(double d, NumberToStringBuffer buffer) { … } static inline const char* FormatStringTruncatingTrailingZerosIfNeeded( NumberToStringBuffer buffer, double_conversion::StringBuilder& builder) { … } const char* NumberToFixedPrecisionString(double d, unsigned significant_figures, NumberToStringBuffer buffer) { … } const char* NumberToFixedWidthString(double d, unsigned decimal_places, NumberToStringBuffer buffer) { … } double ParseDouble(const LChar* string, size_t length, size_t& parsed_length) { … } double ParseDouble(const UChar* string, size_t length, size_t& parsed_length) { … } namespace internal { void InitializeDoubleConverter() { … } } // namespace internal } // namespace WTF