<head>
<script src="../../../resources/js-test-pre.js"></script>
</head>
<body>
<input id="foo" type=range step=0.1 value=0.6>
<div id="console"></div>
<div id="sliders"></div>
<script>
description("<a href='http://bugs.webkit.org/show_bug.cgi?id=80009'>80009 Introduce Decimal arithmetic to fix rounding errors in number/range input types</a>");

function createSample(step, value, max)
{
    var container = document.createElement("span");
    container.innerHTML = '<input type=range min=0 max=' + max + ' step=' + step + ' value=' + value + '><br>';
    document.getElementById("sliders").appendChild(container);
    return container.firstChild;
}

var zeros = "0.";
for (var exponent = 0; exponent < 15; ++exponent) {
    var step = zeros + "1";
    for (var digit = 1; digit <= 9; ++digit) {
        var value = zeros + digit.toString();
        var sample = 'createSample("' + step + '", "' + value + '", "1e-' + exponent + '")';
        var stepExponent = exponent + 1;
        shouldBeEqualToString(sample + '.value', stepExponent >= 7 ? digit + "e-" + stepExponent : value);
        shouldBe(sample + '.valueAsNumber', value);
    }
    zeros += "0";
}

// Remove generated sliders.
document.getElementById("sliders").innerHTML = "";
</script>
<script src="../../../resources/js-test-post.js"></script>
</body>
