Unreviewed, rolling out r119062 and r119064.
authortkent@chromium.org <tkent@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 31 May 2012 07:22:58 +0000 (07:22 +0000)
committertkent@chromium.org <tkent@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 31 May 2012 07:22:58 +0000 (07:22 +0000)
http://trac.webkit.org/changeset/119062
http://trac.webkit.org/changeset/119064
https://bugs.webkit.org/show_bug.cgi?id=87360

Broke build on Lion, SnowLoepard, Chromium Windows, and
Chromium Linux 32

Source/WebCore:

* CMakeLists.txt:
* GNUmakefile.list.am:
* Target.pri:
* WebCore.gypi:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* platform/Decimal.cpp: Removed.
* platform/Decimal.h: Removed.

Source/WebKit/chromium:

* WebKit.gypi:
* tests/DecimalTest.cpp: Removed.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@119067 268f45cc-cd09-0410-ab3c-d52691b4dbfc

12 files changed:
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/GNUmakefile.list.am
Source/WebCore/Target.pri
Source/WebCore/WebCore.gypi
Source/WebCore/WebCore.vcproj/WebCore.vcproj
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/platform/Decimal.cpp [deleted file]
Source/WebCore/platform/Decimal.h [deleted file]
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/WebKit.gypi
Source/WebKit/chromium/tests/DecimalTest.cpp [deleted file]

index 4d724aa..ef2d939 100644 (file)
@@ -1109,7 +1109,6 @@ SET(WebCore_SOURCES
     platform/ContentType.cpp
     platform/CrossThreadCopier.cpp
     platform/DateComponents.cpp
-    platform/Decimal.cpp
     platform/DragData.cpp
     platform/DragImage.cpp
     platform/EventTracer.cpp
index 5c6f713..989aa73 100644 (file)
@@ -1,3 +1,22 @@
+2012-05-31  Kent Tamura  <tkent@chromium.org>
+
+        Unreviewed, rolling out r119062 and r119064.
+        http://trac.webkit.org/changeset/119062
+        http://trac.webkit.org/changeset/119064
+        https://bugs.webkit.org/show_bug.cgi?id=87360
+
+        Broke build on Lion, SnowLoepard, Chromium Windows, and
+        Chromium Linux 32
+
+        * CMakeLists.txt:
+        * GNUmakefile.list.am:
+        * Target.pri:
+        * WebCore.gypi:
+        * WebCore.vcproj/WebCore.vcproj:
+        * WebCore.xcodeproj/project.pbxproj:
+        * platform/Decimal.cpp: Removed.
+        * platform/Decimal.h: Removed.
+
 2012-05-31  Shane Stephens  <shanestephens@google.com>
 
         text-decoration should not be propagated through absolutely positioned elements to <a> tags
index 9a98ba0..37842af 100644 (file)
@@ -3117,8 +3117,6 @@ webcore_sources += \
        Source/WebCore/platform/Cursor.h \
        Source/WebCore/platform/DateComponents.cpp \
        Source/WebCore/platform/DateComponents.h \
-       Source/WebCore/platform/Decimal.cpp \
-       Source/WebCore/platform/Decimal.h \
        Source/WebCore/platform/DragData.cpp \
        Source/WebCore/platform/DragData.h \
        Source/WebCore/platform/DragImage.cpp \
index 3ee85e7..59ef393 100644 (file)
@@ -1084,7 +1084,6 @@ SOURCES += \
     platform/ContentType.cpp \
     platform/CrossThreadCopier.cpp \
     platform/DateComponents.cpp \
-    platform/Decimal.cpp \
     platform/DragData.cpp \
     platform/DragImage.cpp \
     platform/EventTracer.cpp \
@@ -2207,7 +2206,6 @@ HEADERS += \
     platform/ContextMenu.h \
     platform/CrossThreadCopier.h \
     platform/DateComponents.h \
-    platform/Decimal.h \
     platform/DragData.h \
     platform/DragImage.h \
     platform/EventTracer.h \
index c14f140..61efab1 100644 (file)
             'platform/CookiesStrategy.h',
             'platform/Cursor.h',
             'platform/DateComponents.h',
-            'platform/Decimal.h'
             'platform/DragData.h',
             'platform/DragImage.h',
             'platform/EventTracer.h',
             'platform/CrossThreadCopier.h',
             'platform/Cursor.cpp',
             'platform/DateComponents.cpp',
-            'platform/Decimal.cpp',
             'platform/DragData.cpp',
             'platform/DragImage.cpp',
             'platform/EventLoop.h',
index b1b1de7..40fc3c4 100755 (executable)
                                >
                        </File>
                        <File
-                               RelativePath="..\platform\Decimal.cpp"
-                               >
-                       </File>
-                       <File
-                               RelativePath="..\platform\Decimal.h"
-                               >
-                       </File>
-                       <File
                                RelativePath="..\platform\DragData.cpp"
                                >
                        </File>
index 9461ef9..2f240f5 100644 (file)
                450CEBF015073BBE002BB149 /* LabelableElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 450CEBEE15073BBE002BB149 /* LabelableElement.cpp */; };
                450CEBF115073BBE002BB149 /* LabelableElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 450CEBEF15073BBE002BB149 /* LabelableElement.h */; settings = {ATTRIBUTES = (Private, ); }; };
                45BAC2B01360BBAB005DA258 /* IconURL.h in Headers */ = {isa = PBXBuildFile; fileRef = 45BAC2AF1360BBAB005DA258 /* IconURL.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               45FEA5CF156DDE8C00654101 /* Decimal.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 45FEA5CD156DDE8C00654101 /* Decimal.cpp */; };
-               45FEA5D0156DDE8C00654101 /* Decimal.h in Headers */ = {isa = PBXBuildFile; fileRef = 45FEA5CE156DDE8C00654101 /* Decimal.h */; settings = {ATTRIBUTES = (Private, ); }; };
                4614A1FE0B23A8D600446E1C /* copyCursor.png in Resources */ = {isa = PBXBuildFile; fileRef = 4614A1FD0B23A8D600446E1C /* copyCursor.png */; };
                46700ED0127B96CB00F5D5D6 /* FileWriterSync.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46700ECE127B96CB00F5D5D6 /* FileWriterSync.cpp */; };
                46700ED1127B96CB00F5D5D6 /* FileWriterSync.h in Headers */ = {isa = PBXBuildFile; fileRef = 46700ECF127B96CB00F5D5D6 /* FileWriterSync.h */; };
                450CEBEE15073BBE002BB149 /* LabelableElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LabelableElement.cpp; sourceTree = "<group>"; };
                450CEBEF15073BBE002BB149 /* LabelableElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LabelableElement.h; sourceTree = "<group>"; };
                45BAC2AF1360BBAB005DA258 /* IconURL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IconURL.h; sourceTree = "<group>"; };
-               45FEA5CD156DDE8C00654101 /* Decimal.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Decimal.cpp; sourceTree = "<group>"; };
-               45FEA5CE156DDE8C00654101 /* Decimal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Decimal.h; sourceTree = "<group>"; };
                4614A1FD0B23A8D600446E1C /* copyCursor.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = copyCursor.png; sourceTree = "<group>"; };
                46700ECE127B96CB00F5D5D6 /* FileWriterSync.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FileWriterSync.cpp; path = Modules/filesystem/FileWriterSync.cpp; sourceTree = "<group>"; };
                46700ECF127B96CB00F5D5D6 /* FileWriterSync.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FileWriterSync.h; path = Modules/filesystem/FileWriterSync.h; sourceTree = "<group>"; };
                                F587868402DE3B8601EA4122 /* Cursor.h */,
                                A5732B08136A161D005C8D7C /* DateComponents.cpp */,
                                A5732B09136A161D005C8D7C /* DateComponents.h */,
-                               45FEA5CD156DDE8C00654101 /* Decimal.cpp */,
-                               45FEA5CE156DDE8C00654101 /* Decimal.h */,
                                A79546420B5C4CB4007B438F /* DragData.cpp */,
                                A7B6E69D0B291A9600D0529F /* DragData.h */,
                                A7CFB3CF0B7ED10A0070C32D /* DragImage.cpp */,
                                F55B3DB61251F12D003EF269 /* DateInputType.h in Headers */,
                                F55B3DB81251F12D003EF269 /* DateTimeInputType.h in Headers */,
                                F55B3DBA1251F12D003EF269 /* DateTimeLocalInputType.h in Headers */,
-                               45FEA5D0156DDE8C00654101 /* Decimal.h in Headers */,
                                A8C228A111D5722E00D5A7D3 /* DecodedDataDocumentParser.h in Headers */,
                                CECCFC3B141973D5002A0AC1 /* DecodeEscapeSequences.h in Headers */,
                                4162A451101145AE00DFF3ED /* DedicatedWorkerContext.h in Headers */,
                                F55B3DB51251F12D003EF269 /* DateInputType.cpp in Sources */,
                                F55B3DB71251F12D003EF269 /* DateTimeInputType.cpp in Sources */,
                                F55B3DB91251F12D003EF269 /* DateTimeLocalInputType.cpp in Sources */,
-                               45FEA5CF156DDE8C00654101 /* Decimal.cpp in Sources */,
                                A8C228A211D5722E00D5A7D3 /* DecodedDataDocumentParser.cpp in Sources */,
                                4162A450101145AE00DFF3ED /* DedicatedWorkerContext.cpp in Sources */,
                                41A3D58E101C152D00316D07 /* DedicatedWorkerThread.cpp in Sources */,
diff --git a/Source/WebCore/platform/Decimal.cpp b/Source/WebCore/platform/Decimal.cpp
deleted file mode 100644 (file)
index 2061ded..0000000
+++ /dev/null
@@ -1,1007 +0,0 @@
-/*
- * Copyright (C) 2012 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "Decimal.h"
-
-#include <algorithm>
-#include <float.h>
-
-#include <wtf/Assertions.h>
-#include <wtf/MathExtras.h>
-#include <wtf/Noncopyable.h>
-#include <wtf/text/StringBuilder.h>
-
-namespace WebCore {
-
-namespace DecimalPrivate {
-
-static int const ExponentMax = 1023;
-static int const ExponentMin = -1023;
-static int const Precision = 18;
-
-static const uint64_t MaxCoefficient = UINT64_C(0x16345785D89FFFF); // 999999999999999999 == 18 9's
-
-// This class handles Decimal special values.
-class SpecialValueHandler {
-    WTF_MAKE_NONCOPYABLE(SpecialValueHandler);
-public:
-    enum HandleResult {
-        BothFinite,
-        BothInfinity,
-        EitherNaN,
-        LHSIsInfinity,
-        RHSIsInfinity,
-    };
-
-    SpecialValueHandler(const Decimal& lhs, const Decimal& rhs);
-    HandleResult handle();
-    Decimal value() const;
-
-private:
-    enum Result {
-        ResultIsLHS,
-        ResultIsRHS,
-        ResultIsUnknown,
-    };
-
-    const Decimal& m_lhs;
-    const Decimal& m_rhs;
-    Result m_result;
-};
-
-SpecialValueHandler::SpecialValueHandler(const Decimal& lhs, const Decimal& rhs)
-    : m_lhs(lhs), m_rhs(rhs), m_result(ResultIsUnknown)
-{
-}
-
-SpecialValueHandler::HandleResult SpecialValueHandler::handle()
-{
-    if (m_lhs.isFinite() && m_rhs.isFinite())
-        return BothFinite;
-
-    const Decimal::EncodedData::FormatClass lhsClass = m_lhs.value().formatClass();
-    const Decimal::EncodedData::FormatClass rhsClass = m_rhs.value().formatClass();
-    if (lhsClass == Decimal::EncodedData::ClassNaN) {
-        m_result = ResultIsLHS;
-        return EitherNaN;
-     }
-
-    if (rhsClass == Decimal::EncodedData::ClassNaN) {
-        m_result = ResultIsRHS;
-        return EitherNaN;
-     }
-
-    if (lhsClass == Decimal::EncodedData::ClassInfinity)
-        return rhsClass == Decimal::EncodedData::ClassInfinity ? BothInfinity : LHSIsInfinity;
-
-    if (rhsClass == Decimal::EncodedData::ClassInfinity)
-        return RHSIsInfinity;
-
-    ASSERT_NOT_REACHED();
-    return BothFinite;
-}
-
-Decimal SpecialValueHandler::value() const
-{
-    switch (m_result) {
-    case ResultIsLHS:
-        return m_lhs;
-    case ResultIsRHS:
-        return m_rhs;
-    case ResultIsUnknown:
-    default:
-        ASSERT_NOT_REACHED();
-        return m_lhs;
-    }
-}
-
-// This class is used for 128 bit unsigned integer arithmetic.
-class UInt128 {
-public:
-    UInt128(uint64_t low, uint64_t high)
-        : m_high(high), m_low(low)
-    {
-    }
-
-    UInt128& operator/=(uint32_t);
-
-    uint64_t high() const { return m_high; }
-    uint64_t low() const { return m_low; }
-
-    static UInt128 multiply(uint64_t u, uint64_t v) { return UInt128(u * v, multiplyHigh(u, v)); }
-
-private:
-    static uint32_t highUInt32(uint64_t x) { return static_cast<uint32_t>(x >> 32); }
-    static uint32_t lowUInt32(uint64_t x) { return static_cast<uint32_t>(x & ((static_cast<uint64_t>(1) << 32) - 1)); }
-    bool isZero() const { return !m_low && !m_high; }
-    static uint64_t makeUInt64(uint32_t low, uint32_t high) { return low | (static_cast<uint64_t>(high) << 32); }
-
-    static uint64_t multiplyHigh(uint64_t, uint64_t);
-
-    uint64_t m_high;
-    uint64_t m_low;
-};
-
-UInt128& UInt128::operator/=(const uint32_t divisor)
-{
-    ASSERT(divisor);
-
-    if (!m_high) {
-        m_low /= divisor;
-        return *this;
-    }
-
-    uint32_t dividend[4];
-    dividend[0] = lowUInt32(m_low);
-    dividend[1] = highUInt32(m_low);
-    dividend[2] = lowUInt32(m_high);
-    dividend[3] = highUInt32(m_high);
-
-    uint32_t quotient[4];
-    uint32_t remainder = 0;
-    for (int i = 3; i >= 0; --i) {
-        const uint64_t work = makeUInt64(remainder, dividend[i]);
-        remainder = static_cast<uint32_t>(work % divisor);
-        quotient[i] = static_cast<uint32_t>(work / divisor);
-    }
-    m_low = makeUInt64(quotient[0], quotient[1]);
-    m_high = makeUInt64(quotient[2], quotient[3]);
-    return *this;
-}
-
-// Returns high 64bit of 128bit product.
-uint64_t UInt128::multiplyHigh(uint64_t u, uint64_t v)
-{
-    const uint64_t uLow = lowUInt32(u);
-    const uint64_t uHigh = highUInt32(u);
-    const uint64_t vLow = lowUInt32(v);
-    const uint64_t vHigh = highUInt32(v);
-    const uint64_t partialProduct = uHigh * vLow + highUInt32(uLow * vLow);
-    return uHigh * vHigh + highUInt32(partialProduct) + highUInt32(uLow * vHigh + lowUInt32(partialProduct));
-}
-
-static int countDigits(uint64_t x)
-{
-    int numberOfDigits = 0;
-    for (uint64_t powerOfTen = 1; x >= powerOfTen; powerOfTen *= 10) {
-        ++numberOfDigits;
-        if (powerOfTen >= std::numeric_limits<uint64_t>::max() / 10)
-            break;
-    }
-    return numberOfDigits;
-}
-
-static uint64_t scaleDown(uint64_t x, int n)
-{
-    ASSERT(n >= 0);
-    while (n > 0 && x) {
-        x /= 10;
-        --n;
-    }
-    return x;
-}
-
-static uint64_t scaleUp(uint64_t x, int n)
-{
-    ASSERT(n >= 0);
-    ASSERT(n < Precision);
-
-    uint64_t y = 1;
-    uint64_t z = 10;
-    for (;;) {
-        if (n & 1)
-            y = y * z;
-
-        n >>= 1;
-        if (!n)
-            return x * y;
-
-        z = z * z;
-    }
-}
-
-} // namespace DecimalPrivate
-
-using namespace DecimalPrivate;
-
-Decimal::EncodedData::EncodedData(Sign sign, FormatClass formatClass)
-    : m_coefficient(0)
-    , m_exponent(0)
-    , m_formatClass(formatClass)
-    , m_sign(sign)
-{
-}
-
-Decimal::EncodedData::EncodedData(Sign sign, int exponent, uint64_t coefficient)
-    : m_formatClass(coefficient ? ClassNormal : ClassZero)
-    , m_sign(sign)
-{
-    if (exponent >= ExponentMin && exponent <= ExponentMax) {
-        while (coefficient >= MaxCoefficient) {
-            coefficient /= 10;
-            ++exponent;
-        }
-    }
-
-    if (exponent > ExponentMax) {
-        m_coefficient = 0;
-        m_exponent = 0;
-        m_formatClass = ClassInfinity;
-        return;
-    }
-
-    if (exponent < ExponentMin) {
-        m_coefficient = 0;
-        m_exponent = 0;
-        m_formatClass = ClassZero;
-        return;
-    }
-
-    m_coefficient = coefficient;
-    m_exponent = static_cast<int16_t>(exponent);
-}
-
-bool Decimal::EncodedData::operator==(const EncodedData& another) const
-{
-    return m_sign == another.m_sign
-        && m_formatClass == another.m_formatClass
-        && m_exponent == another.m_exponent
-        && m_coefficient == another.m_coefficient;
-}
-
-Decimal::Decimal(int32_t i32)
-    : m_data(i32 < 0 ? Negative : Positive, 0, static_cast<uint32_t>(i32 < 0 ? -i32 : i32))
-{
-}
-
-Decimal::Decimal(Sign sign, int exponent, uint64_t coefficient)
-    : m_data(sign, exponent, coefficient)
-{
-}
-
-Decimal::Decimal(const EncodedData& data)
-    : m_data(data)
-{
-}
-
-Decimal::Decimal(const Decimal& other)
-    : m_data(other.m_data)
-{
-}
-
-Decimal& Decimal::operator=(const Decimal& other)
-{
-    m_data = other.m_data;
-    return *this;
-}
-
-Decimal& Decimal::operator+=(const Decimal& other)
-{
-    m_data = (*this + other).m_data;
-    return *this;
-}
-
-Decimal& Decimal::operator-=(const Decimal& other)
-{
-    m_data = (*this - other).m_data;
-    return *this;
-}
-
-Decimal& Decimal::operator*=(const Decimal& other)
-{
-    m_data = (*this * other).m_data;
-    return *this;
-}
-
-Decimal& Decimal::operator/=(const Decimal& other)
-{
-    m_data = (*this / other).m_data;
-    return *this;
-}
-
-Decimal Decimal::operator-() const
-{
-    if (isNaN())
-        return *this;
-
-    Decimal result(*this);
-    result.m_data.setSign(invertSign(m_data.sign()));
-    return result;
-}
-
-Decimal Decimal::operator+(const Decimal& rhs) const
-{
-    const Decimal& lhs = *this;
-    const Sign lhsSign = lhs.sign();
-    const Sign rhsSign = rhs.sign();
-
-    SpecialValueHandler handler(lhs, rhs);
-    switch (handler.handle()) {
-    case SpecialValueHandler::BothFinite:
-        break;
-
-    case SpecialValueHandler::BothInfinity:
-        return lhsSign == rhsSign ? lhs : nan();
-
-    case SpecialValueHandler::EitherNaN:
-        return handler.value();
-
-    case SpecialValueHandler::LHSIsInfinity:
-        return lhs;
-
-    case SpecialValueHandler::RHSIsInfinity:
-        return rhs;
-    }
-
-    const AlignedOperands alignedOperands = alignOperands(lhs, rhs);
-
-    const uint64_t result = lhsSign == rhsSign
-        ? alignedOperands.lhsCoefficient + alignedOperands.rhsCoefficient
-        : alignedOperands.lhsCoefficient - alignedOperands.rhsCoefficient;
-
-    if (lhsSign == Negative && rhsSign == Positive && !result)
-        return Decimal(Positive, alignedOperands.exponent, 0);
-
-    return static_cast<int64_t>(result) >= 0
-        ? Decimal(lhsSign, alignedOperands.exponent, result)
-        : Decimal(invertSign(lhsSign), alignedOperands.exponent, -static_cast<int64_t>(result));
-}
-
-Decimal Decimal::operator-(const Decimal& rhs) const
-{
-    const Decimal& lhs = *this;
-    const Sign lhsSign = lhs.sign();
-    const Sign rhsSign = rhs.sign();
-
-    SpecialValueHandler handler(lhs, rhs);
-    switch (handler.handle()) {
-    case SpecialValueHandler::BothFinite:
-        break;
-
-    case SpecialValueHandler::BothInfinity:
-        return lhsSign == rhsSign ? nan() : lhs;
-
-    case SpecialValueHandler::EitherNaN:
-        return handler.value();
-
-    case SpecialValueHandler::LHSIsInfinity:
-        return lhs;
-
-    case SpecialValueHandler::RHSIsInfinity:
-        return infinity(invertSign(rhsSign));
-    }
-
-    const AlignedOperands alignedOperands = alignOperands(lhs, rhs);
-
-    const uint64_t result = lhsSign == rhsSign
-        ? alignedOperands.lhsCoefficient - alignedOperands.rhsCoefficient
-        : alignedOperands.lhsCoefficient + alignedOperands.rhsCoefficient;
-
-    if (lhsSign == Negative && rhsSign == Negative && !result)
-        return Decimal(Positive, alignedOperands.exponent, 0);
-
-    return static_cast<int64_t>(result) >= 0
-        ? Decimal(lhsSign, alignedOperands.exponent, result)
-        : Decimal(invertSign(lhsSign), alignedOperands.exponent, -static_cast<int64_t>(result));
-}
-
-Decimal Decimal::operator*(const Decimal& rhs) const
-{
-    const Decimal& lhs = *this;
-    const Sign lhsSign = lhs.sign();
-    const Sign rhsSign = rhs.sign();
-    const Sign resultSign = lhsSign == rhsSign ? Positive : Negative;
-
-    SpecialValueHandler handler(lhs, rhs);
-    switch (handler.handle()) {
-    case SpecialValueHandler::BothFinite: {
-        const uint64_t lhsCoefficient = lhs.m_data.coefficient();
-        const uint64_t rhsCoefficient = rhs.m_data.coefficient();
-        int resultExponent = lhs.exponent() + rhs.exponent();
-        UInt128 work(UInt128::multiply(lhsCoefficient, rhsCoefficient));
-        while (work.high()) {
-            work /= 10;
-            ++resultExponent;
-        }
-        return Decimal(resultSign, resultExponent, work.low());
-    }
-
-    case SpecialValueHandler::BothInfinity:
-        return infinity(resultSign);
-
-    case SpecialValueHandler::EitherNaN:
-        return handler.value();
-
-    case SpecialValueHandler::LHSIsInfinity:
-        return rhs.isZero() ? nan() : infinity(resultSign);
-
-    case SpecialValueHandler::RHSIsInfinity:
-        return lhs.isZero() ? nan() : infinity(resultSign);
-    }
-
-    ASSERT_NOT_REACHED();
-    return nan();
-}
-
-Decimal Decimal::operator/(const Decimal& rhs) const
-{
-    const Decimal& lhs = *this;
-    const Sign lhsSign = lhs.sign();
-    const Sign rhsSign = rhs.sign();
-    const Sign resultSign = lhsSign == rhsSign ? Positive : Negative;
-
-    SpecialValueHandler handler(lhs, rhs);
-    switch (handler.handle()) {
-    case SpecialValueHandler::BothFinite:
-        break;
-
-    case SpecialValueHandler::BothInfinity:
-        return nan();
-
-    case SpecialValueHandler::EitherNaN:
-        return handler.value();
-
-    case SpecialValueHandler::LHSIsInfinity:
-        return infinity(resultSign);
-
-    case SpecialValueHandler::RHSIsInfinity:
-        return zero(resultSign);
-    }
-
-    ASSERT(lhs.isFinite());
-    ASSERT(rhs.isFinite());
-
-    if (rhs.isZero())
-        return lhs.isZero() ? nan() : infinity(resultSign);
-
-    int resultExponent = lhs.exponent() - rhs.exponent();
-
-    if (lhs.isZero())
-        return Decimal(resultSign, resultExponent, 0);
-
-    uint64_t remainder = lhs.m_data.coefficient();
-    const uint64_t divisor = rhs.m_data.coefficient();
-    uint64_t result = 0;
-    while (result < MaxCoefficient / 100) {
-        while (remainder < divisor) {
-            remainder *= 10;
-            result *= 10;
-            --resultExponent;
-        }
-        result += remainder / divisor;
-        remainder %= divisor;
-        if (!remainder)
-            break;
-    }
-
-    if (remainder > divisor / 2)
-        ++result;
-
-    return Decimal(resultSign, resultExponent, result);
-}
-
-bool Decimal::operator==(const Decimal& rhs) const
-{
-    return m_data == rhs.m_data || compareTo(rhs).isZero();
-}
-
-bool Decimal::operator!=(const Decimal& rhs) const
-{
-    if (m_data == rhs.m_data)
-        return false;
-    const Decimal result = compareTo(rhs);
-    if (result.isNaN())
-        return false;
-    return !result.isZero();
-}
-
-bool Decimal::operator<(const Decimal& rhs) const
-{
-    const Decimal result = compareTo(rhs);
-    if (result.isNaN())
-        return false;
-    return !result.isZero() && result.isNegative();
-}
-
-bool Decimal::operator<=(const Decimal& rhs) const
-{
-    if (m_data == rhs.m_data)
-        return true;
-    const Decimal result = compareTo(rhs);
-    if (result.isNaN())
-        return false;
-    return result.isZero() || result.isNegative();
-}
-
-bool Decimal::operator>(const Decimal& rhs) const
-{
-    const Decimal result = compareTo(rhs);
-    if (result.isNaN())
-        return false;
-    return !result.isZero() && result.isPositive();
-}
-
-bool Decimal::operator>=(const Decimal& rhs) const
-{
-    if (m_data == rhs.m_data)
-        return true;
-    const Decimal result = compareTo(rhs);
-    if (result.isNaN())
-        return false;
-    return result.isZero() || !result.isNegative();
-}
-
-Decimal Decimal::abs() const
-{
-    Decimal result(*this);
-    result.m_data.setSign(Positive);
-    return result;
-}
-
-Decimal::AlignedOperands Decimal::alignOperands(const Decimal& lhs, const Decimal& rhs)
-{
-    ASSERT(lhs.isFinite());
-    ASSERT(rhs.isFinite());
-
-    const int lhsExponent = lhs.exponent();
-    const int rhsExponent = rhs.exponent();
-    int exponent = std::min(lhsExponent, rhsExponent);
-    uint64_t lhsCoefficient = lhs.m_data.coefficient();
-    uint64_t rhsCoefficient = rhs.m_data.coefficient();
-
-    if (lhsExponent > rhsExponent) {
-        const int numberOfLHSDigits = countDigits(lhsCoefficient);
-        if (numberOfLHSDigits) {
-            const int lhsShiftAmount = lhsExponent - rhsExponent;
-            const int overflow = numberOfLHSDigits + lhsShiftAmount - Precision;
-            if (overflow <= 0)
-                lhsCoefficient = scaleUp(lhsCoefficient, lhsShiftAmount);
-            else {
-                lhsCoefficient = scaleUp(lhsCoefficient, lhsShiftAmount - overflow);
-                rhsCoefficient = scaleDown(rhsCoefficient, overflow);
-                exponent += overflow;
-            }
-        }
-
-    } else if (lhsExponent < rhsExponent) {
-        const int numberOfRHSDigits = countDigits(rhsCoefficient);
-        if (numberOfRHSDigits) {
-            const int rhsShiftAmount = rhsExponent - lhsExponent;
-            const int overflow = numberOfRHSDigits + rhsShiftAmount - Precision;
-            if (overflow <= 0)
-                rhsCoefficient = scaleUp(rhsCoefficient, rhsShiftAmount);
-            else {
-                rhsCoefficient = scaleUp(rhsCoefficient, rhsShiftAmount - overflow);
-                lhsCoefficient = scaleDown(lhsCoefficient, overflow);
-                exponent += overflow;
-            }
-        }
-    }
-
-    AlignedOperands alignedOperands;
-    alignedOperands.exponent = exponent;
-    alignedOperands.lhsCoefficient = lhsCoefficient;
-    alignedOperands.rhsCoefficient = rhsCoefficient;
-    return alignedOperands;
-}
-
-// Round toward positive infinity.
-// Note: Mac ports defines ceil(x) as wtf_ceil(x), so we can't use name "ceil" here.
-Decimal Decimal::ceiling() const
-{
-    if (isSpecial())
-        return *this;
-
-    if (exponent() >= 0)
-        return *this;
-
-    uint64_t result = m_data.coefficient();
-    const int numberOfDigits = countDigits(result);
-    const int numberOfDropDigits = -exponent();
-    if (numberOfDigits < numberOfDropDigits)
-        return zero(Positive);
-
-    result = scaleDown(result, numberOfDropDigits - 1);
-    if (sign() == Positive && result % 10 > 0)
-        result += 10;
-    result /= 10;
-    return Decimal(sign(), 0, result);
-}
-
-Decimal Decimal::compareTo(const Decimal& rhs) const
-{
-    const Decimal result(*this - rhs);
-    switch (result.m_data.formatClass()) {
-    case EncodedData::ClassInfinity:
-        return result.isNegative() ? Decimal(-1) : Decimal(1);
-
-    case EncodedData::ClassNaN:
-    case EncodedData::ClassNormal:
-        return result;
-
-    case EncodedData::ClassZero:
-        return zero(Positive);
-
-    default:
-        ASSERT_NOT_REACHED();
-        return nan();
-    }
-}
-
-// Round toward negative infinity.
-Decimal Decimal::floor() const
-{
-    if (isSpecial())
-        return *this;
-
-    if (exponent() >= 0)
-        return *this;
-
-    uint64_t result = m_data.coefficient();
-    const int numberOfDigits = countDigits(result);
-    const int numberOfDropDigits = -exponent();
-    if (numberOfDigits < numberOfDropDigits)
-        return zero(Positive);
-
-    result = scaleDown(result, numberOfDropDigits - 1);
-    if (isNegative() && result % 10 > 0)
-        result += 10;
-    result /= 10;
-    return Decimal(sign(), 0, result);
-}
-
-Decimal Decimal::fromString(const String& str)
-{
-    int exponent = 0;
-    Sign exponentSign = Positive;
-    int numberOfDigits = 0;
-    int numberOfDigitsAfterDot = 0;
-    int numberOfExtraDigits = 0;
-    Sign sign = Positive;
-
-    enum {
-        StateDigit,
-        StateDot,
-        StateDotDigit,
-        StateE,
-        StateEDigit,
-        StateESign,
-        StateSign,
-        StateStart,
-        StateZero,
-    } state = StateStart;
-
-#define HandleCharAndBreak(expected, nextState) \
-    if (ch == expected) { \
-        state = nextState; \
-        break; \
-    }
-
-#define HandleTwoCharsAndBreak(expected1, expected2, nextState) \
-    if (ch == expected1 || ch == expected2) { \
-        state = nextState; \
-        break; \
-    }
-
-    uint64_t accumulator = 0;
-    for (unsigned index = 0; index < str.length(); ++index) {
-        const int ch = str[index];
-        switch (state) {
-        case StateDigit:
-            if (ch >= '0' && ch <= '9') {
-                if (numberOfDigits < Precision) {
-                    ++numberOfDigits;
-                    accumulator *= 10;
-                    accumulator += ch - '0';
-                } else
-                    ++numberOfExtraDigits;
-                break;
-            }
-
-            HandleCharAndBreak('.', StateDot);
-            HandleTwoCharsAndBreak('E', 'e', StateE);
-            return nan();
-
-        case StateDot:
-            if (ch >= '0' && ch <= '9') {
-                if (numberOfDigits < Precision) {
-                    ++numberOfDigits;
-                    ++numberOfDigitsAfterDot;
-                    accumulator *= 10;
-                    accumulator += ch - '0';
-                }
-                state = StateDotDigit;
-                break;
-            }
-
-        case StateDotDigit:
-            if (ch >= '0' && ch <= '9') {
-                if (numberOfDigits < Precision) {
-                    ++numberOfDigits;
-                    ++numberOfDigitsAfterDot;
-                    accumulator *= 10;
-                    accumulator += ch - '0';
-                }
-                break;
-            }
-
-            HandleTwoCharsAndBreak('E', 'e', StateE);
-            return nan();
-
-        case StateE:
-            if (ch == '+') {
-                exponentSign = Positive;
-                state = StateESign;
-                break;
-            }
-
-            if (ch == '-') {
-                exponentSign = Negative;
-                state = StateESign;
-                break;
-            }
-
-            if (ch >= '0' && ch <= '9') {
-                exponent = ch - '0';
-                state = StateEDigit;
-                break;
-            }
-
-            return nan();
-
-        case StateEDigit:
-            if (ch >= '0' && ch <= '9') {
-                exponent *= 10;
-                exponent += ch - '0';
-                if (exponent > ExponentMax + Precision) {
-                    if (accumulator)
-                        return exponentSign == Negative ? zero(Positive) : infinity(sign);
-                    return zero(sign);
-                }
-                state = StateEDigit;
-                break;
-            }
-
-            return nan();
-
-        case StateESign:
-            if (ch >= '0' && ch <= '9') {
-                exponent = ch - '0';
-                state = StateEDigit;
-                break;
-            }
-
-            return nan();
-
-        case StateSign:
-            if (ch >= '1' && ch <= '9') {
-                accumulator = ch - '0';
-                numberOfDigits = 1;
-                state = StateDigit;
-                break;
-            }
-
-            HandleCharAndBreak('0', StateZero);
-            return nan();
-
-        case StateStart:
-            if (ch >= '1' && ch <= '9') {
-                accumulator = ch - '0';
-                numberOfDigits = 1;
-                state = StateDigit;
-                break;
-            }
-
-            if (ch == '-') {
-                sign = Negative;
-                state = StateSign;
-                break;
-            }
-
-            if (ch == '+') {
-                sign = Positive;
-                state = StateSign;
-                break;
-            }
-
-            HandleCharAndBreak('0', StateZero);
-            HandleCharAndBreak('.', StateDot);
-            return nan();
-
-        case StateZero:
-            if (ch == '0')
-                break;
-
-            if (ch >= '1' && ch <= '9') {
-                accumulator = ch - '0';
-                numberOfDigits = 1;
-                state = StateDigit;
-                break;
-            }
-
-            HandleCharAndBreak('.', StateDot);
-            HandleTwoCharsAndBreak('E', 'e', StateE);
-            return nan();
-
-        default:
-            ASSERT_NOT_REACHED();
-            return nan();
-        }
-    }
-
-    if (state == StateZero)
-        return zero(sign);
-
-    if (state == StateDigit || state == StateEDigit || state == StateDotDigit) {
-        int resultExponent = exponent * (exponentSign == Negative ? -1 : 1) - numberOfDigitsAfterDot + numberOfExtraDigits;
-        if (resultExponent < ExponentMin)
-            return zero(Positive);
-
-        const int overflow = resultExponent - ExponentMax + 1;
-        if (overflow > 0) {
-            if (overflow + numberOfDigits - numberOfDigitsAfterDot > Precision)
-                return infinity(sign);
-            accumulator = scaleUp(accumulator, overflow);
-            resultExponent -= overflow;
-        }
-
-        return Decimal(sign, resultExponent, accumulator);
-    }
-
-    return nan();
-}
-
-Decimal Decimal::infinity(const Sign sign)
-{
-    return Decimal(EncodedData(sign, EncodedData::ClassInfinity));
-}
-
-Decimal Decimal::nan()
-{
-    return Decimal(EncodedData(Positive, EncodedData::ClassNaN));
-}
-
-Decimal Decimal::remainder(const Decimal& rhs) const
-{
-    const Decimal quotient = (*this / rhs).round();
-    return quotient.isSpecial() ? quotient : *this - quotient * rhs;
-}
-
-Decimal Decimal::round() const
-{
-    if (isSpecial())
-        return *this;
-
-    if (exponent() >= 0)
-        return *this;
-
-    uint64_t result = m_data.coefficient();
-    const int numberOfDigits = countDigits(result);
-    const int numberOfDropDigits = -exponent();
-    if (numberOfDigits < numberOfDropDigits)
-        return zero(Positive);
-
-    result = scaleDown(result, numberOfDropDigits - 1);
-    if (result % 10 >= 5)
-        result += 10;
-    result /= 10;
-    return Decimal(sign(), 0, result);
-}
-
-String Decimal::toString() const
-{
-    switch (m_data.formatClass()) {
-    case EncodedData::ClassInfinity:
-        return sign() ? "-Infinity" : "Infinity";
-
-    case EncodedData::ClassNaN:
-        return "NaN";
-
-    case EncodedData::ClassNormal:
-    case EncodedData::ClassZero:
-        break;
-
-    default:
-        ASSERT_NOT_REACHED();
-        return "";
-    }
-
-    StringBuilder builder;
-    if (sign())
-        builder.append('-');
-
-    int originalExponent = exponent();
-
-    const int maxDigits = DBL_DIG;
-    uint64_t coefficient = m_data.coefficient();
-    int lastDigit = 0;
-    while (countDigits(coefficient) > maxDigits) {
-        lastDigit = coefficient % 10;
-        coefficient /= 10;
-        ++originalExponent;
-    }
-
-    if (lastDigit >= 5)
-        ++coefficient;
-
-    while (originalExponent < 0 && coefficient && !(coefficient % 10)) {
-        coefficient /= 10;
-        ++originalExponent;
-    }
-
-    const String digits = String::number(coefficient);
-    int coefficientLength = static_cast<int>(digits.length());
-    const int adjustedExponent = originalExponent + coefficientLength - 1;
-    if (originalExponent <= 0 && adjustedExponent >= -6) {
-        if (!originalExponent) {
-            builder.append(digits);
-            return builder.toString();
-        }
-
-        if (adjustedExponent >= 0) {
-            for (int i = 0; i < coefficientLength; ++i) {
-                builder.append(digits[i]);
-                if (i == adjustedExponent)
-                    builder.append('.');
-            }
-            return builder.toString();
-        }
-
-        builder.append("0.");
-        for (int i = adjustedExponent + 1; i < 0; ++i)
-            builder.append('0');
-
-        builder.append(digits);
-
-    } else {
-        builder.append(digits[0]);
-        while (coefficientLength >= 2 && digits[coefficientLength - 1] == '0')
-            --coefficientLength;
-        if (coefficientLength >= 2) {
-            builder.append('.');
-            for (int i = 1; i < coefficientLength; ++i)
-                builder.append(digits[i]);
-        }
-
-        if (adjustedExponent) {
-            builder.append(adjustedExponent < 0 ? "e" : "e+");
-            builder.append(String::number(adjustedExponent));
-        }
-    }
-    return builder.toString();
-}
-
-Decimal Decimal::zero(Sign sign)
-{
-    return Decimal(EncodedData(sign, EncodedData::ClassZero));
-}
-
-} // namespace WebCore
diff --git a/Source/WebCore/platform/Decimal.h b/Source/WebCore/platform/Decimal.h
deleted file mode 100644 (file)
index dc4c8e3..0000000
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * Copyright (C) 2012 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef Decimal_h
-#define Decimal_h
-
-#include <stdint.h>
-#include <wtf/Assertions.h>
-#include <wtf/text/WTFString.h>
-
-namespace WebCore {
-
-namespace DecimalPrivate {
-class SpecialValueHandler;
-}
-
-// This class represents decimal base floating point number.
-//
-// FIXME: Once all C++ compiler support decimal type, we should replace this
-// class to compiler supported one. See below URI for current status of decimal
-// type for C++: // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1977.html
-class Decimal {
-public:
-    enum Sign {
-        Positive,
-        Negative,
-    };
-
-    // You should not use EncodedData other than unit testing.
-    class EncodedData {
-        // For accessing FormatClass.
-        friend class Decimal;
-        friend class DecimalPrivate::SpecialValueHandler;
-    public:
-        EncodedData(Sign, int exponent, uint64_t coefficient);
-
-        bool operator==(const EncodedData&) const;
-        bool operator!=(const EncodedData& another) const { return !operator==(another); }
-
-        uint64_t coefficient() const { return m_coefficient; }
-        int countDigits() const;
-        int exponent() const { return m_exponent; }
-        bool isFinite() const { return !isSpecial(); }
-        bool isNaN() const { return m_formatClass == ClassNaN; }
-        bool isSpecial() const { return m_formatClass == ClassInfinity || m_formatClass == ClassNaN; }
-        bool isZero() const { return m_formatClass == ClassZero; }
-        Sign sign() const { return m_sign; }
-        void setSign(Sign sign) { m_sign = sign; }
-
-    private:
-        enum FormatClass {
-            ClassInfinity,
-            ClassNormal,
-            ClassNaN,
-            ClassZero,
-        };
-
-        EncodedData(Sign, FormatClass);
-        FormatClass formatClass() const { return m_formatClass; }
-
-        uint64_t m_coefficient;
-        int16_t m_exponent;
-        FormatClass m_formatClass;
-        Sign m_sign;
-    };
-
-    Decimal(int32_t = 0);
-    Decimal(Sign, int exponent, uint64_t coefficient);
-    Decimal(const Decimal&);
-
-    Decimal& operator=(const Decimal&);
-    Decimal& operator+=(const Decimal&);
-    Decimal& operator-=(const Decimal&);
-    Decimal& operator*=(const Decimal&);
-    Decimal& operator/=(const Decimal&);
-
-    Decimal operator-() const;
-
-    bool operator==(const Decimal&) const;
-    bool operator!=(const Decimal&) const;
-    bool operator<(const Decimal&) const;
-    bool operator<=(const Decimal&) const;
-    bool operator>(const Decimal&) const;
-    bool operator>=(const Decimal&) const;
-
-    Decimal operator+(const Decimal&) const;
-    Decimal operator-(const Decimal&) const;
-    Decimal operator*(const Decimal&) const;
-    Decimal operator/(const Decimal&) const;
-
-    bool isFinite() const { return m_data.isFinite(); }
-    bool isNaN() const { return m_data.isNaN(); }
-    bool isNegative() const { return sign() == Negative; }
-    bool isPositive() const { return sign() == Positive; }
-    bool isSpecial() const { return m_data.isSpecial(); }
-    bool isZero() const { return m_data.isZero(); }
-
-    Decimal abs() const;
-    Decimal ceiling() const;
-    Decimal floor() const;
-    Decimal remainder(const Decimal&) const;
-    Decimal round() const;
-
-    // Note: toString method supports infinity and nan but fromString not.
-    String toString() const;
-
-    // fromString supports following syntax EBNF:
-    //  number ::= sign? digit+ ('.' digit*) (exponent-marker sign? digit+)?
-    //          | sign? '.' digit+ (exponent-marker sign? digit+)?
-    //  sign ::= '+' | '-'
-    //  exponent-marker ::= 'e' | 'E'
-    //  digit ::= '0' | '1' | ... | '9'
-    // Note: fromString doesn't support "infinity" and "nan".
-    static Decimal fromString(const String&);
-    static Decimal infinity(Sign);
-    static Decimal nan();
-    static Decimal zero(Sign);
-
-    // You should not use below methods. We expose them for unit testing.
-    explicit Decimal(const EncodedData&);
-    const EncodedData& value() const { return m_data; }
-
-private:
-    struct AlignedOperands {
-        uint64_t lhsCoefficient;
-        uint64_t rhsCoefficient;
-        int exponent;
-    };
-
-    Decimal(double);
-    Decimal compareTo(const Decimal&) const;
-
-    static AlignedOperands alignOperands(const Decimal& lhs, const Decimal& rhs);
-    static inline Sign invertSign(Sign sign) { return sign == Negative ? Positive : Negative; }
-
-    int exponent() const
-    {
-        ASSERT(isFinite());
-        return m_data.exponent();
-    }
-
-    Sign sign() const { return m_data.sign(); }
-
-    EncodedData m_data;
-};
-
-} // namespace WebCore
-
-#endif // Decimal_h
index 21f03a9..c6bbd0e 100644 (file)
@@ -1,3 +1,16 @@
+2012-05-31  Kent Tamura  <tkent@chromium.org>
+
+        Unreviewed, rolling out r119062 and r119064.
+        http://trac.webkit.org/changeset/119062
+        http://trac.webkit.org/changeset/119064
+        https://bugs.webkit.org/show_bug.cgi?id=87360
+
+        Broke build on Lion, SnowLoepard, Chromium Windows, and
+        Chromium Linux 32
+
+        * WebKit.gypi:
+        * tests/DecimalTest.cpp: Removed.
+
 2012-05-30  Yoshifumi Inoue  <yosin@chromium.org>
 
         [Platform] Introduce Decimal class for Number/Range input type.
index 30c5313..1a688bb 100644 (file)
@@ -95,7 +95,6 @@
             'tests/ClipboardChromiumTest.cpp',
             'tests/CompositorFakeGraphicsContext3D.h',
             'tests/CompositorFakeWebGraphicsContext3D.h',
-            'tests/DecimalTest.cpp',
             'tests/DragImageTest.cpp',
             'tests/DrawingBufferChromiumTest.cpp',
             'tests/EventListenerTest.cpp',
diff --git a/Source/WebKit/chromium/tests/DecimalTest.cpp b/Source/WebKit/chromium/tests/DecimalTest.cpp
deleted file mode 100644 (file)
index 4837a6a..0000000
+++ /dev/null
@@ -1,971 +0,0 @@
-/*
- * Copyright (C) 2012 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "Decimal.h"
-
-#include <gtest/gtest.h>
-#include <wtf/MathExtras.h>
-#include <wtf/text/CString.h>
-
-namespace WebCore {
-
-std::ostream& operator<<(std::ostream& os, const Decimal& decimal)
-{
-    Decimal::EncodedData data = decimal.value();
-    return os 
-        << "encode(" << String::number(data.coefficient()).ascii().data()
-        << ", " << String::number(data.exponent()).ascii().data()
-        << ", " << (data.sign() == Decimal::Negative ? "Negative" : "Positive")
-        << ")=" << decimal.toString().ascii().data();
-}
-
-} // namespace WebCore
-
-using namespace WebCore;
-
-// Simulate WebCore/html/StepRange
-class DecimalStepRange {
-public:
-    Decimal maximum;
-    Decimal minimum;
-    Decimal step;
-
-    DecimalStepRange(const Decimal& minimum, const Decimal& maximum, const Decimal& step)
-        : maximum(maximum)
-        , minimum(minimum)
-        , step(step)
-    {
-    }
-
-    Decimal clampValue(Decimal value) const
-    {
-        const Decimal result = minimum + ((value - minimum) / step).round() * step;
-        ASSERT(result.isFinite());
-        return result > maximum ? result - step : result;
-    }
-};
-
-class DecimalTest : public ::testing::Test {
-protected:
-    typedef Decimal::Sign Sign;
-    protected: static const Sign Positive = Decimal::Positive;
-    protected: static const Sign Negative = Decimal::Negative;
-
-    Decimal encode(uint64_t coefficient, int exponent, Sign sign)
-    {
-        return Decimal(sign, exponent, coefficient);
-    }
-
-    protected: Decimal fromString(const String& string)
-    {
-        return Decimal::fromString(string);
-    }
-
-    protected: String stepDown(const String& minimum, const String& maximum, const String& step, const String& valueString, int numberOfStepTimes)
-    {
-        DecimalStepRange stepRange(fromString(minimum), fromString(maximum), fromString(step));
-        Decimal value = fromString(valueString);
-        for (int i = 0; i < numberOfStepTimes; ++i) {
-            value -= stepRange.step;
-            value = stepRange.clampValue(value);
-        }
-        return value.toString();
-    }
-
-    protected: String stepUp(const String& minimum, const String& maximum, const String& step, const String& valueString, int numberOfStepTimes)
-    {
-        DecimalStepRange stepRange(fromString(minimum), fromString(maximum), fromString(step));
-        Decimal value = fromString(valueString);
-        for (int i = 0; i < numberOfStepTimes; ++i) {
-            value += stepRange.step;
-            value = stepRange.clampValue(value);
-        }
-        return value.toString();
-    }
-};
-
-TEST_F(DecimalTest, Abs)
-{
-    EXPECT_EQ(encode(0, 0, Positive), encode(0, 0, Positive).abs());
-    EXPECT_EQ(encode(0, 0, Positive), encode(0, 0, Negative).abs());
-
-    EXPECT_EQ(encode(0, 10, Positive), encode(0, 10, Positive).abs());
-    EXPECT_EQ(encode(0, 10, Positive), encode(0, 10, Negative).abs());
-
-    EXPECT_EQ(encode(0, -10, Positive), encode(0, -10, Positive).abs());
-    EXPECT_EQ(encode(0, -10, Positive), encode(0, -10, Negative).abs());
-
-    EXPECT_EQ(encode(1, 0, Positive), encode(1, 0, Positive).abs());
-    EXPECT_EQ(encode(1, 0, Positive), encode(1, 0, Negative).abs());
-
-    EXPECT_EQ(encode(1, 10, Positive), encode(1, 10, Positive).abs());
-    EXPECT_EQ(encode(1, 10, Positive), encode(1, 10, Negative).abs());
-
-    EXPECT_EQ(encode(1, -10, Positive), encode(1, -10, Positive).abs());
-    EXPECT_EQ(encode(1, -10, Positive), encode(1, -10, Negative).abs());
-}
-
-TEST_F(DecimalTest, AbsBigExponent)
-{
-    EXPECT_EQ(encode(1, 1000, Positive), encode(1, 1000, Positive).abs());
-    EXPECT_EQ(encode(1, 1000, Positive), encode(1, 1000, Negative).abs());
-}
-
-TEST_F(DecimalTest, AbsSmallExponent)
-{
-    EXPECT_EQ(encode(1, -1000, Positive), encode(1, -1000, Positive).abs());
-    EXPECT_EQ(encode(1, -1000, Positive), encode(1, -1000, Negative).abs());
-}
-
-TEST_F(DecimalTest, AbsSpecialValues)
-{
-    EXPECT_EQ(Decimal::infinity(Positive), Decimal::infinity(Positive).abs());
-    EXPECT_EQ(Decimal::infinity(Positive), Decimal::infinity(Negative).abs());
-    EXPECT_EQ(Decimal::nan(), Decimal::nan().abs());
-}
-
-TEST_F(DecimalTest, Add)
-{
-    EXPECT_EQ(encode(0, 0, Positive), Decimal(0) + Decimal(0));
-    EXPECT_EQ(Decimal(1), Decimal(2) + Decimal(-1));
-    EXPECT_EQ(Decimal(1), Decimal(-1) + Decimal(2));
-    EXPECT_EQ(encode(100, 0, Positive), Decimal(99) + Decimal(1));
-    EXPECT_EQ(encode(100, 0, Negative), Decimal(-50) + Decimal(-50));
-    EXPECT_EQ(encode(1000000000000000, 35, Positive), encode(1, 50, Positive) + Decimal(1));
-    EXPECT_EQ(encode(1000000000000000, 35, Positive), Decimal(1) + encode(1, 50, Positive));
-    EXPECT_EQ(encode(10000000001, 0, Positive), encode(1, 10, Positive) + Decimal(1));
-    EXPECT_EQ(encode(10000000001, 0, Positive), Decimal(1) + encode(1, 10, Positive));
-    EXPECT_EQ(encode(1, 0, Positive), encode(1, -1022, Positive) + encode(1, 0, Positive));
-    EXPECT_EQ(encode(2, -1022, Positive), encode(1, -1022, Positive) + encode(1, -1022, Positive));
-}
-
-TEST_F(DecimalTest, AddBigExponent)
-{
-    EXPECT_EQ(encode(1, 1022, Positive), encode(1, 1022, Positive) + encode(1, 0, Positive));
-    EXPECT_EQ(encode(2, 1022, Positive), encode(1, 1022, Positive) + encode(1, 1022, Positive));
-    EXPECT_EQ(Decimal::infinity(Positive), encode(std::numeric_limits<uint64_t>::max(), 1022, Positive) + encode(1, 0, Positive));
-    EXPECT_EQ(encode(1, 1022, Positive), encode(1, 1022, Positive) + encode(1, -1000, Positive));
-}
-
-TEST_F(DecimalTest, AddSmallExponent)
-{
-    EXPECT_EQ(encode(1, 0, Positive), encode(1, -1022, Positive) + encode(1, 0, Positive));
-    EXPECT_EQ(encode(2, -1022, Positive), encode(1, -1022, Positive) + encode(1, -1022, Positive));
-}
-
-TEST_F(DecimalTest, AddSpecialValues)
-{
-    const Decimal Infinity(Decimal::infinity(Positive));
-    const Decimal MinusInfinity(Decimal::infinity(Negative));
-    const Decimal NaN(Decimal::nan());
-    const Decimal Ten(10);
-
-    EXPECT_EQ(Infinity, Infinity + Infinity);
-    EXPECT_EQ(NaN, Infinity + MinusInfinity);
-    EXPECT_EQ(NaN, MinusInfinity + Infinity);
-    EXPECT_EQ(MinusInfinity, MinusInfinity + MinusInfinity);
-
-    EXPECT_EQ(Infinity, Infinity + Ten);
-    EXPECT_EQ(Infinity, Ten + Infinity);
-    EXPECT_EQ(MinusInfinity, MinusInfinity + Ten);
-    EXPECT_EQ(MinusInfinity, Ten + MinusInfinity);
-
-    EXPECT_EQ(NaN, NaN + NaN);
-    EXPECT_EQ(NaN, NaN + Ten);
-    EXPECT_EQ(NaN, Ten + NaN);
-
-    EXPECT_EQ(NaN, NaN - Infinity);
-    EXPECT_EQ(NaN, NaN - MinusInfinity);
-    EXPECT_EQ(NaN, Infinity - NaN);
-    EXPECT_EQ(NaN, MinusInfinity - NaN);
-}
-
-TEST_F(DecimalTest, Ceiling)
-{
-    EXPECT_EQ(Decimal(1), Decimal(1).ceiling());
-    EXPECT_EQ(Decimal(2), encode(11, -1, Positive).ceiling());
-    EXPECT_EQ(Decimal(2), encode(13, -1, Positive).ceiling());
-    EXPECT_EQ(Decimal(2), encode(15, -1, Positive).ceiling());
-    EXPECT_EQ(Decimal(2), encode(19, -1, Positive).ceiling());
-
-    EXPECT_EQ(Decimal(-1), Decimal(-1).ceiling());
-    EXPECT_EQ(Decimal(-1), encode(11, -1, Negative).ceiling());
-    EXPECT_EQ(Decimal(-1), encode(13, -1, Negative).ceiling());
-    EXPECT_EQ(Decimal(-1), encode(15, -1, Negative).ceiling());
-    EXPECT_EQ(Decimal(-1), encode(19, -1, Negative).ceiling());
-}
-
-TEST_F(DecimalTest, CeilingBigExponent)
-{
-    EXPECT_EQ(encode(1, 1000, Positive), encode(1, 1000, Positive).ceiling());
-    EXPECT_EQ(encode(1, 1000, Negative), encode(1, 1000, Negative).ceiling());
-}
-
-TEST_F(DecimalTest, CeilingSmallExponent)
-{
-    EXPECT_EQ(encode(0, 0, Positive), encode(1, -1000, Positive).ceiling());
-    EXPECT_EQ(encode(0, 0, Negative), encode(1, -1000, Negative).ceiling());
-}
-
-TEST_F(DecimalTest, CeilingSpecialValues)
-{
-    EXPECT_EQ(Decimal::infinity(Positive), Decimal::infinity(Positive).ceiling());
-    EXPECT_EQ(Decimal::infinity(Negative), Decimal::infinity(Negative).ceiling());
-    EXPECT_EQ(Decimal::nan(), Decimal::nan().ceiling());
-}
-
-TEST_F(DecimalTest, Compare)
-{
-    EXPECT_TRUE(Decimal(0) == Decimal(0));
-    EXPECT_TRUE(Decimal(0) != Decimal(1));
-    EXPECT_TRUE(Decimal(0) < Decimal(1));
-    EXPECT_TRUE(Decimal(0) <= Decimal(0));
-    EXPECT_TRUE(Decimal(0) > Decimal(-1));
-    EXPECT_TRUE(Decimal(0) >= Decimal(0));
-
-    EXPECT_FALSE(Decimal(1) == Decimal(2));
-    EXPECT_FALSE(Decimal(1) != Decimal(1));
-    EXPECT_FALSE(Decimal(1) < Decimal(0));
-    EXPECT_FALSE(Decimal(1) <= Decimal(0));
-    EXPECT_FALSE(Decimal(1) > Decimal(2));
-    EXPECT_FALSE(Decimal(1) >= Decimal(2));
-}
-
-TEST_F(DecimalTest, CompareBigExponent)
-{
-    EXPECT_TRUE(encode(1, 1000, Positive) == encode(1, 1000, Positive));
-    EXPECT_FALSE(encode(1, 1000, Positive) != encode(1, 1000, Positive));
-    EXPECT_FALSE(encode(1, 1000, Positive) < encode(1, 1000, Positive));
-    EXPECT_TRUE(encode(1, 1000, Positive) <= encode(1, 1000, Positive));
-    EXPECT_FALSE(encode(1, 1000, Positive) > encode(1, 1000, Positive));
-    EXPECT_TRUE(encode(1, 1000, Positive) >= encode(1, 1000, Positive));
-
-    EXPECT_TRUE(encode(1, 1000, Negative) == encode(1, 1000, Negative));
-    EXPECT_FALSE(encode(1, 1000, Negative) != encode(1, 1000, Negative));
-    EXPECT_FALSE(encode(1, 1000, Negative) < encode(1, 1000, Negative));
-    EXPECT_TRUE(encode(1, 1000, Negative) <= encode(1, 1000, Negative));
-    EXPECT_FALSE(encode(1, 1000, Negative) > encode(1, 1000, Negative));
-    EXPECT_TRUE(encode(1, 1000, Negative) >= encode(1, 1000, Negative));
-
-    EXPECT_FALSE(encode(2, 1000, Positive) == encode(1, 1000, Positive));
-    EXPECT_TRUE(encode(2, 1000, Positive) != encode(1, 1000, Positive));
-    EXPECT_FALSE(encode(2, 1000, Positive) < encode(1, 1000, Positive));
-    EXPECT_FALSE(encode(2, 1000, Positive) <= encode(1, 1000, Positive));
-    EXPECT_TRUE(encode(2, 1000, Positive) > encode(1, 1000, Positive));
-    EXPECT_TRUE(encode(2, 1000, Positive) >= encode(1, 1000, Positive));
-
-    EXPECT_FALSE(encode(2, 1000, Negative) == encode(1, 1000, Negative));
-    EXPECT_TRUE(encode(2, 1000, Negative) != encode(1, 1000, Negative));
-    EXPECT_TRUE(encode(2, 1000, Negative) < encode(1, 1000, Negative));
-    EXPECT_TRUE(encode(2, 1000, Negative) <= encode(1, 1000, Negative));
-    EXPECT_FALSE(encode(2, 1000, Negative) > encode(1, 1000, Negative));
-    EXPECT_FALSE(encode(2, 1000, Negative) >= encode(1, 1000, Negative));
-}
-
-TEST_F(DecimalTest, CompareSmallExponent)
-{
-    EXPECT_TRUE(encode(1, -1000, Positive) == encode(1, -1000, Positive));
-    EXPECT_FALSE(encode(1, -1000, Positive) != encode(1, -1000, Positive));
-    EXPECT_FALSE(encode(1, -1000, Positive) < encode(1, -1000, Positive));
-    EXPECT_TRUE(encode(1, -1000, Positive) <= encode(1, -1000, Positive));
-    EXPECT_FALSE(encode(1, -1000, Positive) > encode(1, -1000, Positive));
-    EXPECT_TRUE(encode(1, -1000, Positive) >= encode(1, -1000, Positive));
-
-    EXPECT_TRUE(encode(1, -1000, Negative) == encode(1, -1000, Negative));
-    EXPECT_FALSE(encode(1, -1000, Negative) != encode(1, -1000, Negative));
-    EXPECT_FALSE(encode(1, -1000, Negative) < encode(1, -1000, Negative));
-    EXPECT_TRUE(encode(1, -1000, Negative) <= encode(1, -1000, Negative));
-    EXPECT_FALSE(encode(1, -1000, Negative) > encode(1, -1000, Negative));
-    EXPECT_TRUE(encode(1, -1000, Negative) >= encode(1, -1000, Negative));
-
-    EXPECT_FALSE(encode(2, -1000, Positive) == encode(1, -1000, Positive));
-    EXPECT_TRUE(encode(2, -1000, Positive) != encode(1, -1000, Positive));
-    EXPECT_FALSE(encode(2, -1000, Positive) < encode(1, -1000, Positive));
-    EXPECT_FALSE(encode(2, -1000, Positive) <= encode(1, -1000, Positive));
-    EXPECT_TRUE(encode(2, -1000, Positive) > encode(1, -1000, Positive));
-    EXPECT_TRUE(encode(2, -1000, Positive) >= encode(1, -1000, Positive));
-
-    EXPECT_FALSE(encode(2, -1000, Negative) == encode(1, -1000, Negative));
-    EXPECT_TRUE(encode(2, -1000, Negative) != encode(1, -1000, Negative));
-    EXPECT_TRUE(encode(2, -1000, Negative) < encode(1, -1000, Negative));
-    EXPECT_TRUE(encode(2, -1000, Negative) <= encode(1, -1000, Negative));
-    EXPECT_FALSE(encode(2, -1000, Negative) > encode(1, -1000, Negative));
-    EXPECT_FALSE(encode(2, -1000, Negative) >= encode(1, -1000, Negative));
-}
-
-TEST_F(DecimalTest, CompareSpecialValues)
-{
-    const Decimal Infinity(Decimal::infinity(Positive));
-    const Decimal MinusInfinity(Decimal::infinity(Negative));
-    const Decimal NaN(Decimal::nan());
-    const Decimal Zero(Decimal::zero(Positive));
-    const Decimal MinusZero(Decimal::zero(Negative));
-    const Decimal Ten(10);
-
-    EXPECT_TRUE(Zero == Zero);
-    EXPECT_FALSE(Zero != Zero);
-    EXPECT_FALSE(Zero < Zero);
-    EXPECT_TRUE(Zero <= Zero);
-    EXPECT_FALSE(Zero > Zero);
-    EXPECT_TRUE(Zero >= Zero);
-
-    EXPECT_TRUE(Zero == MinusZero);
-    EXPECT_FALSE(Zero != MinusZero);
-    EXPECT_FALSE(Zero < MinusZero);
-    EXPECT_TRUE(Zero <= MinusZero);
-    EXPECT_FALSE(Zero > MinusZero);
-    EXPECT_TRUE(Zero >= MinusZero);
-
-    EXPECT_TRUE(MinusZero == Zero);
-    EXPECT_FALSE(MinusZero != Zero);
-    EXPECT_FALSE(MinusZero < Zero);
-    EXPECT_TRUE(MinusZero <= Zero);
-    EXPECT_FALSE(MinusZero > Zero);
-    EXPECT_TRUE(MinusZero >= Zero);
-
-    EXPECT_TRUE(MinusZero == MinusZero);
-    EXPECT_FALSE(MinusZero != MinusZero);
-    EXPECT_FALSE(MinusZero < MinusZero);
-    EXPECT_TRUE(MinusZero <= MinusZero);
-    EXPECT_FALSE(MinusZero > MinusZero);
-    EXPECT_TRUE(MinusZero >= MinusZero);
-
-    EXPECT_TRUE(Infinity == Infinity);
-    EXPECT_FALSE(Infinity != Infinity);
-    EXPECT_FALSE(Infinity < Infinity);
-    EXPECT_TRUE(Infinity <= Infinity);
-    EXPECT_FALSE(Infinity > Infinity);
-    EXPECT_TRUE(Infinity >= Infinity);
-
-    EXPECT_FALSE(Infinity == Ten);
-    EXPECT_TRUE(Infinity != Ten);
-    EXPECT_FALSE(Infinity < Ten);
-    EXPECT_FALSE(Infinity <= Ten);
-    EXPECT_TRUE(Infinity > Ten);
-    EXPECT_TRUE(Infinity >= Ten);
-
-    EXPECT_FALSE(Infinity == MinusInfinity);
-    EXPECT_TRUE(Infinity != MinusInfinity);
-    EXPECT_FALSE(Infinity < MinusInfinity);
-    EXPECT_FALSE(Infinity <= MinusInfinity);
-    EXPECT_TRUE(Infinity > MinusInfinity);
-    EXPECT_TRUE(Infinity >= MinusInfinity);
-
-    EXPECT_FALSE(Infinity == NaN);
-    EXPECT_FALSE(Infinity != NaN);
-    EXPECT_FALSE(Infinity < NaN);
-    EXPECT_FALSE(Infinity <= NaN);
-    EXPECT_FALSE(Infinity > NaN);
-    EXPECT_FALSE(Infinity >= NaN);
-
-    EXPECT_FALSE(MinusInfinity == Infinity);
-    EXPECT_TRUE(MinusInfinity != Infinity);
-    EXPECT_TRUE(MinusInfinity < Infinity);
-    EXPECT_TRUE(MinusInfinity <= Infinity);
-    EXPECT_FALSE(MinusInfinity > Infinity);
-    EXPECT_FALSE(MinusInfinity >= Infinity);
-
-    EXPECT_FALSE(MinusInfinity == Ten);
-    EXPECT_TRUE(MinusInfinity != Ten);
-    EXPECT_TRUE(MinusInfinity < Ten);
-    EXPECT_TRUE(MinusInfinity <= Ten);
-    EXPECT_FALSE(MinusInfinity > Ten);
-    EXPECT_FALSE(MinusInfinity >= Ten);
-
-    EXPECT_TRUE(MinusInfinity == MinusInfinity);
-    EXPECT_FALSE(MinusInfinity != MinusInfinity);
-    EXPECT_FALSE(MinusInfinity < MinusInfinity);
-    EXPECT_TRUE(MinusInfinity <= MinusInfinity);
-    EXPECT_FALSE(MinusInfinity > MinusInfinity);
-    EXPECT_TRUE(MinusInfinity >= MinusInfinity);
-
-    EXPECT_FALSE(MinusInfinity == NaN);
-    EXPECT_FALSE(MinusInfinity != NaN);
-    EXPECT_FALSE(MinusInfinity < NaN);
-    EXPECT_FALSE(MinusInfinity <= NaN);
-    EXPECT_FALSE(MinusInfinity > NaN);
-    EXPECT_FALSE(MinusInfinity >= NaN);
-
-    EXPECT_FALSE(NaN == Infinity);
-    EXPECT_FALSE(NaN != Infinity);
-    EXPECT_FALSE(NaN < Infinity);
-    EXPECT_FALSE(NaN <= Infinity);
-    EXPECT_FALSE(NaN > Infinity);
-    EXPECT_FALSE(NaN >= Infinity);
-
-    EXPECT_FALSE(NaN == Ten);
-    EXPECT_FALSE(NaN != Ten);
-    EXPECT_FALSE(NaN < Ten);
-    EXPECT_FALSE(NaN <= Ten);
-    EXPECT_FALSE(NaN > Ten);
-    EXPECT_FALSE(NaN >= Ten);
-
-    EXPECT_FALSE(NaN == MinusInfinity);
-    EXPECT_FALSE(NaN != MinusInfinity);
-    EXPECT_FALSE(NaN < MinusInfinity);
-    EXPECT_FALSE(NaN <= MinusInfinity);
-    EXPECT_FALSE(NaN > MinusInfinity);
-    EXPECT_FALSE(NaN >= MinusInfinity);
-
-    EXPECT_TRUE(NaN == NaN);
-    EXPECT_FALSE(NaN != NaN);
-    EXPECT_FALSE(NaN < NaN);
-    EXPECT_TRUE(NaN <= NaN);
-    EXPECT_FALSE(NaN > NaN);
-    EXPECT_TRUE(NaN >= NaN);
-}
-
-TEST_F(DecimalTest, Division)
-{
-    EXPECT_EQ(encode(0, 0, Positive), Decimal(0) / Decimal(1));
-    EXPECT_EQ(encode(2, 0, Negative), Decimal(2) / Decimal(-1));
-    EXPECT_EQ(encode(5, -1, Negative), Decimal(-1) / Decimal(2));
-    EXPECT_EQ(encode(99, 0, Positive), Decimal(99) / Decimal(1));
-    EXPECT_EQ(Decimal(1), Decimal(-50) / Decimal(-50));
-    EXPECT_EQ(encode(3333333333333333, -16, Positive), Decimal(1) / Decimal(3));
-    EXPECT_EQ(encode(12345678901234, -1, Positive), encode(12345678901234, 0, Positive) / Decimal(10));
-}
-
-TEST_F(DecimalTest, DivisionBigExponent)
-{
-    EXPECT_EQ(encode(1, 1022, Positive), encode(1, 1022, Positive) / encode(1, 0, Positive));
-    EXPECT_EQ(encode(1, 0, Positive), encode(1, 1022, Positive) / encode(1, 1022, Positive));
-    EXPECT_EQ(Decimal::infinity(Positive), encode(1, 1022, Positive) / encode(1, -1000, Positive));
-}
-
-TEST_F(DecimalTest, DivisionSmallExponent)
-{
-    EXPECT_EQ(encode(1, -1022, Positive), encode(1, -1022, Positive) / encode(1, 0, Positive));
-    EXPECT_EQ(encode(1, 0, Positive), encode(1, -1022, Positive) / encode(1, -1022, Positive));
-}
-
-TEST_F(DecimalTest, DivisionSpecialValues)
-{
-    const Decimal Infinity(Decimal::infinity(Positive));
-    const Decimal MinusInfinity(Decimal::infinity(Negative));
-    const Decimal NaN(Decimal::nan());
-    const Decimal Zero(Decimal::zero(Positive));
-    const Decimal MinusZero(Decimal::zero(Negative));
-    const Decimal Ten(10);
-    const Decimal MinusTen(-10);
-
-    EXPECT_EQ(NaN, Zero / Zero);
-    EXPECT_EQ(NaN, Zero / MinusZero);
-    EXPECT_EQ(NaN, MinusZero / Zero);
-    EXPECT_EQ(NaN, MinusZero / MinusZero);
-
-    EXPECT_EQ(Infinity, Ten / Zero);
-    EXPECT_EQ(MinusInfinity, Ten / MinusZero);
-    EXPECT_EQ(MinusInfinity, MinusTen / Zero);
-    EXPECT_EQ(Infinity, MinusTen / MinusZero);
-
-    EXPECT_EQ(Infinity, Infinity / Zero);
-    EXPECT_EQ(MinusInfinity, Infinity / MinusZero);
-    EXPECT_EQ(MinusInfinity, MinusInfinity / Zero);
-    EXPECT_EQ(Infinity, MinusInfinity / MinusZero);
-
-    EXPECT_EQ(NaN, Infinity / Infinity);
-    EXPECT_EQ(NaN, Infinity / MinusInfinity);
-    EXPECT_EQ(NaN, MinusInfinity / Infinity);
-    EXPECT_EQ(NaN, MinusInfinity / MinusInfinity);
-
-    EXPECT_EQ(Zero, Ten / Infinity);
-    EXPECT_EQ(MinusZero, Ten / MinusInfinity);
-    EXPECT_EQ(MinusZero, MinusTen / Infinity);
-    EXPECT_EQ(Zero, MinusTen / MinusInfinity);
-
-    EXPECT_EQ(NaN, NaN / NaN);
-    EXPECT_EQ(NaN, NaN / Ten);
-    EXPECT_EQ(NaN, Ten / NaN);
-
-    EXPECT_EQ(NaN, NaN / Infinity);
-    EXPECT_EQ(NaN, NaN / MinusInfinity);
-    EXPECT_EQ(NaN, Infinity / NaN);
-    EXPECT_EQ(NaN, MinusInfinity / NaN);
-}
-
-TEST_F(DecimalTest, EncodedData)
-{
-    EXPECT_EQ(encode(0, 0, Positive), encode(0, 0, Positive));
-    EXPECT_EQ(encode(0, 0, Negative), encode(0, 0, Negative));
-    EXPECT_EQ(Decimal(1), Decimal(1));
-    EXPECT_EQ(encode(1, 0, Negative), encode(1, 0, Negative));
-    EXPECT_EQ(Decimal::infinity(Positive), encode(1, 2000, Positive));
-    EXPECT_EQ(Decimal::zero(Positive), encode(1, -2000, Positive));
-}
-
-TEST_F(DecimalTest, Floor)
-{
-    EXPECT_EQ(Decimal(1), Decimal(1).floor());
-    EXPECT_EQ(Decimal(1), encode(11, -1, Positive).floor());
-    EXPECT_EQ(Decimal(1), encode(13, -1, Positive).floor());
-    EXPECT_EQ(Decimal(1), encode(15, -1, Positive).floor());
-    EXPECT_EQ(Decimal(1), encode(19, -1, Positive).floor());
-
-    EXPECT_EQ(Decimal(-1), Decimal(-1).floor());
-    EXPECT_EQ(Decimal(-2), encode(11, -1, Negative).floor());
-    EXPECT_EQ(Decimal(-2), encode(13, -1, Negative).floor());
-    EXPECT_EQ(Decimal(-2), encode(15, -1, Negative).floor());
-    EXPECT_EQ(Decimal(-2), encode(19, -1, Negative).floor());
-}
-
-TEST_F(DecimalTest, FloorBigExponent)
-{
-    EXPECT_EQ(encode(1, 1000, Positive), encode(1, 1000, Positive).floor());
-    EXPECT_EQ(encode(1, 1000, Negative), encode(1, 1000, Negative).floor());
-}
-
-TEST_F(DecimalTest, FloorSmallExponent)
-{
-    EXPECT_EQ(encode(0, 0, Positive), encode(1, -1000, Positive).floor());
-    EXPECT_EQ(encode(0, 0, Negative), encode(1, -1000, Negative).floor());
-}
-
-TEST_F(DecimalTest, FloorSpecialValues)
-{
-    EXPECT_EQ(Decimal::infinity(Positive), Decimal::infinity(Positive).floor());
-    EXPECT_EQ(Decimal::infinity(Negative), Decimal::infinity(Negative).floor());
-    EXPECT_EQ(Decimal::nan(), Decimal::nan().floor());
-}
-
-TEST_F(DecimalTest, FromInt32)
-{
-    EXPECT_EQ(encode(0, 0, Positive), Decimal(0));
-    EXPECT_EQ(encode(1, 0, Positive), Decimal(1));
-    EXPECT_EQ(encode(1, 0, Negative), Decimal(-1));
-    EXPECT_EQ(encode(100, 0, Positive), Decimal(100));
-    EXPECT_EQ(encode(100, 0, Negative), Decimal(-100));
-    EXPECT_EQ(encode(0x7FFFFFFF, 0, Positive), Decimal(std::numeric_limits<int32_t>::max()));
-    EXPECT_EQ(encode(0x80000000u, 0, Negative), Decimal(std::numeric_limits<int32_t>::min()));
-}
-
-TEST_F(DecimalTest, FromString)
-{
-    EXPECT_EQ(encode(0, 0, Positive), fromString("0"));
-    EXPECT_EQ(encode(0, 0, Negative), fromString("-0"));
-    EXPECT_EQ(Decimal(1), fromString("1"));
-    EXPECT_EQ(encode(1, 0, Negative), fromString("-1"));
-    EXPECT_EQ(Decimal(1), fromString("01"));
-    EXPECT_EQ(encode(3, 0, Positive), fromString("+3"));
-    EXPECT_EQ(encode(0, 3, Positive), fromString("0E3"));
-    EXPECT_EQ(encode(5, -1, Positive), fromString(".5"));
-    EXPECT_EQ(encode(100, 0, Positive), fromString("100"));
-    EXPECT_EQ(encode(100, 0, Negative), fromString("-100"));
-    EXPECT_EQ(encode(123, -2, Positive), fromString("1.23"));
-    EXPECT_EQ(encode(123, -2, Negative), fromString("-1.23"));
-    EXPECT_EQ(encode(123, 8, Positive), fromString("1.23E10"));
-    EXPECT_EQ(encode(123, 8, Negative), fromString("-1.23E10"));
-    EXPECT_EQ(encode(123, 8, Positive), fromString("1.23E+10"));
-    EXPECT_EQ(encode(123, 8, Negative), fromString("-1.23E+10"));
-    EXPECT_EQ(encode(123, -12, Positive), fromString("1.23E-10"));
-    EXPECT_EQ(encode(123, -12, Negative), fromString("-1.23E-10"));
-    EXPECT_EQ(encode(5, -7, Positive), fromString("0.0000005"));
-    EXPECT_EQ(encode(0, 0, Positive), fromString("0e9999"));
-    EXPECT_EQ(encode(123, -3, Positive), fromString("0.123"));
-    EXPECT_EQ(encode(0, -2, Positive), fromString("00.00"));
-    EXPECT_EQ(encode(1, 2, Positive), fromString("1E2"));
-    EXPECT_EQ(Decimal::infinity(Positive), fromString("1E20000"));
-    EXPECT_EQ(Decimal::zero(Positive), fromString("1E-20000"));
-    EXPECT_EQ(encode(1000, 1023, Positive), fromString("1E1026"));
-    EXPECT_EQ(Decimal::zero(Positive), fromString("1E-1026"));
-    EXPECT_EQ(Decimal::infinity(Positive), fromString("1234567890E1036"));
-
-    // 2^1024
-    const uint64_t leadingDigitsOf2PowerOf1024 = UINT64_C(17976931348623159);
-    EXPECT_EQ(encode(leadingDigitsOf2PowerOf1024, 292, Positive), fromString("179769313486231590772930519078902473361797697894230657273430081157732675805500963132708477322407536021120113879871393357658789768814416622492847430639474124377767893424865485276302219601246094119453082952085005768838150682342462881473913110540827237163350510684586298239947245938479716304835356329624224137216"));
-}
-
-// These strings are look like proper number, but we don't accept them.
-TEST_F(DecimalTest, FromStringLikeNumber)
-{
-    EXPECT_EQ(Decimal::nan(), fromString(" 123 "));
-    EXPECT_EQ(Decimal::nan(), fromString("1,234"));
-}
-
-// fromString doesn't support infinity and NaN.
-TEST_F(DecimalTest, FromStringSpecialValues)
-{
-    EXPECT_EQ(Decimal::nan(), fromString("INF"));
-    EXPECT_EQ(Decimal::nan(), fromString("Infinity"));
-    EXPECT_EQ(Decimal::nan(), fromString("infinity"));
-    EXPECT_EQ(Decimal::nan(), fromString("+Infinity"));
-    EXPECT_EQ(Decimal::nan(), fromString("+infinity"));
-    EXPECT_EQ(Decimal::nan(), fromString("-Infinity"));
-    EXPECT_EQ(Decimal::nan(), fromString("-infinity"));
-    EXPECT_EQ(Decimal::nan(), fromString("NaN"));
-    EXPECT_EQ(Decimal::nan(), fromString("nan"));
-    EXPECT_EQ(Decimal::nan(), fromString("+NaN"));
-    EXPECT_EQ(Decimal::nan(), fromString("+nan"));
-    EXPECT_EQ(Decimal::nan(), fromString("-NaN"));
-    EXPECT_EQ(Decimal::nan(), fromString("-nan"));
-}
-
-TEST_F(DecimalTest, fromStringTruncated)
-{
-    EXPECT_EQ(Decimal::nan(), fromString("x"));
-    EXPECT_EQ(Decimal::nan(), fromString("0."));
-    EXPECT_EQ(Decimal::nan(), fromString("1x"));
-
-    EXPECT_EQ(Decimal::nan(), fromString("1Ex"));
-    EXPECT_EQ(Decimal::nan(), fromString("1E2x"));
-    EXPECT_EQ(Decimal::nan(), fromString("1E+x"));
-}
-
-TEST_F(DecimalTest, Multiplication)
-{
-    EXPECT_EQ(encode(0, 0, Positive), Decimal(0) * Decimal(0));
-    EXPECT_EQ(encode(2, 0, Negative), Decimal(2) * Decimal(-1));
-    EXPECT_EQ(encode(2, 0, Negative), Decimal(-1) * Decimal(2));
-    EXPECT_EQ(encode(99, 0, Positive), Decimal(99) * Decimal(1));
-    EXPECT_EQ(encode(2500, 0, Positive), Decimal(-50) * Decimal(-50));
-}
-
-TEST_F(DecimalTest, MultiplicationBigExponent)
-{
-    EXPECT_EQ(encode(1, 1022, Positive), encode(1, 1022, Positive) * encode(1, 0, Positive));
-    EXPECT_EQ(Decimal::infinity(Positive), encode(1, 1022, Positive) * encode(1, 1022, Positive));
-    EXPECT_EQ(encode(1, 22, Positive), encode(1, 1022, Positive) * encode(1, -1000, Positive));
-}
-
-TEST_F(DecimalTest, MultiplicationSmallExponent)
-{
-    EXPECT_EQ(encode(1, -1022, Positive), encode(1, -1022, Positive) * encode(1, 0, Positive));
-    EXPECT_EQ(encode(0, 0, Positive), encode(1, -1022, Positive) * encode(1, -1022, Positive));
-}
-
-TEST_F(DecimalTest, MultiplicationSpecialValues)
-{
-    const Decimal Infinity(Decimal::infinity(Positive));
-    const Decimal MinusInfinity(Decimal::infinity(Negative));
-    const Decimal NaN(Decimal::nan());
-    const Decimal Ten(10);
-    const Decimal MinusTen(-10);
-    const Decimal Zero(Decimal::zero(Positive));
-    const Decimal MinusZero(Decimal::zero(Negative));
-
-    EXPECT_EQ(Infinity, Infinity * Infinity);
-    EXPECT_EQ(MinusInfinity, Infinity * MinusInfinity);
-    EXPECT_EQ(MinusInfinity, MinusInfinity * Infinity);
-    EXPECT_EQ(Infinity, MinusInfinity * MinusInfinity);
-
-    EXPECT_EQ(NaN, Infinity * Zero);
-    EXPECT_EQ(NaN, Zero * MinusInfinity);
-    EXPECT_EQ(NaN, MinusInfinity * Zero);
-    EXPECT_EQ(NaN, MinusInfinity * Zero);
-
-    EXPECT_EQ(NaN, Infinity * MinusZero);
-    EXPECT_EQ(NaN, MinusZero * MinusInfinity);
-    EXPECT_EQ(NaN, MinusInfinity * MinusZero);
-    EXPECT_EQ(NaN, MinusInfinity * MinusZero);
-
-    EXPECT_EQ(Infinity, Infinity * Ten);
-    EXPECT_EQ(Infinity, Ten * Infinity);
-    EXPECT_EQ(MinusInfinity, MinusInfinity * Ten);
-    EXPECT_EQ(MinusInfinity, Ten * MinusInfinity);
-
-    EXPECT_EQ(MinusInfinity, Infinity * MinusTen);
-    EXPECT_EQ(MinusInfinity, MinusTen * Infinity);
-    EXPECT_EQ(Infinity, MinusInfinity * MinusTen);
-    EXPECT_EQ(Infinity, MinusTen * MinusInfinity);
-
-    EXPECT_EQ(NaN, NaN * NaN);
-    EXPECT_EQ(NaN, NaN * Ten);
-    EXPECT_EQ(NaN, Ten * NaN);
-
-    EXPECT_EQ(NaN, NaN * Infinity);
-    EXPECT_EQ(NaN, NaN * MinusInfinity);
-    EXPECT_EQ(NaN, Infinity * NaN);
-    EXPECT_EQ(NaN, MinusInfinity * NaN);
-}
-
-TEST_F(DecimalTest, Negate)
-{
-    EXPECT_EQ(encode(0, 0, Negative), -encode(0, 0, Positive));
-    EXPECT_EQ(encode(0, 0, Positive), -encode(0, 0, Negative));
-
-    EXPECT_EQ(encode(0, 10, Negative), -encode(0, 10, Positive));
-    EXPECT_EQ(encode(0, 10, Positive), -encode(0, 10, Negative));
-
-    EXPECT_EQ(encode(0, -10, Negative), -encode(0, -10, Positive));
-    EXPECT_EQ(encode(0, -10, Positive), -encode(0, -10, Negative));
-
-    EXPECT_EQ(encode(1, 0, Negative), -encode(1, 0, Positive));
-    EXPECT_EQ(encode(1, 0, Positive), -encode(1, 0, Negative));
-
-    EXPECT_EQ(encode(1, 10, Negative), -encode(1, 10, Positive));
-    EXPECT_EQ(encode(1, 10, Positive), -encode(1, 10, Negative));
-
-    EXPECT_EQ(encode(1, -10, Negative), -encode(1, -10, Positive));
-    EXPECT_EQ(encode(1, -10, Positive), -encode(1, -10, Negative));
-}
-
-TEST_F(DecimalTest, NegateBigExponent)
-{
-    EXPECT_EQ(encode(1, 1000, Negative), -encode(1, 1000, Positive));
-    EXPECT_EQ(encode(1, 1000, Positive), -encode(1, 1000, Negative));
-}
-
-TEST_F(DecimalTest, NegateSmallExponent)
-{
-    EXPECT_EQ(encode(1, -1000, Negative), -encode(1, -1000, Positive));
-    EXPECT_EQ(encode(1, -1000, Positive), -encode(1, -1000, Negative));
-}
-
-TEST_F(DecimalTest, NegateSpecialValues)
-{
-    EXPECT_EQ(Decimal::infinity(Negative), -Decimal::infinity(Positive));
-    EXPECT_EQ(Decimal::infinity(Positive), -Decimal::infinity(Negative));
-    EXPECT_EQ(Decimal::nan(), -Decimal::nan());
-}
-
-TEST_F(DecimalTest, Predicates)
-{
-    EXPECT_TRUE(Decimal::zero(Positive).isFinite());
-    EXPECT_TRUE(Decimal::zero(Positive).isPositive());
-    EXPECT_FALSE(Decimal::zero(Positive).isNegative());
-    EXPECT_FALSE(Decimal::zero(Positive).isSpecial());
-    EXPECT_TRUE(Decimal::zero(Positive).isZero());
-
-    EXPECT_TRUE(Decimal::zero(Negative).isFinite());
-    EXPECT_FALSE(Decimal::zero(Negative).isPositive());
-    EXPECT_TRUE(Decimal::zero(Negative).isNegative());
-    EXPECT_FALSE(Decimal::zero(Negative).isSpecial());
-    EXPECT_TRUE(Decimal::zero(Negative).isZero());
-
-    EXPECT_TRUE(Decimal(123).isFinite());
-    EXPECT_TRUE(Decimal(123).isPositive());
-    EXPECT_FALSE(Decimal(123).isNegative());
-    EXPECT_FALSE(Decimal(123).isSpecial());
-    EXPECT_FALSE(Decimal(123).isZero());
-
-    EXPECT_TRUE(Decimal(-123).isFinite());
-    EXPECT_FALSE(Decimal(-123).isPositive());
-    EXPECT_TRUE(Decimal(-123).isNegative());
-    EXPECT_FALSE(Decimal(-123).isSpecial());
-    EXPECT_FALSE(Decimal(-123).isZero());
-}
-
-TEST_F(DecimalTest, PredicatesSpecialValues)
-{
-    EXPECT_FALSE(Decimal::infinity(Positive).isFinite());
-    EXPECT_TRUE(Decimal::infinity(Positive).isPositive());
-    EXPECT_FALSE(Decimal::infinity(Positive).isNegative());
-    EXPECT_TRUE(Decimal::infinity(Positive).isSpecial());
-    EXPECT_FALSE(Decimal::infinity(Positive).isZero());
-
-    EXPECT_FALSE(Decimal::infinity(Negative).isFinite());
-    EXPECT_FALSE(Decimal::infinity(Negative).isPositive());
-    EXPECT_TRUE(Decimal::infinity(Negative).isNegative());
-    EXPECT_TRUE(Decimal::infinity(Negative).isSpecial());
-    EXPECT_FALSE(Decimal::infinity(Negative).isZero());
-
-    EXPECT_FALSE(Decimal::nan().isFinite());
-    EXPECT_TRUE(Decimal::nan().isSpecial());
-    EXPECT_FALSE(Decimal::nan().isZero());
-}
-
-// LayoutTests/fast/forms/number/number-stepup-stepdown-from-renderer
-TEST_F(DecimalTest, RealWorldExampleNumberStepUpStepDownFromRenderer)
-{
-    EXPECT_EQ(String("10"), stepDown("0", "100", "10", "19", 1));
-    EXPECT_EQ(String("90"), stepUp("0", "99", "10", "89", 1));
-    EXPECT_EQ(String("1"), stepUp("0", "1", "0.33333333333333333", "0", 3)); // step=1/3
-    EXPECT_EQ(String("0.01"), stepUp("0", "0.01", "0.0033333333333333333", "0", 3)); // step=1/300
-    EXPECT_EQ(String("1"), stepUp("0", "1", "0.003921568627450980", "0", 255)); // step=1/255
-    EXPECT_EQ(String("1"), stepUp("0", "1", "0.1", "0", 10));
-}
-
-TEST_F(DecimalTest, RealWorldExampleNumberStepUpStepDownFromRendererRounding)
-{
-    EXPECT_EQ(String("5.015"), stepUp("0", "100", "0.005", "5.005", 2));
-    EXPECT_EQ(String("5.06"), stepUp("0", "100", "0.005", "5.005", 11));
-    EXPECT_EQ(String("5.065"), stepUp("0", "100", "0.005", "5.005", 12));
-
-    EXPECT_EQ(String("5.015"), stepUp("4", "9", "0.005", "5.005", 2));
-    EXPECT_EQ(String("5.06"), stepUp("4", "9", "0.005", "5.005", 11));
-    EXPECT_EQ(String("5.065"), stepUp("4", "9", "0.005", "5.005", 12));
-}
-
-TEST_F(DecimalTest, RealWorldExampleRangeStepUpStepDown)
-{
-    EXPECT_EQ(String("1e+38"), stepUp("0", "1E38", "1", "1E38", 9));
-    EXPECT_EQ(String("1e+38"), stepDown("0", "1E38", "1", "1E38", 9));
-}
-
-TEST_F(DecimalTest, Remainder)
-{
-    EXPECT_EQ(encode(9, -1, Negative), encode(21, -1, Positive).remainder(3));
-    EXPECT_EQ(Decimal(1), Decimal(10).remainder(3));
-    EXPECT_EQ(encode(1, 0, Negative), Decimal(-10).remainder(3));
-    EXPECT_EQ(encode(2, -1, Positive), encode(102, -1, Positive).remainder(1));
-    EXPECT_EQ(encode(1, -1, Positive), Decimal(10).remainder(encode(3, -1, Positive)));
-    EXPECT_EQ(encode(3, -1, Negative), encode(36, -1, Positive).remainder(encode(13, -1, Positive)));
-    EXPECT_EQ(encode(1, 87, Positive), (encode(1234, 100, Positive).remainder(Decimal(3))));
-}
-
-TEST_F(DecimalTest, RemainderBigExponent)
-{
-    EXPECT_EQ(encode(0, 1022, Positive), encode(1, 1022, Positive).remainder(encode(1, 0, Positive)));
-    EXPECT_EQ(encode(0, 1022, Positive), encode(1, 1022, Positive).remainder(encode(1, 1022, Positive)));
-    EXPECT_EQ(Decimal::infinity(Positive), encode(1, 1022, Positive).remainder(encode(1, -1000, Positive)));
-}
-
-TEST_F(DecimalTest, RemainderSmallExponent)
-{
-    EXPECT_EQ(encode(1, -1022, Positive), encode(1, -1022, Positive).remainder(encode(1, 0, Positive)));
-    EXPECT_EQ(encode(0, -1022, Positive), encode(1, -1022, Positive).remainder(encode(1, -1022, Positive)));
-}
-
-TEST_F(DecimalTest, RemainderSpecialValues)
-{
-    EXPECT_EQ(Decimal::infinity(Positive), Decimal::infinity(Positive).remainder(1));
-    EXPECT_EQ(Decimal::infinity(Negative), Decimal::infinity(Negative).remainder(1));
-    EXPECT_EQ(Decimal::nan(), Decimal::nan().remainder(1));
-
-    EXPECT_EQ(Decimal::infinity(Negative), Decimal::infinity(Positive).remainder(-1));
-    EXPECT_EQ(Decimal::infinity(Positive), Decimal::infinity(Negative).remainder(-1));
-    EXPECT_EQ(Decimal::nan(), Decimal::nan().remainder(-1));
-
-    EXPECT_EQ(Decimal::infinity(Positive), Decimal::infinity(Positive).remainder(3));
-    EXPECT_EQ(Decimal::infinity(Negative), Decimal::infinity(Negative).remainder(3));
-    EXPECT_EQ(Decimal::nan(), Decimal::nan().remainder(3));
-
-    EXPECT_EQ(Decimal::infinity(Negative), Decimal::infinity(Positive).remainder(-1));
-    EXPECT_EQ(Decimal::infinity(Positive), Decimal::infinity(Negative).remainder(-1));
-    EXPECT_EQ(Decimal::nan(), Decimal::nan().remainder(-1));
-
-    EXPECT_EQ(Decimal::nan(), Decimal(1).remainder(Decimal::infinity(Positive)));
-    EXPECT_EQ(Decimal::nan(), Decimal(1).remainder(Decimal::infinity(Negative)));
-    EXPECT_EQ(Decimal::nan(), Decimal(1).remainder(Decimal::nan()));
-}
-
-TEST_F(DecimalTest, Round)
-{
-    EXPECT_EQ(Decimal(1), (Decimal(9) / Decimal(10)).round());
-    EXPECT_EQ(Decimal(25), (Decimal(5) / fromString("0.200")).round());
-    EXPECT_EQ(Decimal(3), (Decimal(5) / Decimal(2)).round());
-    EXPECT_EQ(Decimal(1), (Decimal(2) / Decimal(3)).round());
-    EXPECT_EQ(Decimal(3), (Decimal(10) / Decimal(3)).round());
-    EXPECT_EQ(Decimal(3), (Decimal(1) / fromString("0.3")).round());
-    EXPECT_EQ(Decimal(10), (Decimal(1) / fromString("0.1")).round());
-    EXPECT_EQ(Decimal(5), (Decimal(1) / fromString("0.2")).round());
-    EXPECT_EQ(Decimal(10), (fromString("10.2") / 1).round());
-    EXPECT_EQ(encode(1234, 100, Positive), encode(1234, 100, Positive).round());
-}
-
-TEST_F(DecimalTest, RoundSpecialValues)
-{
-    EXPECT_EQ(Decimal::infinity(Positive), Decimal::infinity(Positive).round());
-    EXPECT_EQ(Decimal::infinity(Negative), Decimal::infinity(Negative).round());
-    EXPECT_EQ(Decimal::nan(), Decimal::nan().round());
-}
-
-TEST_F(DecimalTest, Subtract)
-{
-    EXPECT_EQ(encode(0, 0, Positive), Decimal(0) - Decimal(0));
-    EXPECT_EQ(encode(3, 0, Positive), Decimal(2) - Decimal(-1));
-    EXPECT_EQ(encode(3, 0, Negative), Decimal(-1) - Decimal(2));
-    EXPECT_EQ(encode(98, 0, Positive), Decimal(99) - Decimal(1));
-    EXPECT_EQ(encode(0, 0, Positive), Decimal(-50) - Decimal(-50));
-    EXPECT_EQ(encode(1000000000000000, 35, Positive), encode(1, 50, Positive) - Decimal(1));
-    EXPECT_EQ(encode(1000000000000000, 35, Negative), Decimal(1) - encode(1, 50, Positive));
-}
-
-TEST_F(DecimalTest, SubtractBigExponent)
-{
-    EXPECT_EQ(encode(1, 1022, Positive), encode(1, 1022, Positive) - encode(1, 0, Positive));
-    EXPECT_EQ(encode(0, 0, Positive), encode(1, 1022, Positive) - encode(1, 1022, Positive));
-    EXPECT_EQ(encode(1, 1022, Positive), encode(1, 1022, Positive) + encode(1, -1000, Positive));
-}
-
-TEST_F(DecimalTest, SubtractSmallExponent)
-{
-    EXPECT_EQ(encode(UINT64_C(10000000000000000), -16, Negative), encode(1, -1022, Positive) - encode(1, 0, Positive));
-    EXPECT_EQ(encode(0, 0, Positive), encode(1, -1022, Positive) - encode(1, -1022, Positive));
-}
-
-TEST_F(DecimalTest, SubtractSpecialValues)
-{
-    const Decimal Infinity(Decimal::infinity(Positive));
-    const Decimal MinusInfinity(Decimal::infinity(Negative));
-    const Decimal NaN(Decimal::nan());
-    const Decimal Ten(10);
-
-    EXPECT_EQ(NaN, Infinity - Infinity);
-    EXPECT_EQ(Infinity, Infinity - MinusInfinity);
-    EXPECT_EQ(MinusInfinity, MinusInfinity - Infinity);
-    EXPECT_EQ(NaN, MinusInfinity - MinusInfinity);
-
-    EXPECT_EQ(Infinity, Infinity - Ten);
-    EXPECT_EQ(MinusInfinity, Ten - Infinity);
-    EXPECT_EQ(MinusInfinity, MinusInfinity - Ten);
-    EXPECT_EQ(Infinity, Ten - MinusInfinity);
-
-    EXPECT_EQ(NaN, NaN - NaN);
-    EXPECT_EQ(NaN, NaN - Ten);
-    EXPECT_EQ(NaN, Ten - NaN);
-
-    EXPECT_EQ(NaN, NaN - Infinity);
-    EXPECT_EQ(NaN, NaN - MinusInfinity);
-    EXPECT_EQ(NaN, Infinity - NaN);
-    EXPECT_EQ(NaN, MinusInfinity - NaN);
-}
-
-TEST_F(DecimalTest, ToString)
-{
-    EXPECT_EQ(String("0"), Decimal::zero(Positive).toString());
-    EXPECT_EQ(String("-0"), Decimal::zero(Negative).toString());
-    EXPECT_EQ(String("1"), Decimal(1).toString());
-    EXPECT_EQ(String("-1"), Decimal(-1).toString());
-    EXPECT_EQ(String("1234567"), Decimal(1234567).toString());
-    EXPECT_EQ(String("-1234567"), Decimal(-1234567).toString());
-    EXPECT_EQ(String("0.5"), encode(5, -1, Positive).toString());
-    EXPECT_EQ(String("-0.5"), encode(5, -1, Negative).toString());
-    EXPECT_EQ(String("12.345"), encode(12345, -3, Positive).toString());
-    EXPECT_EQ(String("-12.345"), encode(12345, -3, Negative).toString());
-    EXPECT_EQ(String("0.12345"), encode(12345, -5, Positive).toString());
-    EXPECT_EQ(String("-0.12345"), encode(12345, -5, Negative).toString());
-    EXPECT_EQ(String("50"), encode(50, 0, Positive).toString());
-    EXPECT_EQ(String("-50"), encode(50, 0, Negative).toString());
-    EXPECT_EQ(String("5e+1"), encode(5, 1, Positive).toString());
-    EXPECT_EQ(String("-5e+1"), encode(5, 1, Negative).toString());
-    EXPECT_EQ(String("5.678e+103"), encode(5678, 100, Positive).toString());
-    EXPECT_EQ(String("-5.678e+103"), encode(5678, 100, Negative).toString());
-    EXPECT_EQ(String("5.678e-97"), encode(5678, -100, Positive).toString());
-    EXPECT_EQ(String("-5.678e-97"), encode(5678, -100, Negative).toString());
-}
-
-TEST_F(DecimalTest, ToStringSpecialValues)
-{
-    EXPECT_EQ(String("Infinity"), Decimal::infinity(Positive).toString());
-    EXPECT_EQ(String("-Infinity"), Decimal::infinity(Negative).toString());
-    EXPECT_EQ(String("NaN"), Decimal::nan().toString());
-}