diff options
Diffstat (limited to 'jstests/decimal')
-rw-r--r-- | jstests/decimal/decimal128_test1.js | 333 | ||||
-rw-r--r-- | jstests/decimal/decimal128_test2.js | 609 | ||||
-rw-r--r-- | jstests/decimal/decimal128_test3.js | 1239 | ||||
-rw-r--r-- | jstests/decimal/decimal128_test4.js | 262 | ||||
-rw-r--r-- | jstests/decimal/decimal128_test5.js | 631 | ||||
-rw-r--r-- | jstests/decimal/decimal128_test6.js | 82 | ||||
-rw-r--r-- | jstests/decimal/decimal128_test7.js | 788 | ||||
-rw-r--r-- | jstests/decimal/decimal_constructors.js | 64 | ||||
-rw-r--r-- | jstests/decimal/decimal_find_basic.js | 101 | ||||
-rw-r--r-- | jstests/decimal/decimal_find_mixed.js | 114 | ||||
-rw-r--r-- | jstests/decimal/decimal_find_query.js | 78 | ||||
-rw-r--r-- | jstests/decimal/decimal_roundtrip_basic.js | 88 | ||||
-rw-r--r-- | jstests/decimal/decimal_update.js | 60 |
13 files changed, 2171 insertions, 2278 deletions
diff --git a/jstests/decimal/decimal128_test1.js b/jstests/decimal/decimal128_test1.js index 2febf2bf125..6cf083341e4 100644 --- a/jstests/decimal/decimal128_test1.js +++ b/jstests/decimal/decimal128_test1.js @@ -3,184 +3,161 @@ */ (function() { - "use strict"; +"use strict"; - var testData = [ - {"description": "Special - Canonical NaN", "input": "NaN"}, - {"description": "Special - Negative NaN", "input": "NaN", "lossy": true}, - { - "description": "Special - Negative NaN", - "expected": "NaN", - "input": "-NaN", - "lossy": true - }, - {"description": "Special - Canonical SNaN", "input": "NaN", "lossy": true}, - {"description": "Special - Negative SNaN", "input": "NaN", "lossy": true}, - {"description": "Special - NaN with a payload", "input": "NaN", "lossy": true}, - {"description": "Special - Canonical Positive Infinity", "input": "Infinity"}, - {"description": "Special - Canonical Negative Infinity", "input": "-Infinity"}, - { - "description": "Special - Invalid representation treated as 0", - "input": "0", - "lossy": true - }, - { - "description": "Special - Invalid representation treated as -0", - "input": "-0", - "lossy": true - }, - { - "description": "Special - Invalid representation treated as 0E3", - "input": "0E+3", - "lossy": true - }, - { - "description": "Regular - Adjusted Exponent Limit", - "input": "0.000001234567890123456789012345678901234" - }, - {"description": "Regular - Smallest", "input": "0.001234"}, - {"description": "Regular - Smallest with Trailing Zeros", "input": "0.00123400000"}, - {"description": "Regular - 0.1", "input": "0.1"}, - { - "description": "Regular - 0.1234567890123456789012345678901234", - "input": "0.1234567890123456789012345678901234" - }, - {"description": "Regular - 0", "input": "0"}, - {"description": "Regular - -0", "input": "-0"}, - {"description": "Regular - -0.0", "input": "-0.0"}, - {"description": "Regular - 2", "input": "2"}, - {"description": "Regular - 2.000", "input": "2.000"}, - {"description": "Regular - Largest", "input": "1234567890123456789012345678901234"}, - { - "description": "Scientific - Tiniest", - "input": "9.999999999999999999999999999999999E-6143" - }, - {"description": "Scientific - Tiny", "input": "1E-6176"}, - {"description": "Scientific - Negative Tiny", "input": "-1E-6176"}, - { - "description": "Scientific - Adjusted Exponent Limit", - "input": "1.234567890123456789012345678901234E-7" - }, - {"description": "Scientific - Fractional", "input": "-1.00E-8"}, - {"description": "Scientific - 0 with Exponent", "input": "0E+6000"}, - {"description": "Scientific - 0 with Negative Exponent", "input": "0E-611"}, - {"description": "Scientific - No Decimal with Signed Exponent", "input": "1E+3"}, - {"description": "Scientific - Trailing Zero", "input": "1.050E+4"}, - {"description": "Scientific - With Decimal", "input": "1.05E+3"}, - {"description": "Scientific - Full", "input": "5192296858534827628530496329220095"}, - {"description": "Scientific - Large", "input": "1.000000000000000000000000000000000E+6144"}, - { - "description": "Scientific - Largest", - "input": "9.999999999999999999999999999999999E+6144" - }, - { - "description": "Non-Canonical Parsing - Exponent Normalization", - "input": "-100E-10", - "expected": "-1.00E-8" - }, - { - "description": "Non-Canonical Parsing - Unsigned Positive Exponent", - "input": "1E3", - "expected": "1E+3" - }, - { - "description": "Non-Canonical Parsing - Lowercase Exponent Identifier", - "input": "1e+3", - "expected": "1E+3" - }, - { - "description": "Non-Canonical Parsing - Long Significand with Exponent", - "input": "12345689012345789012345E+12", - "expected": "1.2345689012345789012345E+34" - }, - { - "description": "Non-Canonical Parsing - Positive Sign", - "input": "+1234567890123456789012345678901234", - "expected": "1234567890123456789012345678901234" - }, - { - "description": "Non-Canonical Parsing - Long Decimal String", - "input": - ".0000000000000000000000000000000000000000000000000000000000000000000000000000000" + - "00000000000000000000000000000000000000000000000000000000000000000000000000000000" + - "00000000000000000000000000000000000000000000000000000000000000000000000000000000" + - "00000000000000000000000000000000000000000000000000000000000000000000000000000000" + - "00000000000000000000000000000000000000000000000000000000000000000000000000000000" + - "00000000000000000000000000000000000000000000000000000000000000000000000000000000" + - "00000000000000000000000000000000000000000000000000000000000000000000000000000000" + - "00000000000000000000000000000000000000000000000000000000000000000000000000000000" + - "00000000000000000000000000000000000000000000000000000000000000000000000000000000" + - "00000000000000000000000000000000000000000000000000000000000000000000000000000000" + - "00000000000000000000000000000000000000000000000000000000000000000000000000000000" + - "00000000000000000000000000000000000000000000000000000000000000000000000000000000" + - "0000000000000000000000000000000000000001", - "expected": "1E-999" - }, - {"description": "Non-Canonical Parsing - nan", "input": "nan", "expected": "NaN"}, - {"description": "Non-Canonical Parsing - nAn", "input": "nAn", "expected": "NaN"}, - { - "description": "Non-Canonical Parsing - +infinity", - "input": "+infinity", - "expected": "Infinity" - }, - { - "description": "Non-Canonical Parsing - infinity", - "input": "infinity", - "expected": "Infinity" - }, - { - "description": "Non-Canonical Parsing - infiniTY", - "input": "infiniTY", - "expected": "Infinity" - }, - {"description": "Non-Canonical Parsing - inf", "input": "inf", "expected": "Infinity"}, - {"description": "Non-Canonical Parsing - inF", "input": "inF", "expected": "Infinity"}, - { - "description": "Non-Canonical Parsing - -infinity", - "input": "-infinity", - "expected": "-Infinity" - }, - { - "description": "Non-Canonical Parsing - -infiniTy", - "input": "-infiniTy", - "expected": "-Infinity" - }, - { - "description": "Non-Canonical Parsing - -Inf", - "input": "-Infinity", - "expected": "-Infinity" - }, - {"description": "Non-Canonical Parsing - -inf", "input": "-inf", "expected": "-Infinity"}, - {"description": "Non-Canonical Parsing - -inF", "input": "-inF", "expected": "-Infinity"}, - {"description": "Rounded Subnormal number", "input": "10E-6177", "expected": "1E-6176"}, - {"description": "Clamped", "input": "1E6112", "expected": "1.0E+6112"}, - { - "description": "Exact rounding", - "input": - "100000000000000000000000000000000000000000000000000000000000000000000000000000000" + - "000000000000000000000000000000000000000000000000000000000000000000000000000000000" + - "000000000000000000000000000000000000000000000000000000000000000000000000000000000" + - "000000000000000000000000000000000000000000000000000000000000000000000000000000000" + - "000000000000000000000000000000000000000000000000000000000000000000000000000000000" + - "000000000000000000000000000000000000000000000000000000000000000000000000000000000" + - "000000000000000000000000000000000000000000000000000000000000000000000000000000000" + - "000000000000000000000000000000000000000000000000000000000000000000000000000000000" + - "000000000000000000000000000000000000000000000000000000000000000000000000000000000" + - "000000000000000000000000000000000000000000000000000000000000000000000000000000000" + - "000000000000000000000000000000000000000000000000000000000000000000000000000000000" + - "000000000000000000000000000000000000000000000000000000000000000000000000000000000" + - "0000000000000000000000000000", - "expected": "1.000000000000000000000000000000000E+999" - } - ]; +var testData = [ + {"description": "Special - Canonical NaN", "input": "NaN"}, + {"description": "Special - Negative NaN", "input": "NaN", "lossy": true}, + {"description": "Special - Negative NaN", "expected": "NaN", "input": "-NaN", "lossy": true}, + {"description": "Special - Canonical SNaN", "input": "NaN", "lossy": true}, + {"description": "Special - Negative SNaN", "input": "NaN", "lossy": true}, + {"description": "Special - NaN with a payload", "input": "NaN", "lossy": true}, + {"description": "Special - Canonical Positive Infinity", "input": "Infinity"}, + {"description": "Special - Canonical Negative Infinity", "input": "-Infinity"}, + {"description": "Special - Invalid representation treated as 0", "input": "0", "lossy": true}, + {"description": "Special - Invalid representation treated as -0", "input": "-0", "lossy": true}, + { + "description": "Special - Invalid representation treated as 0E3", + "input": "0E+3", + "lossy": true + }, + { + "description": "Regular - Adjusted Exponent Limit", + "input": "0.000001234567890123456789012345678901234" + }, + {"description": "Regular - Smallest", "input": "0.001234"}, + {"description": "Regular - Smallest with Trailing Zeros", "input": "0.00123400000"}, + {"description": "Regular - 0.1", "input": "0.1"}, + { + "description": "Regular - 0.1234567890123456789012345678901234", + "input": "0.1234567890123456789012345678901234" + }, + {"description": "Regular - 0", "input": "0"}, + {"description": "Regular - -0", "input": "-0"}, + {"description": "Regular - -0.0", "input": "-0.0"}, + {"description": "Regular - 2", "input": "2"}, + {"description": "Regular - 2.000", "input": "2.000"}, + {"description": "Regular - Largest", "input": "1234567890123456789012345678901234"}, + {"description": "Scientific - Tiniest", "input": "9.999999999999999999999999999999999E-6143"}, + {"description": "Scientific - Tiny", "input": "1E-6176"}, + {"description": "Scientific - Negative Tiny", "input": "-1E-6176"}, + { + "description": "Scientific - Adjusted Exponent Limit", + "input": "1.234567890123456789012345678901234E-7" + }, + {"description": "Scientific - Fractional", "input": "-1.00E-8"}, + {"description": "Scientific - 0 with Exponent", "input": "0E+6000"}, + {"description": "Scientific - 0 with Negative Exponent", "input": "0E-611"}, + {"description": "Scientific - No Decimal with Signed Exponent", "input": "1E+3"}, + {"description": "Scientific - Trailing Zero", "input": "1.050E+4"}, + {"description": "Scientific - With Decimal", "input": "1.05E+3"}, + {"description": "Scientific - Full", "input": "5192296858534827628530496329220095"}, + {"description": "Scientific - Large", "input": "1.000000000000000000000000000000000E+6144"}, + {"description": "Scientific - Largest", "input": "9.999999999999999999999999999999999E+6144"}, + { + "description": "Non-Canonical Parsing - Exponent Normalization", + "input": "-100E-10", + "expected": "-1.00E-8" + }, + { + "description": "Non-Canonical Parsing - Unsigned Positive Exponent", + "input": "1E3", + "expected": "1E+3" + }, + { + "description": "Non-Canonical Parsing - Lowercase Exponent Identifier", + "input": "1e+3", + "expected": "1E+3" + }, + { + "description": "Non-Canonical Parsing - Long Significand with Exponent", + "input": "12345689012345789012345E+12", + "expected": "1.2345689012345789012345E+34" + }, + { + "description": "Non-Canonical Parsing - Positive Sign", + "input": "+1234567890123456789012345678901234", + "expected": "1234567890123456789012345678901234" + }, + { + "description": "Non-Canonical Parsing - Long Decimal String", + "input": + ".0000000000000000000000000000000000000000000000000000000000000000000000000000000" + + "00000000000000000000000000000000000000000000000000000000000000000000000000000000" + + "00000000000000000000000000000000000000000000000000000000000000000000000000000000" + + "00000000000000000000000000000000000000000000000000000000000000000000000000000000" + + "00000000000000000000000000000000000000000000000000000000000000000000000000000000" + + "00000000000000000000000000000000000000000000000000000000000000000000000000000000" + + "00000000000000000000000000000000000000000000000000000000000000000000000000000000" + + "00000000000000000000000000000000000000000000000000000000000000000000000000000000" + + "00000000000000000000000000000000000000000000000000000000000000000000000000000000" + + "00000000000000000000000000000000000000000000000000000000000000000000000000000000" + + "00000000000000000000000000000000000000000000000000000000000000000000000000000000" + + "00000000000000000000000000000000000000000000000000000000000000000000000000000000" + + "0000000000000000000000000000000000000001", + "expected": "1E-999" + }, + {"description": "Non-Canonical Parsing - nan", "input": "nan", "expected": "NaN"}, + {"description": "Non-Canonical Parsing - nAn", "input": "nAn", "expected": "NaN"}, + { + "description": "Non-Canonical Parsing - +infinity", + "input": "+infinity", + "expected": "Infinity" + }, + { + "description": "Non-Canonical Parsing - infinity", + "input": "infinity", + "expected": "Infinity" + }, + { + "description": "Non-Canonical Parsing - infiniTY", + "input": "infiniTY", + "expected": "Infinity" + }, + {"description": "Non-Canonical Parsing - inf", "input": "inf", "expected": "Infinity"}, + {"description": "Non-Canonical Parsing - inF", "input": "inF", "expected": "Infinity"}, + { + "description": "Non-Canonical Parsing - -infinity", + "input": "-infinity", + "expected": "-Infinity" + }, + { + "description": "Non-Canonical Parsing - -infiniTy", + "input": "-infiniTy", + "expected": "-Infinity" + }, + {"description": "Non-Canonical Parsing - -Inf", "input": "-Infinity", "expected": "-Infinity"}, + {"description": "Non-Canonical Parsing - -inf", "input": "-inf", "expected": "-Infinity"}, + {"description": "Non-Canonical Parsing - -inF", "input": "-inF", "expected": "-Infinity"}, + {"description": "Rounded Subnormal number", "input": "10E-6177", "expected": "1E-6176"}, + {"description": "Clamped", "input": "1E6112", "expected": "1.0E+6112"}, + { + "description": "Exact rounding", + "input": + "100000000000000000000000000000000000000000000000000000000000000000000000000000000" + + "000000000000000000000000000000000000000000000000000000000000000000000000000000000" + + "000000000000000000000000000000000000000000000000000000000000000000000000000000000" + + "000000000000000000000000000000000000000000000000000000000000000000000000000000000" + + "000000000000000000000000000000000000000000000000000000000000000000000000000000000" + + "000000000000000000000000000000000000000000000000000000000000000000000000000000000" + + "000000000000000000000000000000000000000000000000000000000000000000000000000000000" + + "000000000000000000000000000000000000000000000000000000000000000000000000000000000" + + "000000000000000000000000000000000000000000000000000000000000000000000000000000000" + + "000000000000000000000000000000000000000000000000000000000000000000000000000000000" + + "000000000000000000000000000000000000000000000000000000000000000000000000000000000" + + "000000000000000000000000000000000000000000000000000000000000000000000000000000000" + + "0000000000000000000000000000", + "expected": "1.000000000000000000000000000000000E+999" + } +]; - testData.forEach(function(testCase) { - print(`Test - ${testCase.description}`); - var output = NumberDecimal(testCase.input).toString(); - if (testCase.expected) { - assert.eq(output, `NumberDecimal("${testCase.expected}")`); - } else { - assert.eq(output, `NumberDecimal("${testCase.input}")`); - } - }); +testData.forEach(function(testCase) { + print(`Test - ${testCase.description}`); + var output = NumberDecimal(testCase.input).toString(); + if (testCase.expected) { + assert.eq(output, `NumberDecimal("${testCase.expected}")`); + } else { + assert.eq(output, `NumberDecimal("${testCase.input}")`); + } +}); }());
\ No newline at end of file diff --git a/jstests/decimal/decimal128_test2.js b/jstests/decimal/decimal128_test2.js index cb1ad11c0f8..ffbc3704225 100644 --- a/jstests/decimal/decimal128_test2.js +++ b/jstests/decimal/decimal128_test2.js @@ -3,317 +3,302 @@ */ (function() { - var data = [ - {"description": "[decq021] Normality", "input": "-1234567890123456789012345678901234"}, - { - "description": "[decq823] values around [u]int32 edges (zeros done earlier)", - "input": "-2147483649" - }, - { - "description": "[decq822] values around [u]int32 edges (zeros done earlier)", - "input": "-2147483648" - }, - { - "description": "[decq821] values around [u]int32 edges (zeros done earlier)", - "input": "-2147483647" - }, - { - "description": "[decq820] values around [u]int32 edges (zeros done earlier)", - "input": "-2147483646" - }, - {"description": "[decq152] fold-downs (more below)", "input": "-12345"}, - {"description": "[decq154] fold-downs (more below)", "input": "-1234"}, - {"description": "[decq006] derivative canonical plain strings", "input": "-750"}, - {"description": "[decq164] fold-downs (more below)", "input": "-123.45"}, - {"description": "[decq156] fold-downs (more below)", "input": "-123"}, - {"description": "[decq008] derivative canonical plain strings", "input": "-75.0"}, - {"description": "[decq158] fold-downs (more below)", "input": "-12"}, - { - "description": "[decq122] Nmax and similar", - "input": "-9.999999999999999999999999999999999E+6144" - }, - { - "description": "[decq002] (mostly derived from the Strawman 4 document and examples)", - "input": "-7.50" - }, - {"description": "[decq004] derivative canonical plain strings", "input": "-7.50E+3"}, - {"description": "[decq018] derivative canonical plain strings", "input": "-7.50E-7"}, - { - "description": "[decq125] Nmax and similar", - "input": "-1.234567890123456789012345678901234E+6144" - }, - { - "description": "[decq131] fold-downs (more below)", - "input": "-1.230000000000000000000000000000000E+6144" - }, - {"description": "[decq162] fold-downs (more below)", "input": "-1.23"}, - { - "description": "[decq176] Nmin and below", - "input": "-1.000000000000000000000000000000001E-6143" - }, - { - "description": "[decq174] Nmin and below", - "input": "-1.000000000000000000000000000000000E-6143" - }, - { - "description": "[decq133] fold-downs (more below)", - "input": "-1.000000000000000000000000000000000E+6144" - }, - {"description": "[decq160] fold-downs (more below)", "input": "-1"}, - {"description": "[decq172] Nmin and below", "input": "-1E-6143"}, - {"description": "[decq010] derivative canonical plain strings", "input": "-0.750"}, - {"description": "[decq012] derivative canonical plain strings", "input": "-0.0750"}, - {"description": "[decq014] derivative canonical plain strings", "input": "-0.000750"}, - {"description": "[decq016] derivative canonical plain strings", "input": "-0.00000750"}, - {"description": "[decq404] zeros", "input": "0E-6176"}, - {"description": "[decq424] negative zeros", "input": "-0E-6176"}, - {"description": "[decq407] zeros", "input": "0.00"}, - {"description": "[decq427] negative zeros", "input": "-0.00"}, - {"description": "[decq409] zeros", "input": "0"}, - {"description": "[decq428] negative zeros", "input": "-0"}, - {"description": "[decq700] Selected DPD codes", "input": "0"}, - {"description": "[decq406] zeros", "input": "0.00"}, - {"description": "[decq426] negative zeros", "input": "-0.00"}, - {"description": "[decq410] zeros", "input": "0E+3"}, - {"description": "[decq431] negative zeros", "input": "-0E+3"}, - {"description": "[decq419] clamped zeros...", "input": "0E+6111"}, - {"description": "[decq432] negative zeros", "input": "-0E+6111"}, - {"description": "[decq405] zeros", "input": "0E-6176"}, - {"description": "[decq425] negative zeros", "input": "-0E-6176"}, - {"description": "[decq508] Specials", "input": "Infinity"}, - {"description": "[decq528] Specials", "input": "-Infinity"}, - {"description": "[decq541] Specials", "input": "NaN"}, - { - "description": "[decq074] Nmin and below", - "input": "1.000000000000000000000000000000000E-6143" - }, - { - "description": "[decq602] fold-down full sequence", - "input": "1.000000000000000000000000000000000E+6144" - }, - { - "description": "[decq604] fold-down full sequence", - "input": "1.00000000000000000000000000000000E+6143" - }, - { - "description": "[decq606] fold-down full sequence", - "input": "1.0000000000000000000000000000000E+6142" - }, - { - "description": "[decq608] fold-down full sequence", - "input": "1.000000000000000000000000000000E+6141" - }, - { - "description": "[decq610] fold-down full sequence", - "input": "1.00000000000000000000000000000E+6140" - }, - { - "description": "[decq612] fold-down full sequence", - "input": "1.0000000000000000000000000000E+6139" - }, - { - "description": "[decq614] fold-down full sequence", - "input": "1.000000000000000000000000000E+6138" - }, - { - "description": "[decq616] fold-down full sequence", - "input": "1.00000000000000000000000000E+6137" - }, - { - "description": "[decq618] fold-down full sequence", - "input": "1.0000000000000000000000000E+6136" - }, - { - "description": "[decq620] fold-down full sequence", - "input": "1.000000000000000000000000E+6135" - }, - { - "description": "[decq622] fold-down full sequence", - "input": "1.00000000000000000000000E+6134" - }, - { - "description": "[decq624] fold-down full sequence", - "input": "1.0000000000000000000000E+6133" - }, - { - "description": "[decq626] fold-down full sequence", - "input": "1.000000000000000000000E+6132" - }, - { - "description": "[decq628] fold-down full sequence", - "input": "1.00000000000000000000E+6131" - }, - { - "description": "[decq630] fold-down full sequence", - "input": "1.0000000000000000000E+6130" - }, - {"description": "[decq632] fold-down full sequence", "input": "1.000000000000000000E+6129"}, - {"description": "[decq634] fold-down full sequence", "input": "1.00000000000000000E+6128"}, - {"description": "[decq636] fold-down full sequence", "input": "1.0000000000000000E+6127"}, - {"description": "[decq638] fold-down full sequence", "input": "1.000000000000000E+6126"}, - {"description": "[decq640] fold-down full sequence", "input": "1.00000000000000E+6125"}, - {"description": "[decq642] fold-down full sequence", "input": "1.0000000000000E+6124"}, - {"description": "[decq644] fold-down full sequence", "input": "1.000000000000E+6123"}, - {"description": "[decq646] fold-down full sequence", "input": "1.00000000000E+6122"}, - {"description": "[decq648] fold-down full sequence", "input": "1.0000000000E+6121"}, - {"description": "[decq650] fold-down full sequence", "input": "1.000000000E+6120"}, - {"description": "[decq652] fold-down full sequence", "input": "1.00000000E+6119"}, - {"description": "[decq654] fold-down full sequence", "input": "1.0000000E+6118"}, - {"description": "[decq656] fold-down full sequence", "input": "1.000000E+6117"}, - {"description": "[decq658] fold-down full sequence", "input": "1.00000E+6116"}, - {"description": "[decq660] fold-down full sequence", "input": "1.0000E+6115"}, - {"description": "[decq662] fold-down full sequence", "input": "1.000E+6114"}, - {"description": "[decq664] fold-down full sequence", "input": "1.00E+6113"}, - {"description": "[decq666] fold-down full sequence", "input": "1.0E+6112"}, - {"description": "[decq060] fold-downs (more below)", "input": "1"}, - {"description": "[decq670] fold-down full sequence", "input": "1E+6110"}, - {"description": "[decq668] fold-down full sequence", "input": "1E+6111"}, - {"description": "[decq072] Nmin and below", "input": "1E-6143"}, - { - "description": "[decq076] Nmin and below", - "input": "1.000000000000000000000000000000001E-6143" - }, - { - "description": "[decq036] fold-downs (more below)", - "input": "1.230000000000000000000000000000000E+6144" - }, - {"description": "[decq062] fold-downs (more below)", "input": "1.23"}, - { - "description": "[decq034] Nmax and similar", - "input": "1.234567890123456789012345678901234E+6144" - }, - {"description": "[decq441] exponent lengths", "input": "7"}, - {"description": "[decq449] exponent lengths", "input": "7E+5999"}, - {"description": "[decq447] exponent lengths", "input": "7E+999"}, - {"description": "[decq445] exponent lengths", "input": "7E+99"}, - {"description": "[decq443] exponent lengths", "input": "7E+9"}, - { - "description": "[decq842] VG testcase", - "input": "7.049000000000010795488000000000000E-3097" - }, - {"description": "[decq841] VG testcase", "input": "8.000000000000000000E-1550"}, - {"description": "[decq840] VG testcase", "input": "8.81125000000001349436E-1548"}, - {"description": "[decq701] Selected DPD codes", "input": "9"}, - { - "description": "[decq032] Nmax and similar", - "input": "9.999999999999999999999999999999999E+6144" - }, - {"description": "[decq702] Selected DPD codes", "input": "10"}, - {"description": "[decq057] fold-downs (more below)", "input": "12"}, - {"description": "[decq703] Selected DPD codes", "input": "19"}, - {"description": "[decq704] Selected DPD codes", "input": "20"}, - {"description": "[decq705] Selected DPD codes", "input": "29"}, - {"description": "[decq706] Selected DPD codes", "input": "30"}, - {"description": "[decq707] Selected DPD codes", "input": "39"}, - {"description": "[decq708] Selected DPD codes", "input": "40"}, - {"description": "[decq709] Selected DPD codes", "input": "49"}, - {"description": "[decq710] Selected DPD codes", "input": "50"}, - {"description": "[decq711] Selected DPD codes", "input": "59"}, - {"description": "[decq712] Selected DPD codes", "input": "60"}, - {"description": "[decq713] Selected DPD codes", "input": "69"}, - {"description": "[decq714] Selected DPD codes", "input": "70"}, - {"description": "[decq715] Selected DPD codes", "input": "71"}, - {"description": "[decq716] Selected DPD codes", "input": "72"}, - {"description": "[decq717] Selected DPD codes", "input": "73"}, - {"description": "[decq718] Selected DPD codes", "input": "74"}, - {"description": "[decq719] Selected DPD codes", "input": "75"}, - {"description": "[decq720] Selected DPD codes", "input": "76"}, - {"description": "[decq721] Selected DPD codes", "input": "77"}, - {"description": "[decq722] Selected DPD codes", "input": "78"}, - {"description": "[decq723] Selected DPD codes", "input": "79"}, - {"description": "[decq056] fold-downs (more below)", "input": "123"}, - {"description": "[decq064] fold-downs (more below)", "input": "123.45"}, - {"description": "[decq732] Selected DPD codes", "input": "520"}, - {"description": "[decq733] Selected DPD codes", "input": "521"}, - {"description": "[decq740] DPD: one of each of the huffman groups", "input": "777"}, - {"description": "[decq741] DPD: one of each of the huffman groups", "input": "778"}, - {"description": "[decq742] DPD: one of each of the huffman groups", "input": "787"}, - {"description": "[decq746] DPD: one of each of the huffman groups", "input": "799"}, - {"description": "[decq743] DPD: one of each of the huffman groups", "input": "877"}, - { - "description": "[decq753] DPD all-highs cases (includes the 24 redundant codes)", - "input": "888" - }, - { - "description": "[decq754] DPD all-highs cases (includes the 24 redundant codes)", - "input": "889" - }, - { - "description": "[decq760] DPD all-highs cases (includes the 24 redundant codes)", - "input": "898" - }, - { - "description": "[decq764] DPD all-highs cases (includes the 24 redundant codes)", - "input": "899" - }, - {"description": "[decq745] DPD: one of each of the huffman groups", "input": "979"}, - { - "description": "[decq770] DPD all-highs cases (includes the 24 redundant codes)", - "input": "988" - }, - { - "description": "[decq774] DPD all-highs cases (includes the 24 redundant codes)", - "input": "989" - }, - {"description": "[decq730] Selected DPD codes", "input": "994"}, - {"description": "[decq731] Selected DPD codes", "input": "995"}, - {"description": "[decq744] DPD: one of each of the huffman groups", "input": "997"}, - { - "description": "[decq780] DPD all-highs cases (includes the 24 redundant codes)", - "input": "998" - }, - { - "description": "[decq787] DPD all-highs cases (includes the 24 redundant codes)", - "input": "999" - }, - {"description": "[decq053] fold-downs (more below)", "input": "1234"}, - {"description": "[decq052] fold-downs (more below)", "input": "12345"}, - {"description": "[decq792] Miscellaneous (testers' queries, etc.)", "input": "30000"}, - {"description": "[decq793] Miscellaneous (testers' queries, etc.)", "input": "890000"}, - { - "description": "[decq824] values around [u]int32 edges (zeros done earlier)", - "input": "2147483646" - }, - { - "description": "[decq825] values around [u]int32 edges (zeros done earlier)", - "input": "2147483647" - }, - { - "description": "[decq826] values around [u]int32 edges (zeros done earlier)", - "input": "2147483648" - }, - { - "description": "[decq827] values around [u]int32 edges (zeros done earlier)", - "input": "2147483649" - }, - { - "description": "[decq828] values around [u]int32 edges (zeros done earlier)", - "input": "4294967294" - }, - { - "description": "[decq829] values around [u]int32 edges (zeros done earlier)", - "input": "4294967295" - }, - { - "description": "[decq830] values around [u]int32 edges (zeros done earlier)", - "input": "4294967296" - }, - { - "description": "[decq831] values around [u]int32 edges (zeros done earlier)", - "input": "4294967297" - }, - {"description": "[decq022] Normality", "input": "1111111111111111111111111111111111"}, - {"description": "[decq020] Normality", "input": "1234567890123456789012345678901234"}, - {"description": "[decq550] Specials", "input": "9999999999999999999999999999999999"} - ]; +var data = [ + {"description": "[decq021] Normality", "input": "-1234567890123456789012345678901234"}, + { + "description": "[decq823] values around [u]int32 edges (zeros done earlier)", + "input": "-2147483649" + }, + { + "description": "[decq822] values around [u]int32 edges (zeros done earlier)", + "input": "-2147483648" + }, + { + "description": "[decq821] values around [u]int32 edges (zeros done earlier)", + "input": "-2147483647" + }, + { + "description": "[decq820] values around [u]int32 edges (zeros done earlier)", + "input": "-2147483646" + }, + {"description": "[decq152] fold-downs (more below)", "input": "-12345"}, + {"description": "[decq154] fold-downs (more below)", "input": "-1234"}, + {"description": "[decq006] derivative canonical plain strings", "input": "-750"}, + {"description": "[decq164] fold-downs (more below)", "input": "-123.45"}, + {"description": "[decq156] fold-downs (more below)", "input": "-123"}, + {"description": "[decq008] derivative canonical plain strings", "input": "-75.0"}, + {"description": "[decq158] fold-downs (more below)", "input": "-12"}, + { + "description": "[decq122] Nmax and similar", + "input": "-9.999999999999999999999999999999999E+6144" + }, + { + "description": "[decq002] (mostly derived from the Strawman 4 document and examples)", + "input": "-7.50" + }, + {"description": "[decq004] derivative canonical plain strings", "input": "-7.50E+3"}, + {"description": "[decq018] derivative canonical plain strings", "input": "-7.50E-7"}, + { + "description": "[decq125] Nmax and similar", + "input": "-1.234567890123456789012345678901234E+6144" + }, + { + "description": "[decq131] fold-downs (more below)", + "input": "-1.230000000000000000000000000000000E+6144" + }, + {"description": "[decq162] fold-downs (more below)", "input": "-1.23"}, + { + "description": "[decq176] Nmin and below", + "input": "-1.000000000000000000000000000000001E-6143" + }, + { + "description": "[decq174] Nmin and below", + "input": "-1.000000000000000000000000000000000E-6143" + }, + { + "description": "[decq133] fold-downs (more below)", + "input": "-1.000000000000000000000000000000000E+6144" + }, + {"description": "[decq160] fold-downs (more below)", "input": "-1"}, + {"description": "[decq172] Nmin and below", "input": "-1E-6143"}, + {"description": "[decq010] derivative canonical plain strings", "input": "-0.750"}, + {"description": "[decq012] derivative canonical plain strings", "input": "-0.0750"}, + {"description": "[decq014] derivative canonical plain strings", "input": "-0.000750"}, + {"description": "[decq016] derivative canonical plain strings", "input": "-0.00000750"}, + {"description": "[decq404] zeros", "input": "0E-6176"}, + {"description": "[decq424] negative zeros", "input": "-0E-6176"}, + {"description": "[decq407] zeros", "input": "0.00"}, + {"description": "[decq427] negative zeros", "input": "-0.00"}, + {"description": "[decq409] zeros", "input": "0"}, + {"description": "[decq428] negative zeros", "input": "-0"}, + {"description": "[decq700] Selected DPD codes", "input": "0"}, + {"description": "[decq406] zeros", "input": "0.00"}, + {"description": "[decq426] negative zeros", "input": "-0.00"}, + {"description": "[decq410] zeros", "input": "0E+3"}, + {"description": "[decq431] negative zeros", "input": "-0E+3"}, + {"description": "[decq419] clamped zeros...", "input": "0E+6111"}, + {"description": "[decq432] negative zeros", "input": "-0E+6111"}, + {"description": "[decq405] zeros", "input": "0E-6176"}, + {"description": "[decq425] negative zeros", "input": "-0E-6176"}, + {"description": "[decq508] Specials", "input": "Infinity"}, + {"description": "[decq528] Specials", "input": "-Infinity"}, + {"description": "[decq541] Specials", "input": "NaN"}, + { + "description": "[decq074] Nmin and below", + "input": "1.000000000000000000000000000000000E-6143" + }, + { + "description": "[decq602] fold-down full sequence", + "input": "1.000000000000000000000000000000000E+6144" + }, + { + "description": "[decq604] fold-down full sequence", + "input": "1.00000000000000000000000000000000E+6143" + }, + { + "description": "[decq606] fold-down full sequence", + "input": "1.0000000000000000000000000000000E+6142" + }, + { + "description": "[decq608] fold-down full sequence", + "input": "1.000000000000000000000000000000E+6141" + }, + { + "description": "[decq610] fold-down full sequence", + "input": "1.00000000000000000000000000000E+6140" + }, + { + "description": "[decq612] fold-down full sequence", + "input": "1.0000000000000000000000000000E+6139" + }, + { + "description": "[decq614] fold-down full sequence", + "input": "1.000000000000000000000000000E+6138" + }, + { + "description": "[decq616] fold-down full sequence", + "input": "1.00000000000000000000000000E+6137" + }, + { + "description": "[decq618] fold-down full sequence", + "input": "1.0000000000000000000000000E+6136" + }, + { + "description": "[decq620] fold-down full sequence", + "input": "1.000000000000000000000000E+6135" + }, + { + "description": "[decq622] fold-down full sequence", + "input": "1.00000000000000000000000E+6134" + }, + {"description": "[decq624] fold-down full sequence", "input": "1.0000000000000000000000E+6133"}, + {"description": "[decq626] fold-down full sequence", "input": "1.000000000000000000000E+6132"}, + {"description": "[decq628] fold-down full sequence", "input": "1.00000000000000000000E+6131"}, + {"description": "[decq630] fold-down full sequence", "input": "1.0000000000000000000E+6130"}, + {"description": "[decq632] fold-down full sequence", "input": "1.000000000000000000E+6129"}, + {"description": "[decq634] fold-down full sequence", "input": "1.00000000000000000E+6128"}, + {"description": "[decq636] fold-down full sequence", "input": "1.0000000000000000E+6127"}, + {"description": "[decq638] fold-down full sequence", "input": "1.000000000000000E+6126"}, + {"description": "[decq640] fold-down full sequence", "input": "1.00000000000000E+6125"}, + {"description": "[decq642] fold-down full sequence", "input": "1.0000000000000E+6124"}, + {"description": "[decq644] fold-down full sequence", "input": "1.000000000000E+6123"}, + {"description": "[decq646] fold-down full sequence", "input": "1.00000000000E+6122"}, + {"description": "[decq648] fold-down full sequence", "input": "1.0000000000E+6121"}, + {"description": "[decq650] fold-down full sequence", "input": "1.000000000E+6120"}, + {"description": "[decq652] fold-down full sequence", "input": "1.00000000E+6119"}, + {"description": "[decq654] fold-down full sequence", "input": "1.0000000E+6118"}, + {"description": "[decq656] fold-down full sequence", "input": "1.000000E+6117"}, + {"description": "[decq658] fold-down full sequence", "input": "1.00000E+6116"}, + {"description": "[decq660] fold-down full sequence", "input": "1.0000E+6115"}, + {"description": "[decq662] fold-down full sequence", "input": "1.000E+6114"}, + {"description": "[decq664] fold-down full sequence", "input": "1.00E+6113"}, + {"description": "[decq666] fold-down full sequence", "input": "1.0E+6112"}, + {"description": "[decq060] fold-downs (more below)", "input": "1"}, + {"description": "[decq670] fold-down full sequence", "input": "1E+6110"}, + {"description": "[decq668] fold-down full sequence", "input": "1E+6111"}, + {"description": "[decq072] Nmin and below", "input": "1E-6143"}, + { + "description": "[decq076] Nmin and below", + "input": "1.000000000000000000000000000000001E-6143" + }, + { + "description": "[decq036] fold-downs (more below)", + "input": "1.230000000000000000000000000000000E+6144" + }, + {"description": "[decq062] fold-downs (more below)", "input": "1.23"}, + { + "description": "[decq034] Nmax and similar", + "input": "1.234567890123456789012345678901234E+6144" + }, + {"description": "[decq441] exponent lengths", "input": "7"}, + {"description": "[decq449] exponent lengths", "input": "7E+5999"}, + {"description": "[decq447] exponent lengths", "input": "7E+999"}, + {"description": "[decq445] exponent lengths", "input": "7E+99"}, + {"description": "[decq443] exponent lengths", "input": "7E+9"}, + {"description": "[decq842] VG testcase", "input": "7.049000000000010795488000000000000E-3097"}, + {"description": "[decq841] VG testcase", "input": "8.000000000000000000E-1550"}, + {"description": "[decq840] VG testcase", "input": "8.81125000000001349436E-1548"}, + {"description": "[decq701] Selected DPD codes", "input": "9"}, + { + "description": "[decq032] Nmax and similar", + "input": "9.999999999999999999999999999999999E+6144" + }, + {"description": "[decq702] Selected DPD codes", "input": "10"}, + {"description": "[decq057] fold-downs (more below)", "input": "12"}, + {"description": "[decq703] Selected DPD codes", "input": "19"}, + {"description": "[decq704] Selected DPD codes", "input": "20"}, + {"description": "[decq705] Selected DPD codes", "input": "29"}, + {"description": "[decq706] Selected DPD codes", "input": "30"}, + {"description": "[decq707] Selected DPD codes", "input": "39"}, + {"description": "[decq708] Selected DPD codes", "input": "40"}, + {"description": "[decq709] Selected DPD codes", "input": "49"}, + {"description": "[decq710] Selected DPD codes", "input": "50"}, + {"description": "[decq711] Selected DPD codes", "input": "59"}, + {"description": "[decq712] Selected DPD codes", "input": "60"}, + {"description": "[decq713] Selected DPD codes", "input": "69"}, + {"description": "[decq714] Selected DPD codes", "input": "70"}, + {"description": "[decq715] Selected DPD codes", "input": "71"}, + {"description": "[decq716] Selected DPD codes", "input": "72"}, + {"description": "[decq717] Selected DPD codes", "input": "73"}, + {"description": "[decq718] Selected DPD codes", "input": "74"}, + {"description": "[decq719] Selected DPD codes", "input": "75"}, + {"description": "[decq720] Selected DPD codes", "input": "76"}, + {"description": "[decq721] Selected DPD codes", "input": "77"}, + {"description": "[decq722] Selected DPD codes", "input": "78"}, + {"description": "[decq723] Selected DPD codes", "input": "79"}, + {"description": "[decq056] fold-downs (more below)", "input": "123"}, + {"description": "[decq064] fold-downs (more below)", "input": "123.45"}, + {"description": "[decq732] Selected DPD codes", "input": "520"}, + {"description": "[decq733] Selected DPD codes", "input": "521"}, + {"description": "[decq740] DPD: one of each of the huffman groups", "input": "777"}, + {"description": "[decq741] DPD: one of each of the huffman groups", "input": "778"}, + {"description": "[decq742] DPD: one of each of the huffman groups", "input": "787"}, + {"description": "[decq746] DPD: one of each of the huffman groups", "input": "799"}, + {"description": "[decq743] DPD: one of each of the huffman groups", "input": "877"}, + { + "description": "[decq753] DPD all-highs cases (includes the 24 redundant codes)", + "input": "888" + }, + { + "description": "[decq754] DPD all-highs cases (includes the 24 redundant codes)", + "input": "889" + }, + { + "description": "[decq760] DPD all-highs cases (includes the 24 redundant codes)", + "input": "898" + }, + { + "description": "[decq764] DPD all-highs cases (includes the 24 redundant codes)", + "input": "899" + }, + {"description": "[decq745] DPD: one of each of the huffman groups", "input": "979"}, + { + "description": "[decq770] DPD all-highs cases (includes the 24 redundant codes)", + "input": "988" + }, + { + "description": "[decq774] DPD all-highs cases (includes the 24 redundant codes)", + "input": "989" + }, + {"description": "[decq730] Selected DPD codes", "input": "994"}, + {"description": "[decq731] Selected DPD codes", "input": "995"}, + {"description": "[decq744] DPD: one of each of the huffman groups", "input": "997"}, + { + "description": "[decq780] DPD all-highs cases (includes the 24 redundant codes)", + "input": "998" + }, + { + "description": "[decq787] DPD all-highs cases (includes the 24 redundant codes)", + "input": "999" + }, + {"description": "[decq053] fold-downs (more below)", "input": "1234"}, + {"description": "[decq052] fold-downs (more below)", "input": "12345"}, + {"description": "[decq792] Miscellaneous (testers' queries, etc.)", "input": "30000"}, + {"description": "[decq793] Miscellaneous (testers' queries, etc.)", "input": "890000"}, + { + "description": "[decq824] values around [u]int32 edges (zeros done earlier)", + "input": "2147483646" + }, + { + "description": "[decq825] values around [u]int32 edges (zeros done earlier)", + "input": "2147483647" + }, + { + "description": "[decq826] values around [u]int32 edges (zeros done earlier)", + "input": "2147483648" + }, + { + "description": "[decq827] values around [u]int32 edges (zeros done earlier)", + "input": "2147483649" + }, + { + "description": "[decq828] values around [u]int32 edges (zeros done earlier)", + "input": "4294967294" + }, + { + "description": "[decq829] values around [u]int32 edges (zeros done earlier)", + "input": "4294967295" + }, + { + "description": "[decq830] values around [u]int32 edges (zeros done earlier)", + "input": "4294967296" + }, + { + "description": "[decq831] values around [u]int32 edges (zeros done earlier)", + "input": "4294967297" + }, + {"description": "[decq022] Normality", "input": "1111111111111111111111111111111111"}, + {"description": "[decq020] Normality", "input": "1234567890123456789012345678901234"}, + {"description": "[decq550] Specials", "input": "9999999999999999999999999999999999"} +]; - data.forEach(function(testCase) { - print(`Test - ${testCase.description}`); - var output = NumberDecimal(testCase.input).toString(); - if (testCase.expected) { - assert.eq(output, `NumberDecimal("${testCase.expected}")`); - } else { - assert.eq(output, `NumberDecimal("${testCase.input}")`); - } - }); +data.forEach(function(testCase) { + print(`Test - ${testCase.description}`); + var output = NumberDecimal(testCase.input).toString(); + if (testCase.expected) { + assert.eq(output, `NumberDecimal("${testCase.expected}")`); + } else { + assert.eq(output, `NumberDecimal("${testCase.input}")`); + } +}); }());
\ No newline at end of file diff --git a/jstests/decimal/decimal128_test3.js b/jstests/decimal/decimal128_test3.js index b4184615b5f..b50f3e45bd1 100644 --- a/jstests/decimal/decimal128_test3.js +++ b/jstests/decimal/decimal128_test3.js @@ -3,670 +3,579 @@ */ (function() { - var data = [ - { - "description": "[basx066] strings without E cannot generate E in result", - "input": "-00345678.5432", - "expected": "-345678.5432" - }, - { - "description": "[basx065] strings without E cannot generate E in result", - "input": "-0345678.5432", - "expected": "-345678.5432" - }, - { - "description": "[basx064] strings without E cannot generate E in result", - "input": "-345678.5432" - }, - {"description": "[basx041] strings without E cannot generate E in result", "input": "-76"}, - { - "description": "[basx027] conform to rules and exponent will be in permitted range).", - "input": "-9.999" - }, - { - "description": "[basx026] conform to rules and exponent will be in permitted range).", - "input": "-9.119" - }, - { - "description": "[basx025] conform to rules and exponent will be in permitted range).", - "input": "-9.11" - }, - { - "description": "[basx024] conform to rules and exponent will be in permitted range).", - "input": "-9.1" - }, - { - "description": "[dqbsr531] negatives (Rounded)", - "input": "-1.1111111111111111111111111111123450", - "expected": "-1.111111111111111111111111111112345" - }, - { - "description": "[basx022] conform to rules and exponent will be in permitted range).", - "input": "-1.0" - }, - { - "description": "[basx021] conform to rules and exponent will be in permitted range).", - "input": "-1" - }, - {"description": "[basx601] Zeros", "input": "0.000000000", "expected": "0E-9"}, - {"description": "[basx622] Zeros", "input": "-0.000000000", "expected": "-0E-9"}, - {"description": "[basx602] Zeros", "input": "0.00000000", "expected": "0E-8"}, - {"description": "[basx621] Zeros", "input": "-0.00000000", "expected": "-0E-8"}, - {"description": "[basx603] Zeros", "input": "0.0000000", "expected": "0E-7"}, - {"description": "[basx620] Zeros", "input": "-0.0000000", "expected": "-0E-7"}, - {"description": "[basx604] Zeros", "input": "0.000000"}, - {"description": "[basx619] Zeros", "input": "-0.000000"}, - {"description": "[basx605] Zeros", "input": "0.00000"}, - {"description": "[basx618] Zeros", "input": "-0.00000"}, - {"description": "[basx680] Zeros", "input": "000000.", "expected": "0"}, - {"description": "[basx606] Zeros", "input": "0.0000"}, - {"description": "[basx617] Zeros", "input": "-0.0000"}, - {"description": "[basx681] Zeros", "input": "00000.", "expected": "0"}, - {"description": "[basx686] Zeros", "input": "+00000.", "expected": "0"}, - {"description": "[basx687] Zeros", "input": "-00000.", "expected": "-0"}, - { - "description": "[basx019] conform to rules and exponent will be in permitted range).", - "input": "-00.00", - "expected": "-0.00" - }, - {"description": "[basx607] Zeros", "input": "0.000"}, - {"description": "[basx616] Zeros", "input": "-0.000"}, - {"description": "[basx682] Zeros", "input": "0000.", "expected": "0"}, - {"description": "[basx155] Numbers with E", "input": "0.000e+0", "expected": "0.000"}, - {"description": "[basx130] Numbers with E", "input": "0.000E-1", "expected": "0.0000"}, - { - "description": "[basx290] some more negative zeros [systematic tests below]", - "input": "-0.000E-1", - "expected": "-0.0000" - }, - {"description": "[basx131] Numbers with E", "input": "0.000E-2", "expected": "0.00000"}, - { - "description": "[basx291] some more negative zeros [systematic tests below]", - "input": "-0.000E-2", - "expected": "-0.00000" - }, - {"description": "[basx132] Numbers with E", "input": "0.000E-3", "expected": "0.000000"}, - { - "description": "[basx292] some more negative zeros [systematic tests below]", - "input": "-0.000E-3", - "expected": "-0.000000" - }, - {"description": "[basx133] Numbers with E", "input": "0.000E-4", "expected": "0E-7"}, - { - "description": "[basx293] some more negative zeros [systematic tests below]", - "input": "-0.000E-4", - "expected": "-0E-7" - }, - {"description": "[basx608] Zeros", "input": "0.00"}, - {"description": "[basx615] Zeros", "input": "-0.00"}, - {"description": "[basx683] Zeros", "input": "000.", "expected": "0"}, - {"description": "[basx630] Zeros", "input": "0.00E+0", "expected": "0.00"}, - {"description": "[basx670] Zeros", "input": "0.00E-0", "expected": "0.00"}, - {"description": "[basx631] Zeros", "input": "0.00E+1", "expected": "0.0"}, - {"description": "[basx671] Zeros", "input": "0.00E-1", "expected": "0.000"}, - {"description": "[basx134] Numbers with E", "input": "0.00E-2", "expected": "0.0000"}, - { - "description": "[basx294] some more negative zeros [systematic tests below]", - "input": "-0.00E-2", - "expected": "-0.0000" - }, - {"description": "[basx632] Zeros", "input": "0.00E+2", "expected": "0"}, - {"description": "[basx672] Zeros", "input": "0.00E-2", "expected": "0.0000"}, - {"description": "[basx135] Numbers with E", "input": "0.00E-3", "expected": "0.00000"}, - { - "description": "[basx295] some more negative zeros [systematic tests below]", - "input": "-0.00E-3", - "expected": "-0.00000" - }, - {"description": "[basx633] Zeros", "input": "0.00E+3", "expected": "0E+1"}, - {"description": "[basx673] Zeros", "input": "0.00E-3", "expected": "0.00000"}, - {"description": "[basx136] Numbers with E", "input": "0.00E-4", "expected": "0.000000"}, - {"description": "[basx674] Zeros", "input": "0.00E-4", "expected": "0.000000"}, - {"description": "[basx634] Zeros", "input": "0.00E+4", "expected": "0E+2"}, - {"description": "[basx137] Numbers with E", "input": "0.00E-5", "expected": "0E-7"}, - {"description": "[basx635] Zeros", "input": "0.00E+5", "expected": "0E+3"}, - {"description": "[basx675] Zeros", "input": "0.00E-5", "expected": "0E-7"}, - {"description": "[basx636] Zeros", "input": "0.00E+6", "expected": "0E+4"}, - {"description": "[basx676] Zeros", "input": "0.00E-6", "expected": "0E-8"}, - {"description": "[basx637] Zeros", "input": "0.00E+7", "expected": "0E+5"}, - {"description": "[basx677] Zeros", "input": "0.00E-7", "expected": "0E-9"}, - {"description": "[basx638] Zeros", "input": "0.00E+8", "expected": "0E+6"}, - {"description": "[basx678] Zeros", "input": "0.00E-8", "expected": "0E-10"}, - {"description": "[basx149] Numbers with E", "input": "000E+9", "expected": "0E+9"}, - {"description": "[basx639] Zeros", "input": "0.00E+9", "expected": "0E+7"}, - {"description": "[basx679] Zeros", "input": "0.00E-9", "expected": "0E-11"}, - { - "description": "[basx063] strings without E cannot generate E in result", - "input": "+00345678.5432", - "expected": "345678.5432" - }, - { - "description": "[basx018] conform to rules and exponent will be in permitted range).", - "input": "-0.0" - }, - {"description": "[basx609] Zeros", "input": "0.0"}, - {"description": "[basx614] Zeros", "input": "-0.0"}, - {"description": "[basx684] Zeros", "input": "00.", "expected": "0"}, - {"description": "[basx640] Zeros", "input": "0.0E+0", "expected": "0.0"}, - {"description": "[basx660] Zeros", "input": "0.0E-0", "expected": "0.0"}, - {"description": "[basx641] Zeros", "input": "0.0E+1", "expected": "0"}, - {"description": "[basx661] Zeros", "input": "0.0E-1", "expected": "0.00"}, - { - "description": "[basx296] some more negative zeros [systematic tests below]", - "input": "-0.0E-2", - "expected": "-0.000" - }, - {"description": "[basx642] Zeros", "input": "0.0E+2", "expected": "0E+1"}, - {"description": "[basx662] Zeros", "input": "0.0E-2", "expected": "0.000"}, - { - "description": "[basx297] some more negative zeros [systematic tests below]", - "input": "-0.0E-3", - "expected": "-0.0000" - }, - {"description": "[basx643] Zeros", "input": "0.0E+3", "expected": "0E+2"}, - {"description": "[basx663] Zeros", "input": "0.0E-3", "expected": "0.0000"}, - {"description": "[basx644] Zeros", "input": "0.0E+4", "expected": "0E+3"}, - {"description": "[basx664] Zeros", "input": "0.0E-4", "expected": "0.00000"}, - {"description": "[basx645] Zeros", "input": "0.0E+5", "expected": "0E+4"}, - {"description": "[basx665] Zeros", "input": "0.0E-5", "expected": "0.000000"}, - {"description": "[basx646] Zeros", "input": "0.0E+6", "expected": "0E+5"}, - {"description": "[basx666] Zeros", "input": "0.0E-6", "expected": "0E-7"}, - {"description": "[basx647] Zeros", "input": "0.0E+7", "expected": "0E+6"}, - {"description": "[basx667] Zeros", "input": "0.0E-7", "expected": "0E-8"}, - {"description": "[basx648] Zeros", "input": "0.0E+8", "expected": "0E+7"}, - {"description": "[basx668] Zeros", "input": "0.0E-8", "expected": "0E-9"}, - {"description": "[basx160] Numbers with E", "input": "00E+9", "expected": "0E+9"}, - {"description": "[basx161] Numbers with E", "input": "00E-9", "expected": "0E-9"}, - {"description": "[basx649] Zeros", "input": "0.0E+9", "expected": "0E+8"}, - {"description": "[basx669] Zeros", "input": "0.0E-9", "expected": "0E-10"}, - { - "description": "[basx062] strings without E cannot generate E in result", - "input": "+0345678.5432", - "expected": "345678.5432" - }, - { - "description": "[basx001] conform to rules and exponent will be in permitted range).", - "input": "0" - }, - { - "description": "[basx017] conform to rules and exponent will be in permitted range).", - "input": "-0" - }, - {"description": "[basx611] Zeros", "input": "0.", "expected": "0"}, - {"description": "[basx613] Zeros", "input": "-0.", "expected": "-0"}, - {"description": "[basx685] Zeros", "input": "0.", "expected": "0"}, - {"description": "[basx688] Zeros", "input": "+0.", "expected": "0"}, - {"description": "[basx689] Zeros", "input": "-0.", "expected": "-0"}, - {"description": "[basx650] Zeros", "input": "0E+0", "expected": "0"}, - {"description": "[basx651] Zeros", "input": "0E+1"}, - { - "description": "[basx298] some more negative zeros [systematic tests below]", - "input": "-0E-2", - "expected": "-0.00" - }, - {"description": "[basx652] Zeros", "input": "0E+2"}, - { - "description": "[basx299] some more negative zeros [systematic tests below]", - "input": "-0E-3", - "expected": "-0.000" - }, - {"description": "[basx653] Zeros", "input": "0E+3"}, - {"description": "[basx654] Zeros", "input": "0E+4"}, - {"description": "[basx655] Zeros", "input": "0E+5"}, - {"description": "[basx656] Zeros", "input": "0E+6"}, - {"description": "[basx657] Zeros", "input": "0E+7"}, - {"description": "[basx658] Zeros", "input": "0E+8"}, - {"description": "[basx138] Numbers with E", "input": "+0E+9", "expected": "0E+9"}, - {"description": "[basx139] Numbers with E", "input": "-0E+9"}, - {"description": "[basx144] Numbers with E", "input": "0E+9"}, - {"description": "[basx154] Numbers with E", "input": "0E9", "expected": "0E+9"}, - {"description": "[basx659] Zeros", "input": "0E+9"}, - { - "description": "[basx042] strings without E cannot generate E in result", - "input": "+12.76", - "expected": "12.76" - }, - {"description": "[basx143] Numbers with E", "input": "+1E+009", "expected": "1E+9"}, - { - "description": "[basx061] strings without E cannot generate E in result", - "input": "+345678.5432", - "expected": "345678.5432" - }, - { - "description": "[basx036] conform to rules and exponent will be in permitted range).", - "input": "0.0000000123456789", - "expected": "1.23456789E-8" - }, - { - "description": "[basx035] conform to rules and exponent will be in permitted range).", - "input": "0.000000123456789", - "expected": "1.23456789E-7" - }, - { - "description": "[basx034] conform to rules and exponent will be in permitted range).", - "input": "0.00000123456789" - }, - { - "description": "[basx053] strings without E cannot generate E in result", - "input": "0.0000050" - }, - { - "description": "[basx033] conform to rules and exponent will be in permitted range).", - "input": "0.0000123456789" - }, - { - "description": "[basx016] conform to rules and exponent will be in permitted range).", - "input": "0.012" - }, - { - "description": "[basx015] conform to rules and exponent will be in permitted range).", - "input": "0.123" - }, - { - "description": "[basx037] conform to rules and exponent will be in permitted range).", - "input": "0.123456789012344" - }, - { - "description": "[basx038] conform to rules and exponent will be in permitted range).", - "input": "0.123456789012345" - }, - {"description": "[basx250] Numbers with E", "input": "0.1265"}, - {"description": "[basx257] Numbers with E", "input": "0.1265E-0", "expected": "0.1265"}, - {"description": "[basx256] Numbers with E", "input": "0.1265E-1", "expected": "0.01265"}, - {"description": "[basx258] Numbers with E", "input": "0.1265E+1", "expected": "1.265"}, - {"description": "[basx251] Numbers with E", "input": "0.1265E-20", "expected": "1.265E-21"}, - {"description": "[basx263] Numbers with E", "input": "0.1265E+20", "expected": "1.265E+19"}, - {"description": "[basx255] Numbers with E", "input": "0.1265E-2", "expected": "0.001265"}, - {"description": "[basx259] Numbers with E", "input": "0.1265E+2", "expected": "12.65"}, - {"description": "[basx254] Numbers with E", "input": "0.1265E-3", "expected": "0.0001265"}, - {"description": "[basx260] Numbers with E", "input": "0.1265E+3", "expected": "126.5"}, - {"description": "[basx253] Numbers with E", "input": "0.1265E-4", "expected": "0.00001265"}, - {"description": "[basx261] Numbers with E", "input": "0.1265E+4", "expected": "1265"}, - {"description": "[basx252] Numbers with E", "input": "0.1265E-8", "expected": "1.265E-9"}, - {"description": "[basx262] Numbers with E", "input": "0.1265E+8", "expected": "1.265E+7"}, - {"description": "[basx159] Numbers with E", "input": "0.73e-7", "expected": "7.3E-8"}, - { - "description": "[basx004] conform to rules and exponent will be in permitted range).", - "input": "1.00" - }, - { - "description": "[basx003] conform to rules and exponent will be in permitted range).", - "input": "1.0" - }, - { - "description": "[basx002] conform to rules and exponent will be in permitted range).", - "input": "1" - }, - {"description": "[basx148] Numbers with E", "input": "1E+009", "expected": "1E+9"}, - {"description": "[basx153] Numbers with E", "input": "1E009", "expected": "1E+9"}, - {"description": "[basx141] Numbers with E", "input": "1e+09", "expected": "1E+9"}, - {"description": "[basx146] Numbers with E", "input": "1E+09", "expected": "1E+9"}, - {"description": "[basx151] Numbers with E", "input": "1e09", "expected": "1E+9"}, - {"description": "[basx142] Numbers with E", "input": "1E+90"}, - {"description": "[basx147] Numbers with E", "input": "1e+90", "expected": "1E+90"}, - {"description": "[basx152] Numbers with E", "input": "1E90", "expected": "1E+90"}, - {"description": "[basx140] Numbers with E", "input": "1E+9"}, - {"description": "[basx150] Numbers with E", "input": "1E9", "expected": "1E+9"}, - { - "description": "[basx014] conform to rules and exponent will be in permitted range).", - "input": "1.234" - }, - {"description": "[basx170] Numbers with E", "input": "1.265"}, - {"description": "[basx177] Numbers with E", "input": "1.265E-0", "expected": "1.265"}, - {"description": "[basx176] Numbers with E", "input": "1.265E-1", "expected": "0.1265"}, - {"description": "[basx178] Numbers with E", "input": "1.265E+1", "expected": "12.65"}, - {"description": "[basx171] Numbers with E", "input": "1.265E-20"}, - {"description": "[basx183] Numbers with E", "input": "1.265E+20"}, - {"description": "[basx175] Numbers with E", "input": "1.265E-2", "expected": "0.01265"}, - {"description": "[basx179] Numbers with E", "input": "1.265E+2", "expected": "126.5"}, - {"description": "[basx174] Numbers with E", "input": "1.265E-3", "expected": "0.001265"}, - {"description": "[basx180] Numbers with E", "input": "1.265E+3", "expected": "1265"}, - {"description": "[basx173] Numbers with E", "input": "1.265E-4", "expected": "0.0001265"}, - {"description": "[basx181] Numbers with E", "input": "1.265E+4"}, - {"description": "[basx172] Numbers with E", "input": "1.265E-8"}, - {"description": "[basx182] Numbers with E", "input": "1.265E+8"}, - {"description": "[basx157] Numbers with E", "input": "4E+9"}, - {"description": "[basx067] examples", "input": "5E-6", "expected": "0.000005"}, - {"description": "[basx069] examples", "input": "5E-7"}, - {"description": "[basx385] Engineering notation tests", "input": "7E0", "expected": "7"}, - { - "description": "[basx365] Engineering notation tests", - "input": "7E10", - "expected": "7E+10" - }, - {"description": "[basx405] Engineering notation tests", "input": "7E-10"}, - { - "description": "[basx363] Engineering notation tests", - "input": "7E11", - "expected": "7E+11" - }, - {"description": "[basx407] Engineering notation tests", "input": "7E-11"}, - { - "description": "[basx361] Engineering notation tests", - "input": "7E12", - "expected": "7E+12" - }, - {"description": "[basx409] Engineering notation tests", "input": "7E-12"}, - {"description": "[basx411] Engineering notation tests", "input": "7E-13"}, - {"description": "[basx383] Engineering notation tests", "input": "7E1", "expected": "7E+1"}, - {"description": "[basx387] Engineering notation tests", "input": "7E-1", "expected": "0.7"}, - {"description": "[basx381] Engineering notation tests", "input": "7E2", "expected": "7E+2"}, - { - "description": "[basx389] Engineering notation tests", - "input": "7E-2", - "expected": "0.07" - }, - {"description": "[basx379] Engineering notation tests", "input": "7E3", "expected": "7E+3"}, - { - "description": "[basx391] Engineering notation tests", - "input": "7E-3", - "expected": "0.007" - }, - {"description": "[basx377] Engineering notation tests", "input": "7E4", "expected": "7E+4"}, - { - "description": "[basx393] Engineering notation tests", - "input": "7E-4", - "expected": "0.0007" - }, - {"description": "[basx375] Engineering notation tests", "input": "7E5", "expected": "7E+5"}, - { - "description": "[basx395] Engineering notation tests", - "input": "7E-5", - "expected": "0.00007" - }, - {"description": "[basx373] Engineering notation tests", "input": "7E6", "expected": "7E+6"}, - { - "description": "[basx397] Engineering notation tests", - "input": "7E-6", - "expected": "0.000007" - }, - {"description": "[basx371] Engineering notation tests", "input": "7E7", "expected": "7E+7"}, - {"description": "[basx399] Engineering notation tests", "input": "7E-7"}, - {"description": "[basx369] Engineering notation tests", "input": "7E8", "expected": "7E+8"}, - {"description": "[basx401] Engineering notation tests", "input": "7E-8"}, - {"description": "[basx367] Engineering notation tests", "input": "7E9", "expected": "7E+9"}, - {"description": "[basx403] Engineering notation tests", "input": "7E-9"}, - { - "description": "[basx007] conform to rules and exponent will be in permitted range).", - "input": "10.0" - }, - { - "description": "[basx005] conform to rules and exponent will be in permitted range).", - "input": "10" - }, - {"description": "[basx165] Numbers with E", "input": "10E+009", "expected": "1.0E+10"}, - {"description": "[basx163] Numbers with E", "input": "10E+09", "expected": "1.0E+10"}, - {"description": "[basx325] Engineering notation tests", "input": "10e0", "expected": "10"}, - { - "description": "[basx305] Engineering notation tests", - "input": "10e10", - "expected": "1.0E+11" - }, - { - "description": "[basx345] Engineering notation tests", - "input": "10e-10", - "expected": "1.0E-9" - }, - { - "description": "[basx303] Engineering notation tests", - "input": "10e11", - "expected": "1.0E+12" - }, - { - "description": "[basx347] Engineering notation tests", - "input": "10e-11", - "expected": "1.0E-10" - }, - { - "description": "[basx301] Engineering notation tests", - "input": "10e12", - "expected": "1.0E+13" - }, - { - "description": "[basx349] Engineering notation tests", - "input": "10e-12", - "expected": "1.0E-11" - }, - { - "description": "[basx351] Engineering notation tests", - "input": "10e-13", - "expected": "1.0E-12" - }, - { - "description": "[basx323] Engineering notation tests", - "input": "10e1", - "expected": "1.0E+2" - }, - { - "description": "[basx327] Engineering notation tests", - "input": "10e-1", - "expected": "1.0" - }, - { - "description": "[basx321] Engineering notation tests", - "input": "10e2", - "expected": "1.0E+3" - }, - { - "description": "[basx329] Engineering notation tests", - "input": "10e-2", - "expected": "0.10" - }, - { - "description": "[basx319] Engineering notation tests", - "input": "10e3", - "expected": "1.0E+4" - }, - { - "description": "[basx331] Engineering notation tests", - "input": "10e-3", - "expected": "0.010" - }, - { - "description": "[basx317] Engineering notation tests", - "input": "10e4", - "expected": "1.0E+5" - }, - { - "description": "[basx333] Engineering notation tests", - "input": "10e-4", - "expected": "0.0010" - }, - { - "description": "[basx315] Engineering notation tests", - "input": "10e5", - "expected": "1.0E+6" - }, - { - "description": "[basx335] Engineering notation tests", - "input": "10e-5", - "expected": "0.00010" - }, - { - "description": "[basx313] Engineering notation tests", - "input": "10e6", - "expected": "1.0E+7" - }, - { - "description": "[basx337] Engineering notation tests", - "input": "10e-6", - "expected": "0.000010" - }, - { - "description": "[basx311] Engineering notation tests", - "input": "10e7", - "expected": "1.0E+8" - }, - { - "description": "[basx339] Engineering notation tests", - "input": "10e-7", - "expected": "0.0000010" - }, - { - "description": "[basx309] Engineering notation tests", - "input": "10e8", - "expected": "1.0E+9" - }, - { - "description": "[basx341] Engineering notation tests", - "input": "10e-8", - "expected": "1.0E-7" - }, - {"description": "[basx164] Numbers with E", "input": "10e+90", "expected": "1.0E+91"}, - {"description": "[basx162] Numbers with E", "input": "10E+9", "expected": "1.0E+10"}, - { - "description": "[basx307] Engineering notation tests", - "input": "10e9", - "expected": "1.0E+10" - }, - { - "description": "[basx343] Engineering notation tests", - "input": "10e-9", - "expected": "1.0E-8" - }, - { - "description": "[basx008] conform to rules and exponent will be in permitted range).", - "input": "10.1" - }, - { - "description": "[basx009] conform to rules and exponent will be in permitted range).", - "input": "10.4" - }, - { - "description": "[basx010] conform to rules and exponent will be in permitted range).", - "input": "10.5" - }, - { - "description": "[basx011] conform to rules and exponent will be in permitted range).", - "input": "10.6" - }, - { - "description": "[basx012] conform to rules and exponent will be in permitted range).", - "input": "10.9" - }, - { - "description": "[basx013] conform to rules and exponent will be in permitted range).", - "input": "11.0" - }, - {"description": "[basx040] strings without E cannot generate E in result", "input": "12"}, - {"description": "[basx190] Numbers with E", "input": "12.65"}, - {"description": "[basx197] Numbers with E", "input": "12.65E-0", "expected": "12.65"}, - {"description": "[basx196] Numbers with E", "input": "12.65E-1", "expected": "1.265"}, - {"description": "[basx198] Numbers with E", "input": "12.65E+1", "expected": "126.5"}, - {"description": "[basx191] Numbers with E", "input": "12.65E-20", "expected": "1.265E-19"}, - {"description": "[basx203] Numbers with E", "input": "12.65E+20", "expected": "1.265E+21"}, - {"description": "[basx195] Numbers with E", "input": "12.65E-2", "expected": "0.1265"}, - {"description": "[basx199] Numbers with E", "input": "12.65E+2", "expected": "1265"}, - {"description": "[basx194] Numbers with E", "input": "12.65E-3", "expected": "0.01265"}, - {"description": "[basx200] Numbers with E", "input": "12.65E+3", "expected": "1.265E+4"}, - {"description": "[basx193] Numbers with E", "input": "12.65E-4", "expected": "0.001265"}, - {"description": "[basx201] Numbers with E", "input": "12.65E+4", "expected": "1.265E+5"}, - {"description": "[basx192] Numbers with E", "input": "12.65E-8", "expected": "1.265E-7"}, - {"description": "[basx202] Numbers with E", "input": "12.65E+8", "expected": "1.265E+9"}, - { - "description": "[basx044] strings without E cannot generate E in result", - "input": "012.76", - "expected": "12.76" - }, - { - "description": "[basx042] strings without E cannot generate E in result", - "input": "12.76" - }, - { - "description": "[basx046] strings without E cannot generate E in result", - "input": "17.", - "expected": "17" - }, - { - "description": "[basx049] strings without E cannot generate E in result", - "input": "0044", - "expected": "44" - }, - { - "description": "[basx048] strings without E cannot generate E in result", - "input": "044", - "expected": "44" - }, - {"description": "[basx158] Numbers with E", "input": "44E+9", "expected": "4.4E+10"}, - {"description": "[basx068] examples", "input": "50E-7", "expected": "0.0000050"}, - {"description": "[basx169] Numbers with E", "input": "100e+009", "expected": "1.00E+11"}, - {"description": "[basx167] Numbers with E", "input": "100e+09", "expected": "1.00E+11"}, - {"description": "[basx168] Numbers with E", "input": "100E+90", "expected": "1.00E+92"}, - {"description": "[basx166] Numbers with E", "input": "100e+9", "expected": "1.00E+11"}, - {"description": "[basx210] Numbers with E", "input": "126.5"}, - {"description": "[basx217] Numbers with E", "input": "126.5E-0", "expected": "126.5"}, - {"description": "[basx216] Numbers with E", "input": "126.5E-1", "expected": "12.65"}, - {"description": "[basx218] Numbers with E", "input": "126.5E+1", "expected": "1265"}, - {"description": "[basx211] Numbers with E", "input": "126.5E-20", "expected": "1.265E-18"}, - {"description": "[basx223] Numbers with E", "input": "126.5E+20", "expected": "1.265E+22"}, - {"description": "[basx215] Numbers with E", "input": "126.5E-2", "expected": "1.265"}, - {"description": "[basx219] Numbers with E", "input": "126.5E+2", "expected": "1.265E+4"}, - {"description": "[basx214] Numbers with E", "input": "126.5E-3", "expected": "0.1265"}, - {"description": "[basx220] Numbers with E", "input": "126.5E+3", "expected": "1.265E+5"}, - {"description": "[basx213] Numbers with E", "input": "126.5E-4", "expected": "0.01265"}, - {"description": "[basx221] Numbers with E", "input": "126.5E+4", "expected": "1.265E+6"}, - {"description": "[basx212] Numbers with E", "input": "126.5E-8", "expected": "0.000001265"}, - {"description": "[basx222] Numbers with E", "input": "126.5E+8", "expected": "1.265E+10"}, - { - "description": "[basx006] conform to rules and exponent will be in permitted range).", - "input": "1000" - }, - {"description": "[basx230] Numbers with E", "input": "1265"}, - {"description": "[basx237] Numbers with E", "input": "1265E-0", "expected": "1265"}, - {"description": "[basx236] Numbers with E", "input": "1265E-1", "expected": "126.5"}, - {"description": "[basx238] Numbers with E", "input": "1265E+1", "expected": "1.265E+4"}, - {"description": "[basx231] Numbers with E", "input": "1265E-20", "expected": "1.265E-17"}, - {"description": "[basx243] Numbers with E", "input": "1265E+20", "expected": "1.265E+23"}, - {"description": "[basx235] Numbers with E", "input": "1265E-2", "expected": "12.65"}, - {"description": "[basx239] Numbers with E", "input": "1265E+2", "expected": "1.265E+5"}, - {"description": "[basx234] Numbers with E", "input": "1265E-3", "expected": "1.265"}, - {"description": "[basx240] Numbers with E", "input": "1265E+3", "expected": "1.265E+6"}, - {"description": "[basx233] Numbers with E", "input": "1265E-4", "expected": "0.1265"}, - {"description": "[basx241] Numbers with E", "input": "1265E+4", "expected": "1.265E+7"}, - {"description": "[basx232] Numbers with E", "input": "1265E-8", "expected": "0.00001265"}, - {"description": "[basx242] Numbers with E", "input": "1265E+8", "expected": "1.265E+11"}, - { - "description": "[basx060] strings without E cannot generate E in result", - "input": "345678.5432" - }, - { - "description": "[basx059] strings without E cannot generate E in result", - "input": "0345678.54321", - "expected": "345678.54321" - }, - { - "description": "[basx058] strings without E cannot generate E in result", - "input": "345678.543210" - }, - { - "description": "[basx057] strings without E cannot generate E in result", - "input": "2345678.543210" - }, - { - "description": "[basx056] strings without E cannot generate E in result", - "input": "12345678.543210" - }, - { - "description": "[basx031] conform to rules and exponent will be in permitted range).", - "input": "123456789.000000" - }, - { - "description": "[basx030] conform to rules and exponent will be in permitted range).", - "input": "123456789.123456" - }, - { - "description": "[basx032] conform to rules and exponent will be in permitted range).", - "input": "123456789123456" - } - ]; +var data = [ + { + "description": "[basx066] strings without E cannot generate E in result", + "input": "-00345678.5432", + "expected": "-345678.5432" + }, + { + "description": "[basx065] strings without E cannot generate E in result", + "input": "-0345678.5432", + "expected": "-345678.5432" + }, + { + "description": "[basx064] strings without E cannot generate E in result", + "input": "-345678.5432" + }, + {"description": "[basx041] strings without E cannot generate E in result", "input": "-76"}, + { + "description": "[basx027] conform to rules and exponent will be in permitted range).", + "input": "-9.999" + }, + { + "description": "[basx026] conform to rules and exponent will be in permitted range).", + "input": "-9.119" + }, + { + "description": "[basx025] conform to rules and exponent will be in permitted range).", + "input": "-9.11" + }, + { + "description": "[basx024] conform to rules and exponent will be in permitted range).", + "input": "-9.1" + }, + { + "description": "[dqbsr531] negatives (Rounded)", + "input": "-1.1111111111111111111111111111123450", + "expected": "-1.111111111111111111111111111112345" + }, + { + "description": "[basx022] conform to rules and exponent will be in permitted range).", + "input": "-1.0" + }, + { + "description": "[basx021] conform to rules and exponent will be in permitted range).", + "input": "-1" + }, + {"description": "[basx601] Zeros", "input": "0.000000000", "expected": "0E-9"}, + {"description": "[basx622] Zeros", "input": "-0.000000000", "expected": "-0E-9"}, + {"description": "[basx602] Zeros", "input": "0.00000000", "expected": "0E-8"}, + {"description": "[basx621] Zeros", "input": "-0.00000000", "expected": "-0E-8"}, + {"description": "[basx603] Zeros", "input": "0.0000000", "expected": "0E-7"}, + {"description": "[basx620] Zeros", "input": "-0.0000000", "expected": "-0E-7"}, + {"description": "[basx604] Zeros", "input": "0.000000"}, + {"description": "[basx619] Zeros", "input": "-0.000000"}, + {"description": "[basx605] Zeros", "input": "0.00000"}, + {"description": "[basx618] Zeros", "input": "-0.00000"}, + {"description": "[basx680] Zeros", "input": "000000.", "expected": "0"}, + {"description": "[basx606] Zeros", "input": "0.0000"}, + {"description": "[basx617] Zeros", "input": "-0.0000"}, + {"description": "[basx681] Zeros", "input": "00000.", "expected": "0"}, + {"description": "[basx686] Zeros", "input": "+00000.", "expected": "0"}, + {"description": "[basx687] Zeros", "input": "-00000.", "expected": "-0"}, + { + "description": "[basx019] conform to rules and exponent will be in permitted range).", + "input": "-00.00", + "expected": "-0.00" + }, + {"description": "[basx607] Zeros", "input": "0.000"}, + {"description": "[basx616] Zeros", "input": "-0.000"}, + {"description": "[basx682] Zeros", "input": "0000.", "expected": "0"}, + {"description": "[basx155] Numbers with E", "input": "0.000e+0", "expected": "0.000"}, + {"description": "[basx130] Numbers with E", "input": "0.000E-1", "expected": "0.0000"}, + { + "description": "[basx290] some more negative zeros [systematic tests below]", + "input": "-0.000E-1", + "expected": "-0.0000" + }, + {"description": "[basx131] Numbers with E", "input": "0.000E-2", "expected": "0.00000"}, + { + "description": "[basx291] some more negative zeros [systematic tests below]", + "input": "-0.000E-2", + "expected": "-0.00000" + }, + {"description": "[basx132] Numbers with E", "input": "0.000E-3", "expected": "0.000000"}, + { + "description": "[basx292] some more negative zeros [systematic tests below]", + "input": "-0.000E-3", + "expected": "-0.000000" + }, + {"description": "[basx133] Numbers with E", "input": "0.000E-4", "expected": "0E-7"}, + { + "description": "[basx293] some more negative zeros [systematic tests below]", + "input": "-0.000E-4", + "expected": "-0E-7" + }, + {"description": "[basx608] Zeros", "input": "0.00"}, + {"description": "[basx615] Zeros", "input": "-0.00"}, + {"description": "[basx683] Zeros", "input": "000.", "expected": "0"}, + {"description": "[basx630] Zeros", "input": "0.00E+0", "expected": "0.00"}, + {"description": "[basx670] Zeros", "input": "0.00E-0", "expected": "0.00"}, + {"description": "[basx631] Zeros", "input": "0.00E+1", "expected": "0.0"}, + {"description": "[basx671] Zeros", "input": "0.00E-1", "expected": "0.000"}, + {"description": "[basx134] Numbers with E", "input": "0.00E-2", "expected": "0.0000"}, + { + "description": "[basx294] some more negative zeros [systematic tests below]", + "input": "-0.00E-2", + "expected": "-0.0000" + }, + {"description": "[basx632] Zeros", "input": "0.00E+2", "expected": "0"}, + {"description": "[basx672] Zeros", "input": "0.00E-2", "expected": "0.0000"}, + {"description": "[basx135] Numbers with E", "input": "0.00E-3", "expected": "0.00000"}, + { + "description": "[basx295] some more negative zeros [systematic tests below]", + "input": "-0.00E-3", + "expected": "-0.00000" + }, + {"description": "[basx633] Zeros", "input": "0.00E+3", "expected": "0E+1"}, + {"description": "[basx673] Zeros", "input": "0.00E-3", "expected": "0.00000"}, + {"description": "[basx136] Numbers with E", "input": "0.00E-4", "expected": "0.000000"}, + {"description": "[basx674] Zeros", "input": "0.00E-4", "expected": "0.000000"}, + {"description": "[basx634] Zeros", "input": "0.00E+4", "expected": "0E+2"}, + {"description": "[basx137] Numbers with E", "input": "0.00E-5", "expected": "0E-7"}, + {"description": "[basx635] Zeros", "input": "0.00E+5", "expected": "0E+3"}, + {"description": "[basx675] Zeros", "input": "0.00E-5", "expected": "0E-7"}, + {"description": "[basx636] Zeros", "input": "0.00E+6", "expected": "0E+4"}, + {"description": "[basx676] Zeros", "input": "0.00E-6", "expected": "0E-8"}, + {"description": "[basx637] Zeros", "input": "0.00E+7", "expected": "0E+5"}, + {"description": "[basx677] Zeros", "input": "0.00E-7", "expected": "0E-9"}, + {"description": "[basx638] Zeros", "input": "0.00E+8", "expected": "0E+6"}, + {"description": "[basx678] Zeros", "input": "0.00E-8", "expected": "0E-10"}, + {"description": "[basx149] Numbers with E", "input": "000E+9", "expected": "0E+9"}, + {"description": "[basx639] Zeros", "input": "0.00E+9", "expected": "0E+7"}, + {"description": "[basx679] Zeros", "input": "0.00E-9", "expected": "0E-11"}, + { + "description": "[basx063] strings without E cannot generate E in result", + "input": "+00345678.5432", + "expected": "345678.5432" + }, + { + "description": "[basx018] conform to rules and exponent will be in permitted range).", + "input": "-0.0" + }, + {"description": "[basx609] Zeros", "input": "0.0"}, + {"description": "[basx614] Zeros", "input": "-0.0"}, + {"description": "[basx684] Zeros", "input": "00.", "expected": "0"}, + {"description": "[basx640] Zeros", "input": "0.0E+0", "expected": "0.0"}, + {"description": "[basx660] Zeros", "input": "0.0E-0", "expected": "0.0"}, + {"description": "[basx641] Zeros", "input": "0.0E+1", "expected": "0"}, + {"description": "[basx661] Zeros", "input": "0.0E-1", "expected": "0.00"}, + { + "description": "[basx296] some more negative zeros [systematic tests below]", + "input": "-0.0E-2", + "expected": "-0.000" + }, + {"description": "[basx642] Zeros", "input": "0.0E+2", "expected": "0E+1"}, + {"description": "[basx662] Zeros", "input": "0.0E-2", "expected": "0.000"}, + { + "description": "[basx297] some more negative zeros [systematic tests below]", + "input": "-0.0E-3", + "expected": "-0.0000" + }, + {"description": "[basx643] Zeros", "input": "0.0E+3", "expected": "0E+2"}, + {"description": "[basx663] Zeros", "input": "0.0E-3", "expected": "0.0000"}, + {"description": "[basx644] Zeros", "input": "0.0E+4", "expected": "0E+3"}, + {"description": "[basx664] Zeros", "input": "0.0E-4", "expected": "0.00000"}, + {"description": "[basx645] Zeros", "input": "0.0E+5", "expected": "0E+4"}, + {"description": "[basx665] Zeros", "input": "0.0E-5", "expected": "0.000000"}, + {"description": "[basx646] Zeros", "input": "0.0E+6", "expected": "0E+5"}, + {"description": "[basx666] Zeros", "input": "0.0E-6", "expected": "0E-7"}, + {"description": "[basx647] Zeros", "input": "0.0E+7", "expected": "0E+6"}, + {"description": "[basx667] Zeros", "input": "0.0E-7", "expected": "0E-8"}, + {"description": "[basx648] Zeros", "input": "0.0E+8", "expected": "0E+7"}, + {"description": "[basx668] Zeros", "input": "0.0E-8", "expected": "0E-9"}, + {"description": "[basx160] Numbers with E", "input": "00E+9", "expected": "0E+9"}, + {"description": "[basx161] Numbers with E", "input": "00E-9", "expected": "0E-9"}, + {"description": "[basx649] Zeros", "input": "0.0E+9", "expected": "0E+8"}, + {"description": "[basx669] Zeros", "input": "0.0E-9", "expected": "0E-10"}, + { + "description": "[basx062] strings without E cannot generate E in result", + "input": "+0345678.5432", + "expected": "345678.5432" + }, + { + "description": "[basx001] conform to rules and exponent will be in permitted range).", + "input": "0" + }, + { + "description": "[basx017] conform to rules and exponent will be in permitted range).", + "input": "-0" + }, + {"description": "[basx611] Zeros", "input": "0.", "expected": "0"}, + {"description": "[basx613] Zeros", "input": "-0.", "expected": "-0"}, + {"description": "[basx685] Zeros", "input": "0.", "expected": "0"}, + {"description": "[basx688] Zeros", "input": "+0.", "expected": "0"}, + {"description": "[basx689] Zeros", "input": "-0.", "expected": "-0"}, + {"description": "[basx650] Zeros", "input": "0E+0", "expected": "0"}, + {"description": "[basx651] Zeros", "input": "0E+1"}, + { + "description": "[basx298] some more negative zeros [systematic tests below]", + "input": "-0E-2", + "expected": "-0.00" + }, + {"description": "[basx652] Zeros", "input": "0E+2"}, + { + "description": "[basx299] some more negative zeros [systematic tests below]", + "input": "-0E-3", + "expected": "-0.000" + }, + {"description": "[basx653] Zeros", "input": "0E+3"}, + {"description": "[basx654] Zeros", "input": "0E+4"}, + {"description": "[basx655] Zeros", "input": "0E+5"}, + {"description": "[basx656] Zeros", "input": "0E+6"}, + {"description": "[basx657] Zeros", "input": "0E+7"}, + {"description": "[basx658] Zeros", "input": "0E+8"}, + {"description": "[basx138] Numbers with E", "input": "+0E+9", "expected": "0E+9"}, + {"description": "[basx139] Numbers with E", "input": "-0E+9"}, + {"description": "[basx144] Numbers with E", "input": "0E+9"}, + {"description": "[basx154] Numbers with E", "input": "0E9", "expected": "0E+9"}, + {"description": "[basx659] Zeros", "input": "0E+9"}, + { + "description": "[basx042] strings without E cannot generate E in result", + "input": "+12.76", + "expected": "12.76" + }, + {"description": "[basx143] Numbers with E", "input": "+1E+009", "expected": "1E+9"}, + { + "description": "[basx061] strings without E cannot generate E in result", + "input": "+345678.5432", + "expected": "345678.5432" + }, + { + "description": "[basx036] conform to rules and exponent will be in permitted range).", + "input": "0.0000000123456789", + "expected": "1.23456789E-8" + }, + { + "description": "[basx035] conform to rules and exponent will be in permitted range).", + "input": "0.000000123456789", + "expected": "1.23456789E-7" + }, + { + "description": "[basx034] conform to rules and exponent will be in permitted range).", + "input": "0.00000123456789" + }, + { + "description": "[basx053] strings without E cannot generate E in result", + "input": "0.0000050" + }, + { + "description": "[basx033] conform to rules and exponent will be in permitted range).", + "input": "0.0000123456789" + }, + { + "description": "[basx016] conform to rules and exponent will be in permitted range).", + "input": "0.012" + }, + { + "description": "[basx015] conform to rules and exponent will be in permitted range).", + "input": "0.123" + }, + { + "description": "[basx037] conform to rules and exponent will be in permitted range).", + "input": "0.123456789012344" + }, + { + "description": "[basx038] conform to rules and exponent will be in permitted range).", + "input": "0.123456789012345" + }, + {"description": "[basx250] Numbers with E", "input": "0.1265"}, + {"description": "[basx257] Numbers with E", "input": "0.1265E-0", "expected": "0.1265"}, + {"description": "[basx256] Numbers with E", "input": "0.1265E-1", "expected": "0.01265"}, + {"description": "[basx258] Numbers with E", "input": "0.1265E+1", "expected": "1.265"}, + {"description": "[basx251] Numbers with E", "input": "0.1265E-20", "expected": "1.265E-21"}, + {"description": "[basx263] Numbers with E", "input": "0.1265E+20", "expected": "1.265E+19"}, + {"description": "[basx255] Numbers with E", "input": "0.1265E-2", "expected": "0.001265"}, + {"description": "[basx259] Numbers with E", "input": "0.1265E+2", "expected": "12.65"}, + {"description": "[basx254] Numbers with E", "input": "0.1265E-3", "expected": "0.0001265"}, + {"description": "[basx260] Numbers with E", "input": "0.1265E+3", "expected": "126.5"}, + {"description": "[basx253] Numbers with E", "input": "0.1265E-4", "expected": "0.00001265"}, + {"description": "[basx261] Numbers with E", "input": "0.1265E+4", "expected": "1265"}, + {"description": "[basx252] Numbers with E", "input": "0.1265E-8", "expected": "1.265E-9"}, + {"description": "[basx262] Numbers with E", "input": "0.1265E+8", "expected": "1.265E+7"}, + {"description": "[basx159] Numbers with E", "input": "0.73e-7", "expected": "7.3E-8"}, + { + "description": "[basx004] conform to rules and exponent will be in permitted range).", + "input": "1.00" + }, + { + "description": "[basx003] conform to rules and exponent will be in permitted range).", + "input": "1.0" + }, + { + "description": "[basx002] conform to rules and exponent will be in permitted range).", + "input": "1" + }, + {"description": "[basx148] Numbers with E", "input": "1E+009", "expected": "1E+9"}, + {"description": "[basx153] Numbers with E", "input": "1E009", "expected": "1E+9"}, + {"description": "[basx141] Numbers with E", "input": "1e+09", "expected": "1E+9"}, + {"description": "[basx146] Numbers with E", "input": "1E+09", "expected": "1E+9"}, + {"description": "[basx151] Numbers with E", "input": "1e09", "expected": "1E+9"}, + {"description": "[basx142] Numbers with E", "input": "1E+90"}, + {"description": "[basx147] Numbers with E", "input": "1e+90", "expected": "1E+90"}, + {"description": "[basx152] Numbers with E", "input": "1E90", "expected": "1E+90"}, + {"description": "[basx140] Numbers with E", "input": "1E+9"}, + {"description": "[basx150] Numbers with E", "input": "1E9", "expected": "1E+9"}, + { + "description": "[basx014] conform to rules and exponent will be in permitted range).", + "input": "1.234" + }, + {"description": "[basx170] Numbers with E", "input": "1.265"}, + {"description": "[basx177] Numbers with E", "input": "1.265E-0", "expected": "1.265"}, + {"description": "[basx176] Numbers with E", "input": "1.265E-1", "expected": "0.1265"}, + {"description": "[basx178] Numbers with E", "input": "1.265E+1", "expected": "12.65"}, + {"description": "[basx171] Numbers with E", "input": "1.265E-20"}, + {"description": "[basx183] Numbers with E", "input": "1.265E+20"}, + {"description": "[basx175] Numbers with E", "input": "1.265E-2", "expected": "0.01265"}, + {"description": "[basx179] Numbers with E", "input": "1.265E+2", "expected": "126.5"}, + {"description": "[basx174] Numbers with E", "input": "1.265E-3", "expected": "0.001265"}, + {"description": "[basx180] Numbers with E", "input": "1.265E+3", "expected": "1265"}, + {"description": "[basx173] Numbers with E", "input": "1.265E-4", "expected": "0.0001265"}, + {"description": "[basx181] Numbers with E", "input": "1.265E+4"}, + {"description": "[basx172] Numbers with E", "input": "1.265E-8"}, + {"description": "[basx182] Numbers with E", "input": "1.265E+8"}, + {"description": "[basx157] Numbers with E", "input": "4E+9"}, + {"description": "[basx067] examples", "input": "5E-6", "expected": "0.000005"}, + {"description": "[basx069] examples", "input": "5E-7"}, + {"description": "[basx385] Engineering notation tests", "input": "7E0", "expected": "7"}, + {"description": "[basx365] Engineering notation tests", "input": "7E10", "expected": "7E+10"}, + {"description": "[basx405] Engineering notation tests", "input": "7E-10"}, + {"description": "[basx363] Engineering notation tests", "input": "7E11", "expected": "7E+11"}, + {"description": "[basx407] Engineering notation tests", "input": "7E-11"}, + {"description": "[basx361] Engineering notation tests", "input": "7E12", "expected": "7E+12"}, + {"description": "[basx409] Engineering notation tests", "input": "7E-12"}, + {"description": "[basx411] Engineering notation tests", "input": "7E-13"}, + {"description": "[basx383] Engineering notation tests", "input": "7E1", "expected": "7E+1"}, + {"description": "[basx387] Engineering notation tests", "input": "7E-1", "expected": "0.7"}, + {"description": "[basx381] Engineering notation tests", "input": "7E2", "expected": "7E+2"}, + {"description": "[basx389] Engineering notation tests", "input": "7E-2", "expected": "0.07"}, + {"description": "[basx379] Engineering notation tests", "input": "7E3", "expected": "7E+3"}, + {"description": "[basx391] Engineering notation tests", "input": "7E-3", "expected": "0.007"}, + {"description": "[basx377] Engineering notation tests", "input": "7E4", "expected": "7E+4"}, + {"description": "[basx393] Engineering notation tests", "input": "7E-4", "expected": "0.0007"}, + {"description": "[basx375] Engineering notation tests", "input": "7E5", "expected": "7E+5"}, + {"description": "[basx395] Engineering notation tests", "input": "7E-5", "expected": "0.00007"}, + {"description": "[basx373] Engineering notation tests", "input": "7E6", "expected": "7E+6"}, + { + "description": "[basx397] Engineering notation tests", + "input": "7E-6", + "expected": "0.000007" + }, + {"description": "[basx371] Engineering notation tests", "input": "7E7", "expected": "7E+7"}, + {"description": "[basx399] Engineering notation tests", "input": "7E-7"}, + {"description": "[basx369] Engineering notation tests", "input": "7E8", "expected": "7E+8"}, + {"description": "[basx401] Engineering notation tests", "input": "7E-8"}, + {"description": "[basx367] Engineering notation tests", "input": "7E9", "expected": "7E+9"}, + {"description": "[basx403] Engineering notation tests", "input": "7E-9"}, + { + "description": "[basx007] conform to rules and exponent will be in permitted range).", + "input": "10.0" + }, + { + "description": "[basx005] conform to rules and exponent will be in permitted range).", + "input": "10" + }, + {"description": "[basx165] Numbers with E", "input": "10E+009", "expected": "1.0E+10"}, + {"description": "[basx163] Numbers with E", "input": "10E+09", "expected": "1.0E+10"}, + {"description": "[basx325] Engineering notation tests", "input": "10e0", "expected": "10"}, + { + "description": "[basx305] Engineering notation tests", + "input": "10e10", + "expected": "1.0E+11" + }, + { + "description": "[basx345] Engineering notation tests", + "input": "10e-10", + "expected": "1.0E-9" + }, + { + "description": "[basx303] Engineering notation tests", + "input": "10e11", + "expected": "1.0E+12" + }, + { + "description": "[basx347] Engineering notation tests", + "input": "10e-11", + "expected": "1.0E-10" + }, + { + "description": "[basx301] Engineering notation tests", + "input": "10e12", + "expected": "1.0E+13" + }, + { + "description": "[basx349] Engineering notation tests", + "input": "10e-12", + "expected": "1.0E-11" + }, + { + "description": "[basx351] Engineering notation tests", + "input": "10e-13", + "expected": "1.0E-12" + }, + {"description": "[basx323] Engineering notation tests", "input": "10e1", "expected": "1.0E+2"}, + {"description": "[basx327] Engineering notation tests", "input": "10e-1", "expected": "1.0"}, + {"description": "[basx321] Engineering notation tests", "input": "10e2", "expected": "1.0E+3"}, + {"description": "[basx329] Engineering notation tests", "input": "10e-2", "expected": "0.10"}, + {"description": "[basx319] Engineering notation tests", "input": "10e3", "expected": "1.0E+4"}, + {"description": "[basx331] Engineering notation tests", "input": "10e-3", "expected": "0.010"}, + {"description": "[basx317] Engineering notation tests", "input": "10e4", "expected": "1.0E+5"}, + {"description": "[basx333] Engineering notation tests", "input": "10e-4", "expected": "0.0010"}, + {"description": "[basx315] Engineering notation tests", "input": "10e5", "expected": "1.0E+6"}, + { + "description": "[basx335] Engineering notation tests", + "input": "10e-5", + "expected": "0.00010" + }, + {"description": "[basx313] Engineering notation tests", "input": "10e6", "expected": "1.0E+7"}, + { + "description": "[basx337] Engineering notation tests", + "input": "10e-6", + "expected": "0.000010" + }, + {"description": "[basx311] Engineering notation tests", "input": "10e7", "expected": "1.0E+8"}, + { + "description": "[basx339] Engineering notation tests", + "input": "10e-7", + "expected": "0.0000010" + }, + {"description": "[basx309] Engineering notation tests", "input": "10e8", "expected": "1.0E+9"}, + {"description": "[basx341] Engineering notation tests", "input": "10e-8", "expected": "1.0E-7"}, + {"description": "[basx164] Numbers with E", "input": "10e+90", "expected": "1.0E+91"}, + {"description": "[basx162] Numbers with E", "input": "10E+9", "expected": "1.0E+10"}, + {"description": "[basx307] Engineering notation tests", "input": "10e9", "expected": "1.0E+10"}, + {"description": "[basx343] Engineering notation tests", "input": "10e-9", "expected": "1.0E-8"}, + { + "description": "[basx008] conform to rules and exponent will be in permitted range).", + "input": "10.1" + }, + { + "description": "[basx009] conform to rules and exponent will be in permitted range).", + "input": "10.4" + }, + { + "description": "[basx010] conform to rules and exponent will be in permitted range).", + "input": "10.5" + }, + { + "description": "[basx011] conform to rules and exponent will be in permitted range).", + "input": "10.6" + }, + { + "description": "[basx012] conform to rules and exponent will be in permitted range).", + "input": "10.9" + }, + { + "description": "[basx013] conform to rules and exponent will be in permitted range).", + "input": "11.0" + }, + {"description": "[basx040] strings without E cannot generate E in result", "input": "12"}, + {"description": "[basx190] Numbers with E", "input": "12.65"}, + {"description": "[basx197] Numbers with E", "input": "12.65E-0", "expected": "12.65"}, + {"description": "[basx196] Numbers with E", "input": "12.65E-1", "expected": "1.265"}, + {"description": "[basx198] Numbers with E", "input": "12.65E+1", "expected": "126.5"}, + {"description": "[basx191] Numbers with E", "input": "12.65E-20", "expected": "1.265E-19"}, + {"description": "[basx203] Numbers with E", "input": "12.65E+20", "expected": "1.265E+21"}, + {"description": "[basx195] Numbers with E", "input": "12.65E-2", "expected": "0.1265"}, + {"description": "[basx199] Numbers with E", "input": "12.65E+2", "expected": "1265"}, + {"description": "[basx194] Numbers with E", "input": "12.65E-3", "expected": "0.01265"}, + {"description": "[basx200] Numbers with E", "input": "12.65E+3", "expected": "1.265E+4"}, + {"description": "[basx193] Numbers with E", "input": "12.65E-4", "expected": "0.001265"}, + {"description": "[basx201] Numbers with E", "input": "12.65E+4", "expected": "1.265E+5"}, + {"description": "[basx192] Numbers with E", "input": "12.65E-8", "expected": "1.265E-7"}, + {"description": "[basx202] Numbers with E", "input": "12.65E+8", "expected": "1.265E+9"}, + { + "description": "[basx044] strings without E cannot generate E in result", + "input": "012.76", + "expected": "12.76" + }, + {"description": "[basx042] strings without E cannot generate E in result", "input": "12.76"}, + { + "description": "[basx046] strings without E cannot generate E in result", + "input": "17.", + "expected": "17" + }, + { + "description": "[basx049] strings without E cannot generate E in result", + "input": "0044", + "expected": "44" + }, + { + "description": "[basx048] strings without E cannot generate E in result", + "input": "044", + "expected": "44" + }, + {"description": "[basx158] Numbers with E", "input": "44E+9", "expected": "4.4E+10"}, + {"description": "[basx068] examples", "input": "50E-7", "expected": "0.0000050"}, + {"description": "[basx169] Numbers with E", "input": "100e+009", "expected": "1.00E+11"}, + {"description": "[basx167] Numbers with E", "input": "100e+09", "expected": "1.00E+11"}, + {"description": "[basx168] Numbers with E", "input": "100E+90", "expected": "1.00E+92"}, + {"description": "[basx166] Numbers with E", "input": "100e+9", "expected": "1.00E+11"}, + {"description": "[basx210] Numbers with E", "input": "126.5"}, + {"description": "[basx217] Numbers with E", "input": "126.5E-0", "expected": "126.5"}, + {"description": "[basx216] Numbers with E", "input": "126.5E-1", "expected": "12.65"}, + {"description": "[basx218] Numbers with E", "input": "126.5E+1", "expected": "1265"}, + {"description": "[basx211] Numbers with E", "input": "126.5E-20", "expected": "1.265E-18"}, + {"description": "[basx223] Numbers with E", "input": "126.5E+20", "expected": "1.265E+22"}, + {"description": "[basx215] Numbers with E", "input": "126.5E-2", "expected": "1.265"}, + {"description": "[basx219] Numbers with E", "input": "126.5E+2", "expected": "1.265E+4"}, + {"description": "[basx214] Numbers with E", "input": "126.5E-3", "expected": "0.1265"}, + {"description": "[basx220] Numbers with E", "input": "126.5E+3", "expected": "1.265E+5"}, + {"description": "[basx213] Numbers with E", "input": "126.5E-4", "expected": "0.01265"}, + {"description": "[basx221] Numbers with E", "input": "126.5E+4", "expected": "1.265E+6"}, + {"description": "[basx212] Numbers with E", "input": "126.5E-8", "expected": "0.000001265"}, + {"description": "[basx222] Numbers with E", "input": "126.5E+8", "expected": "1.265E+10"}, + { + "description": "[basx006] conform to rules and exponent will be in permitted range).", + "input": "1000" + }, + {"description": "[basx230] Numbers with E", "input": "1265"}, + {"description": "[basx237] Numbers with E", "input": "1265E-0", "expected": "1265"}, + {"description": "[basx236] Numbers with E", "input": "1265E-1", "expected": "126.5"}, + {"description": "[basx238] Numbers with E", "input": "1265E+1", "expected": "1.265E+4"}, + {"description": "[basx231] Numbers with E", "input": "1265E-20", "expected": "1.265E-17"}, + {"description": "[basx243] Numbers with E", "input": "1265E+20", "expected": "1.265E+23"}, + {"description": "[basx235] Numbers with E", "input": "1265E-2", "expected": "12.65"}, + {"description": "[basx239] Numbers with E", "input": "1265E+2", "expected": "1.265E+5"}, + {"description": "[basx234] Numbers with E", "input": "1265E-3", "expected": "1.265"}, + {"description": "[basx240] Numbers with E", "input": "1265E+3", "expected": "1.265E+6"}, + {"description": "[basx233] Numbers with E", "input": "1265E-4", "expected": "0.1265"}, + {"description": "[basx241] Numbers with E", "input": "1265E+4", "expected": "1.265E+7"}, + {"description": "[basx232] Numbers with E", "input": "1265E-8", "expected": "0.00001265"}, + {"description": "[basx242] Numbers with E", "input": "1265E+8", "expected": "1.265E+11"}, + { + "description": "[basx060] strings without E cannot generate E in result", + "input": "345678.5432" + }, + { + "description": "[basx059] strings without E cannot generate E in result", + "input": "0345678.54321", + "expected": "345678.54321" + }, + { + "description": "[basx058] strings without E cannot generate E in result", + "input": "345678.543210" + }, + { + "description": "[basx057] strings without E cannot generate E in result", + "input": "2345678.543210" + }, + { + "description": "[basx056] strings without E cannot generate E in result", + "input": "12345678.543210" + }, + { + "description": "[basx031] conform to rules and exponent will be in permitted range).", + "input": "123456789.000000" + }, + { + "description": "[basx030] conform to rules and exponent will be in permitted range).", + "input": "123456789.123456" + }, + { + "description": "[basx032] conform to rules and exponent will be in permitted range).", + "input": "123456789123456" + } +]; - data.forEach(function(testCase) { - print(`Test - ${testCase.description}`); - var output = NumberDecimal(testCase.input).toString(); - if (testCase.expected) { - assert.eq(output, `NumberDecimal("${testCase.expected}")`); - } else { - assert.eq(output, `NumberDecimal("${testCase.input}")`); - } - }); +data.forEach(function(testCase) { + print(`Test - ${testCase.description}`); + var output = NumberDecimal(testCase.input).toString(); + if (testCase.expected) { + assert.eq(output, `NumberDecimal("${testCase.expected}")`); + } else { + assert.eq(output, `NumberDecimal("${testCase.input}")`); + } +}); }());
\ No newline at end of file diff --git a/jstests/decimal/decimal128_test4.js b/jstests/decimal/decimal128_test4.js index 1999ecd67aa..7ec4f14c303 100644 --- a/jstests/decimal/decimal128_test4.js +++ b/jstests/decimal/decimal128_test4.js @@ -3,143 +3,137 @@ */ (function() { - "use strict"; +"use strict"; - var testData = [ - { - "description": "[basx023] conform to rules and exponent will be in permitted range).", - "input": "-0.1" - }, +var testData = [ + { + "description": "[basx023] conform to rules and exponent will be in permitted range).", + "input": "-0.1" + }, - { - "description": "[basx045] strings without E cannot generate E in result", - "input": "+0.003", - "expected": "0.003" - }, - {"description": "[basx610] Zeros", "input": ".0", "expected": "0.0"}, - {"description": "[basx612] Zeros", "input": "-.0", "expected": "-0.0"}, - { - "description": "[basx043] strings without E cannot generate E in result", - "input": "+12.76", - "expected": "12.76" - }, - { - "description": "[basx055] strings without E cannot generate E in result", - "input": "0.00000005", - "expected": "5E-8" - }, - { - "description": "[basx054] strings without E cannot generate E in result", - "input": "0.0000005", - "expected": "5E-7" - }, - { - "description": "[basx052] strings without E cannot generate E in result", - "input": "0.000005" - }, - { - "description": "[basx051] strings without E cannot generate E in result", - "input": "00.00005", - "expected": "0.00005" - }, - { - "description": "[basx050] strings without E cannot generate E in result", - "input": "0.0005" - }, - { - "description": "[basx047] strings without E cannot generate E in result", - "input": ".5", - "expected": "0.5" - }, - { - "description": "[dqbsr431] check rounding modes heeded (Rounded)", - "input": "1.1111111111111111111111111111123450", - "expected": "1.111111111111111111111111111112345" - }, - { - "description": "OK2", - "input": ".100000000000000000000000000000000000000000000000000000000000", - "expected": "0.1000000000000000000000000000000000" - } - ]; + { + "description": "[basx045] strings without E cannot generate E in result", + "input": "+0.003", + "expected": "0.003" + }, + {"description": "[basx610] Zeros", "input": ".0", "expected": "0.0"}, + {"description": "[basx612] Zeros", "input": "-.0", "expected": "-0.0"}, + { + "description": "[basx043] strings without E cannot generate E in result", + "input": "+12.76", + "expected": "12.76" + }, + { + "description": "[basx055] strings without E cannot generate E in result", + "input": "0.00000005", + "expected": "5E-8" + }, + { + "description": "[basx054] strings without E cannot generate E in result", + "input": "0.0000005", + "expected": "5E-7" + }, + {"description": "[basx052] strings without E cannot generate E in result", "input": "0.000005"}, + { + "description": "[basx051] strings without E cannot generate E in result", + "input": "00.00005", + "expected": "0.00005" + }, + {"description": "[basx050] strings without E cannot generate E in result", "input": "0.0005"}, + { + "description": "[basx047] strings without E cannot generate E in result", + "input": ".5", + "expected": "0.5" + }, + { + "description": "[dqbsr431] check rounding modes heeded (Rounded)", + "input": "1.1111111111111111111111111111123450", + "expected": "1.111111111111111111111111111112345" + }, + { + "description": "OK2", + "input": ".100000000000000000000000000000000000000000000000000000000000", + "expected": "0.1000000000000000000000000000000000" + } +]; - var parseErrors = [ - {"description": "[basx564] Near-specials (Conversion_syntax)", "string": "Infi"}, - {"description": "[basx565] Near-specials (Conversion_syntax)", "string": "Infin"}, - {"description": "[basx566] Near-specials (Conversion_syntax)", "string": "Infini"}, - {"description": "[basx567] Near-specials (Conversion_syntax)", "string": "Infinit"}, - {"description": "[basx568] Near-specials (Conversion_syntax)", "string": "-Infinit"}, - { - "description": - "[basx590] some baddies with dots and Es and dots and specials (Conversion_syntax)", - "string": ".Infinity" - }, - {"description": "[basx562] Near-specials (Conversion_syntax)", "string": "NaNq"}, - {"description": "[basx563] Near-specials (Conversion_syntax)", "string": "NaNs"}, - { - "description": "[dqbas939] overflow results at different rounding modes " + - "(Overflow & Inexact & Rounded)", - "string": "-7e10000" - }, - { - "description": "[dqbsr534] negatives (Rounded & Inexact)", - "string": "-1.11111111111111111111111111111234650" - }, - { - "description": "[dqbsr535] negatives (Rounded & Inexact)", - "string": "-1.11111111111111111111111111111234551" - }, - { - "description": "[dqbsr533] negatives (Rounded & Inexact)", - "string": "-1.11111111111111111111111111111234550" - }, - { - "description": "[dqbsr532] negatives (Rounded & Inexact)", - "string": "-1.11111111111111111111111111111234549" - }, - { - "description": "[dqbsr432] check rounding modes heeded (Rounded & Inexact)", - "string": "1.11111111111111111111111111111234549" - }, - { - "description": "[dqbsr433] check rounding modes heeded (Rounded & Inexact)", - "string": "1.11111111111111111111111111111234550" - }, - { - "description": "[dqbsr435] check rounding modes heeded (Rounded & Inexact)", - "string": "1.11111111111111111111111111111234551" - }, - { - "description": "[dqbsr434] check rounding modes heeded (Rounded & Inexact)", - "string": "1.11111111111111111111111111111234650" - }, - { - "description": "[dqbas938] overflow results at different rounding modes " + - "(Overflow & Inexact & Rounded)", - "string": "7e10000" - }, - { - "description": "Inexact rounding#1", - "string": "100000000000000000000000000000000000000000000000000000000001" - }, - {"description": "Inexact rounding#2", "string": "1E-6177"} - ]; +var parseErrors = [ + {"description": "[basx564] Near-specials (Conversion_syntax)", "string": "Infi"}, + {"description": "[basx565] Near-specials (Conversion_syntax)", "string": "Infin"}, + {"description": "[basx566] Near-specials (Conversion_syntax)", "string": "Infini"}, + {"description": "[basx567] Near-specials (Conversion_syntax)", "string": "Infinit"}, + {"description": "[basx568] Near-specials (Conversion_syntax)", "string": "-Infinit"}, + { + "description": + "[basx590] some baddies with dots and Es and dots and specials (Conversion_syntax)", + "string": ".Infinity" + }, + {"description": "[basx562] Near-specials (Conversion_syntax)", "string": "NaNq"}, + {"description": "[basx563] Near-specials (Conversion_syntax)", "string": "NaNs"}, + { + "description": "[dqbas939] overflow results at different rounding modes " + + "(Overflow & Inexact & Rounded)", + "string": "-7e10000" + }, + { + "description": "[dqbsr534] negatives (Rounded & Inexact)", + "string": "-1.11111111111111111111111111111234650" + }, + { + "description": "[dqbsr535] negatives (Rounded & Inexact)", + "string": "-1.11111111111111111111111111111234551" + }, + { + "description": "[dqbsr533] negatives (Rounded & Inexact)", + "string": "-1.11111111111111111111111111111234550" + }, + { + "description": "[dqbsr532] negatives (Rounded & Inexact)", + "string": "-1.11111111111111111111111111111234549" + }, + { + "description": "[dqbsr432] check rounding modes heeded (Rounded & Inexact)", + "string": "1.11111111111111111111111111111234549" + }, + { + "description": "[dqbsr433] check rounding modes heeded (Rounded & Inexact)", + "string": "1.11111111111111111111111111111234550" + }, + { + "description": "[dqbsr435] check rounding modes heeded (Rounded & Inexact)", + "string": "1.11111111111111111111111111111234551" + }, + { + "description": "[dqbsr434] check rounding modes heeded (Rounded & Inexact)", + "string": "1.11111111111111111111111111111234650" + }, + { + "description": "[dqbas938] overflow results at different rounding modes " + + "(Overflow & Inexact & Rounded)", + "string": "7e10000" + }, + { + "description": "Inexact rounding#1", + "string": "100000000000000000000000000000000000000000000000000000000001" + }, + {"description": "Inexact rounding#2", "string": "1E-6177"} +]; - testData.forEach(function(testCase) { - print(`Test - ${testCase.description}`); - var output = NumberDecimal(testCase.input).toString(); - if (testCase.expected) { - assert.eq(output, `NumberDecimal("${testCase.expected}")`); - } else { - assert.eq(output, `NumberDecimal("${testCase.input}")`); - } - }); +testData.forEach(function(testCase) { + print(`Test - ${testCase.description}`); + var output = NumberDecimal(testCase.input).toString(); + if (testCase.expected) { + assert.eq(output, `NumberDecimal("${testCase.expected}")`); + } else { + assert.eq(output, `NumberDecimal("${testCase.input}")`); + } +}); - parseErrors.forEach(function(testCase) { - print(`Test - ${testCase.description}`); - function test() { - NumberDecimal(testCase.string); - } - assert.throws(test, [], `[Test - ${testCase.description}] should have failed with error.`); - }); +parseErrors.forEach(function(testCase) { + print(`Test - ${testCase.description}`); + function test() { + NumberDecimal(testCase.string); + } + assert.throws(test, [], `[Test - ${testCase.description}] should have failed with error.`); +}); }());
\ No newline at end of file diff --git a/jstests/decimal/decimal128_test5.js b/jstests/decimal/decimal128_test5.js index d51ab1282c2..2e264cdca6e 100644 --- a/jstests/decimal/decimal128_test5.js +++ b/jstests/decimal/decimal128_test5.js @@ -3,322 +3,321 @@ */ (function() { - "use strict"; +"use strict"; - var testData = [ - { - "description": "[decq035] fold-downs (more below) (Clamped)", - "input": "1.23E+6144", - "expected": "1.230000000000000000000000000000000E+6144" - }, - { - "description": "[decq037] fold-downs (more below) (Clamped)", - "input": "1E+6144", - "expected": "1.000000000000000000000000000000000E+6144" - }, - { - "description": "[decq077] Nmin and below (Subnormal)", - "input": "0.100000000000000000000000000000000E-6143", - "expected": "1.00000000000000000000000000000000E-6144" - }, - { - "description": "[decq078] Nmin and below (Subnormal)", - "input": "1.00000000000000000000000000000000E-6144" - }, - { - "description": "[decq079] Nmin and below (Subnormal)", - "input": "0.000000000000000000000000000000010E-6143", - "expected": "1.0E-6175" - }, - {"description": "[decq080] Nmin and below (Subnormal)", "input": "1.0E-6175"}, - { - "description": "[decq081] Nmin and below (Subnormal)", - "input": "0.00000000000000000000000000000001E-6143", - "expected": "1E-6175" - }, - {"description": "[decq082] Nmin and below (Subnormal)", "input": "1E-6175"}, - { - "description": "[decq083] Nmin and below (Subnormal)", - "input": "0.000000000000000000000000000000001E-6143", - "expected": "1E-6176" - }, - {"description": "[decq084] Nmin and below (Subnormal)", "input": "1E-6176"}, - { - "description": "[decq090] underflows cannot be tested for simple copies, " + - "check edge cases (Subnormal)", - "input": "1e-6176", - "expected": "1E-6176" - }, - { - "description": "[decq100] underflows cannot be tested for simple copies, " + - "check edge cases (Subnormal)", - "input": "999999999999999999999999999999999e-6176", - "expected": "9.99999999999999999999999999999999E-6144" - }, - { - "description": "[decq130] fold-downs (more below) (Clamped)", - "input": "-1.23E+6144", - "expected": "-1.230000000000000000000000000000000E+6144" - }, - { - "description": "[decq132] fold-downs (more below) (Clamped)", - "input": "-1E+6144", - "expected": "-1.000000000000000000000000000000000E+6144" - }, - { - "description": "[decq177] Nmin and below (Subnormal)", - "input": "-0.100000000000000000000000000000000E-6143", - "expected": "-1.00000000000000000000000000000000E-6144" - }, - { - "description": "[decq178] Nmin and below (Subnormal)", - "input": "-1.00000000000000000000000000000000E-6144" - }, - { - "description": "[decq179] Nmin and below (Subnormal)", - "input": "-0.000000000000000000000000000000010E-6143", - "expected": "-1.0E-6175" - }, - {"description": "[decq180] Nmin and below (Subnormal)", "input": "-1.0E-6175"}, - { - "description": "[decq181] Nmin and below (Subnormal)", - "input": "-0.00000000000000000000000000000001E-6143", - "expected": "-1E-6175" - }, - {"description": "[decq182] Nmin and below (Subnormal)", "input": "-1E-6175"}, - { - "description": "[decq183] Nmin and below (Subnormal)", - "input": "-0.000000000000000000000000000000001E-6143", - "expected": "-1E-6176" - }, - {"description": "[decq184] Nmin and below (Subnormal)", "input": "-1E-6176"}, - { - "description": "[decq190] underflow edge cases (Subnormal)", - "input": "-1e-6176", - "expected": "-1E-6176" - }, - { - "description": "[decq200] underflow edge cases (Subnormal)", - "input": "-999999999999999999999999999999999e-6176", - "expected": "-9.99999999999999999999999999999999E-6144" - }, - {"description": "[decq400] zeros (Clamped)", "input": "0E-8000", "expected": "0E-6176"}, - {"description": "[decq401] zeros (Clamped)", "input": "0E-6177", "expected": "0E-6176"}, - { - "description": "[decq414] clamped zeros... (Clamped)", - "input": "0E+6112", - "expected": "0E+6111" - }, - { - "description": "[decq416] clamped zeros... (Clamped)", - "input": "0E+6144", - "expected": "0E+6111" - }, - { - "description": "[decq418] clamped zeros... (Clamped)", - "input": "0E+8000", - "expected": "0E+6111" - }, - { - "description": "[decq420] negative zeros (Clamped)", - "input": "-0E-8000", - "expected": "-0E-6176" - }, - { - "description": "[decq421] negative zeros (Clamped)", - "input": "-0E-6177", - "expected": "-0E-6176" - }, - { - "description": "[decq434] clamped zeros... (Clamped)", - "input": "-0E+6112", - "expected": "-0E+6111" - }, - { - "description": "[decq436] clamped zeros... (Clamped)", - "input": "-0E+6144", - "expected": "-0E+6111" - }, - { - "description": "[decq438] clamped zeros... (Clamped)", - "input": "-0E+8000", - "expected": "-0E+6111" - }, - { - "description": "[decq601] fold-down full sequence (Clamped)", - "input": "1E+6144", - "expected": "1.000000000000000000000000000000000E+6144" - }, - { - "description": "[decq603] fold-down full sequence (Clamped)", - "input": "1E+6143", - "expected": "1.00000000000000000000000000000000E+6143" - }, - { - "description": "[decq605] fold-down full sequence (Clamped)", - "input": "1E+6142", - "expected": "1.0000000000000000000000000000000E+6142" - }, - { - "description": "[decq607] fold-down full sequence (Clamped)", - "input": "1E+6141", - "expected": "1.000000000000000000000000000000E+6141" - }, - { - "description": "[decq609] fold-down full sequence (Clamped)", - "input": "1E+6140", - "expected": "1.00000000000000000000000000000E+6140" - }, - { - "description": "[decq611] fold-down full sequence (Clamped)", - "input": "1E+6139", - "expected": "1.0000000000000000000000000000E+6139" - }, - { - "description": "[decq613] fold-down full sequence (Clamped)", - "input": "1E+6138", - "expected": "1.000000000000000000000000000E+6138" - }, - { - "description": "[decq615] fold-down full sequence (Clamped)", - "input": "1E+6137", - "expected": "1.00000000000000000000000000E+6137" - }, - { - "description": "[decq617] fold-down full sequence (Clamped)", - "input": "1E+6136", - "expected": "1.0000000000000000000000000E+6136" - }, - { - "description": "[decq619] fold-down full sequence (Clamped)", - "input": "1E+6135", - "expected": "1.000000000000000000000000E+6135" - }, - { - "description": "[decq621] fold-down full sequence (Clamped)", - "input": "1E+6134", - "expected": "1.00000000000000000000000E+6134" - }, - { - "description": "[decq623] fold-down full sequence (Clamped)", - "input": "1E+6133", - "expected": "1.0000000000000000000000E+6133" - }, - { - "description": "[decq625] fold-down full sequence (Clamped)", - "input": "1E+6132", - "expected": "1.000000000000000000000E+6132" - }, - { - "description": "[decq627] fold-down full sequence (Clamped)", - "input": "1E+6131", - "expected": "1.00000000000000000000E+6131" - }, - { - "description": "[decq629] fold-down full sequence (Clamped)", - "input": "1E+6130", - "expected": "1.0000000000000000000E+6130" - }, - { - "description": "[decq631] fold-down full sequence (Clamped)", - "input": "1E+6129", - "expected": "1.000000000000000000E+6129" - }, - { - "description": "[decq633] fold-down full sequence (Clamped)", - "input": "1E+6128", - "expected": "1.00000000000000000E+6128" - }, - { - "description": "[decq635] fold-down full sequence (Clamped)", - "input": "1E+6127", - "expected": "1.0000000000000000E+6127" - }, - { - "description": "[decq637] fold-down full sequence (Clamped)", - "input": "1E+6126", - "expected": "1.000000000000000E+6126" - }, - { - "description": "[decq639] fold-down full sequence (Clamped)", - "input": "1E+6125", - "expected": "1.00000000000000E+6125" - }, - { - "description": "[decq641] fold-down full sequence (Clamped)", - "input": "1E+6124", - "expected": "1.0000000000000E+6124" - }, - { - "description": "[decq643] fold-down full sequence (Clamped)", - "input": "1E+6123", - "expected": "1.000000000000E+6123" - }, - { - "description": "[decq645] fold-down full sequence (Clamped)", - "input": "1E+6122", - "expected": "1.00000000000E+6122" - }, - { - "description": "[decq647] fold-down full sequence (Clamped)", - "input": "1E+6121", - "expected": "1.0000000000E+6121" - }, - { - "description": "[decq649] fold-down full sequence (Clamped)", - "input": "1E+6120", - "expected": "1.000000000E+6120" - }, - { - "description": "[decq651] fold-down full sequence (Clamped)", - "input": "1E+6119", - "expected": "1.00000000E+6119" - }, - { - "description": "[decq653] fold-down full sequence (Clamped)", - "input": "1E+6118", - "expected": "1.0000000E+6118" - }, - { - "description": "[decq655] fold-down full sequence (Clamped)", - "input": "1E+6117", - "expected": "1.000000E+6117" - }, - { - "description": "[decq657] fold-down full sequence (Clamped)", - "input": "1E+6116", - "expected": "1.00000E+6116" - }, - { - "description": "[decq659] fold-down full sequence (Clamped)", - "input": "1E+6115", - "expected": "1.0000E+6115" - }, - { - "description": "[decq661] fold-down full sequence (Clamped)", - "input": "1E+6114", - "expected": "1.000E+6114" - }, - { - "description": "[decq663] fold-down full sequence (Clamped)", - "input": "1E+6113", - "expected": "1.00E+6113" - }, - { - "description": "[decq665] fold-down full sequence (Clamped)", - "input": "1E+6112", - "expected": "1.0E+6112" - } - ]; - - testData.forEach(function(testCase) { - print(`Test - ${testCase.description}`); - var output = NumberDecimal(testCase.input).toString(); - if (testCase.expected) { - assert.eq(output, `NumberDecimal("${testCase.expected}")`); - } else { - assert.eq(output, `NumberDecimal("${testCase.input}")`); - } - }); +var testData = [ + { + "description": "[decq035] fold-downs (more below) (Clamped)", + "input": "1.23E+6144", + "expected": "1.230000000000000000000000000000000E+6144" + }, + { + "description": "[decq037] fold-downs (more below) (Clamped)", + "input": "1E+6144", + "expected": "1.000000000000000000000000000000000E+6144" + }, + { + "description": "[decq077] Nmin and below (Subnormal)", + "input": "0.100000000000000000000000000000000E-6143", + "expected": "1.00000000000000000000000000000000E-6144" + }, + { + "description": "[decq078] Nmin and below (Subnormal)", + "input": "1.00000000000000000000000000000000E-6144" + }, + { + "description": "[decq079] Nmin and below (Subnormal)", + "input": "0.000000000000000000000000000000010E-6143", + "expected": "1.0E-6175" + }, + {"description": "[decq080] Nmin and below (Subnormal)", "input": "1.0E-6175"}, + { + "description": "[decq081] Nmin and below (Subnormal)", + "input": "0.00000000000000000000000000000001E-6143", + "expected": "1E-6175" + }, + {"description": "[decq082] Nmin and below (Subnormal)", "input": "1E-6175"}, + { + "description": "[decq083] Nmin and below (Subnormal)", + "input": "0.000000000000000000000000000000001E-6143", + "expected": "1E-6176" + }, + {"description": "[decq084] Nmin and below (Subnormal)", "input": "1E-6176"}, + { + "description": "[decq090] underflows cannot be tested for simple copies, " + + "check edge cases (Subnormal)", + "input": "1e-6176", + "expected": "1E-6176" + }, + { + "description": "[decq100] underflows cannot be tested for simple copies, " + + "check edge cases (Subnormal)", + "input": "999999999999999999999999999999999e-6176", + "expected": "9.99999999999999999999999999999999E-6144" + }, + { + "description": "[decq130] fold-downs (more below) (Clamped)", + "input": "-1.23E+6144", + "expected": "-1.230000000000000000000000000000000E+6144" + }, + { + "description": "[decq132] fold-downs (more below) (Clamped)", + "input": "-1E+6144", + "expected": "-1.000000000000000000000000000000000E+6144" + }, + { + "description": "[decq177] Nmin and below (Subnormal)", + "input": "-0.100000000000000000000000000000000E-6143", + "expected": "-1.00000000000000000000000000000000E-6144" + }, + { + "description": "[decq178] Nmin and below (Subnormal)", + "input": "-1.00000000000000000000000000000000E-6144" + }, + { + "description": "[decq179] Nmin and below (Subnormal)", + "input": "-0.000000000000000000000000000000010E-6143", + "expected": "-1.0E-6175" + }, + {"description": "[decq180] Nmin and below (Subnormal)", "input": "-1.0E-6175"}, + { + "description": "[decq181] Nmin and below (Subnormal)", + "input": "-0.00000000000000000000000000000001E-6143", + "expected": "-1E-6175" + }, + {"description": "[decq182] Nmin and below (Subnormal)", "input": "-1E-6175"}, + { + "description": "[decq183] Nmin and below (Subnormal)", + "input": "-0.000000000000000000000000000000001E-6143", + "expected": "-1E-6176" + }, + {"description": "[decq184] Nmin and below (Subnormal)", "input": "-1E-6176"}, + { + "description": "[decq190] underflow edge cases (Subnormal)", + "input": "-1e-6176", + "expected": "-1E-6176" + }, + { + "description": "[decq200] underflow edge cases (Subnormal)", + "input": "-999999999999999999999999999999999e-6176", + "expected": "-9.99999999999999999999999999999999E-6144" + }, + {"description": "[decq400] zeros (Clamped)", "input": "0E-8000", "expected": "0E-6176"}, + {"description": "[decq401] zeros (Clamped)", "input": "0E-6177", "expected": "0E-6176"}, + { + "description": "[decq414] clamped zeros... (Clamped)", + "input": "0E+6112", + "expected": "0E+6111" + }, + { + "description": "[decq416] clamped zeros... (Clamped)", + "input": "0E+6144", + "expected": "0E+6111" + }, + { + "description": "[decq418] clamped zeros... (Clamped)", + "input": "0E+8000", + "expected": "0E+6111" + }, + { + "description": "[decq420] negative zeros (Clamped)", + "input": "-0E-8000", + "expected": "-0E-6176" + }, + { + "description": "[decq421] negative zeros (Clamped)", + "input": "-0E-6177", + "expected": "-0E-6176" + }, + { + "description": "[decq434] clamped zeros... (Clamped)", + "input": "-0E+6112", + "expected": "-0E+6111" + }, + { + "description": "[decq436] clamped zeros... (Clamped)", + "input": "-0E+6144", + "expected": "-0E+6111" + }, + { + "description": "[decq438] clamped zeros... (Clamped)", + "input": "-0E+8000", + "expected": "-0E+6111" + }, + { + "description": "[decq601] fold-down full sequence (Clamped)", + "input": "1E+6144", + "expected": "1.000000000000000000000000000000000E+6144" + }, + { + "description": "[decq603] fold-down full sequence (Clamped)", + "input": "1E+6143", + "expected": "1.00000000000000000000000000000000E+6143" + }, + { + "description": "[decq605] fold-down full sequence (Clamped)", + "input": "1E+6142", + "expected": "1.0000000000000000000000000000000E+6142" + }, + { + "description": "[decq607] fold-down full sequence (Clamped)", + "input": "1E+6141", + "expected": "1.000000000000000000000000000000E+6141" + }, + { + "description": "[decq609] fold-down full sequence (Clamped)", + "input": "1E+6140", + "expected": "1.00000000000000000000000000000E+6140" + }, + { + "description": "[decq611] fold-down full sequence (Clamped)", + "input": "1E+6139", + "expected": "1.0000000000000000000000000000E+6139" + }, + { + "description": "[decq613] fold-down full sequence (Clamped)", + "input": "1E+6138", + "expected": "1.000000000000000000000000000E+6138" + }, + { + "description": "[decq615] fold-down full sequence (Clamped)", + "input": "1E+6137", + "expected": "1.00000000000000000000000000E+6137" + }, + { + "description": "[decq617] fold-down full sequence (Clamped)", + "input": "1E+6136", + "expected": "1.0000000000000000000000000E+6136" + }, + { + "description": "[decq619] fold-down full sequence (Clamped)", + "input": "1E+6135", + "expected": "1.000000000000000000000000E+6135" + }, + { + "description": "[decq621] fold-down full sequence (Clamped)", + "input": "1E+6134", + "expected": "1.00000000000000000000000E+6134" + }, + { + "description": "[decq623] fold-down full sequence (Clamped)", + "input": "1E+6133", + "expected": "1.0000000000000000000000E+6133" + }, + { + "description": "[decq625] fold-down full sequence (Clamped)", + "input": "1E+6132", + "expected": "1.000000000000000000000E+6132" + }, + { + "description": "[decq627] fold-down full sequence (Clamped)", + "input": "1E+6131", + "expected": "1.00000000000000000000E+6131" + }, + { + "description": "[decq629] fold-down full sequence (Clamped)", + "input": "1E+6130", + "expected": "1.0000000000000000000E+6130" + }, + { + "description": "[decq631] fold-down full sequence (Clamped)", + "input": "1E+6129", + "expected": "1.000000000000000000E+6129" + }, + { + "description": "[decq633] fold-down full sequence (Clamped)", + "input": "1E+6128", + "expected": "1.00000000000000000E+6128" + }, + { + "description": "[decq635] fold-down full sequence (Clamped)", + "input": "1E+6127", + "expected": "1.0000000000000000E+6127" + }, + { + "description": "[decq637] fold-down full sequence (Clamped)", + "input": "1E+6126", + "expected": "1.000000000000000E+6126" + }, + { + "description": "[decq639] fold-down full sequence (Clamped)", + "input": "1E+6125", + "expected": "1.00000000000000E+6125" + }, + { + "description": "[decq641] fold-down full sequence (Clamped)", + "input": "1E+6124", + "expected": "1.0000000000000E+6124" + }, + { + "description": "[decq643] fold-down full sequence (Clamped)", + "input": "1E+6123", + "expected": "1.000000000000E+6123" + }, + { + "description": "[decq645] fold-down full sequence (Clamped)", + "input": "1E+6122", + "expected": "1.00000000000E+6122" + }, + { + "description": "[decq647] fold-down full sequence (Clamped)", + "input": "1E+6121", + "expected": "1.0000000000E+6121" + }, + { + "description": "[decq649] fold-down full sequence (Clamped)", + "input": "1E+6120", + "expected": "1.000000000E+6120" + }, + { + "description": "[decq651] fold-down full sequence (Clamped)", + "input": "1E+6119", + "expected": "1.00000000E+6119" + }, + { + "description": "[decq653] fold-down full sequence (Clamped)", + "input": "1E+6118", + "expected": "1.0000000E+6118" + }, + { + "description": "[decq655] fold-down full sequence (Clamped)", + "input": "1E+6117", + "expected": "1.000000E+6117" + }, + { + "description": "[decq657] fold-down full sequence (Clamped)", + "input": "1E+6116", + "expected": "1.00000E+6116" + }, + { + "description": "[decq659] fold-down full sequence (Clamped)", + "input": "1E+6115", + "expected": "1.0000E+6115" + }, + { + "description": "[decq661] fold-down full sequence (Clamped)", + "input": "1E+6114", + "expected": "1.000E+6114" + }, + { + "description": "[decq663] fold-down full sequence (Clamped)", + "input": "1E+6113", + "expected": "1.00E+6113" + }, + { + "description": "[decq665] fold-down full sequence (Clamped)", + "input": "1E+6112", + "expected": "1.0E+6112" + } +]; +testData.forEach(function(testCase) { + print(`Test - ${testCase.description}`); + var output = NumberDecimal(testCase.input).toString(); + if (testCase.expected) { + assert.eq(output, `NumberDecimal("${testCase.expected}")`); + } else { + assert.eq(output, `NumberDecimal("${testCase.input}")`); + } +}); }()); diff --git a/jstests/decimal/decimal128_test6.js b/jstests/decimal/decimal128_test6.js index 63bf6ea92ef..07a52669e33 100644 --- a/jstests/decimal/decimal128_test6.js +++ b/jstests/decimal/decimal128_test6.js @@ -3,47 +3,47 @@ */ (function() { - "use strict"; +"use strict"; - var parseErrors = [ - {"description": "Incomplete Exponent", "string": "1e"}, - {"description": "Exponent at the beginning", "string": "E01"}, - {"description": "Just a decimal place", "string": "."}, - {"description": "2 decimal places", "string": "..3"}, - {"description": "2 decimal places", "string": ".13.3"}, - {"description": "2 decimal places", "string": "1..3"}, - {"description": "2 decimal places", "string": "1.3.4"}, - {"description": "2 decimal places", "string": "1.34."}, - {"description": "Decimal with no digits", "string": ".e"}, - {"description": "2 signs", "string": "+-32.4"}, - {"description": "2 signs", "string": "-+32.4"}, - {"description": "2 negative signs", "string": "--32.4"}, - {"description": "2 negative signs", "string": "-32.-4"}, - {"description": "End in negative sign", "string": "32.0-"}, - {"description": "2 negative signs", "string": "32.4E--21"}, - {"description": "2 negative signs", "string": "32.4E-2-1"}, - {"description": "2 signs", "string": "32.4E+-21"}, - {"description": "Empty string", "string": ""}, - {"description": "leading white space positive number", "string": " 1"}, - {"description": "leading white space negative number", "string": " -1"}, - {"description": "trailing white space", "string": "1 "}, - {"description": "Invalid", "string": "E"}, - {"description": "Invalid", "string": "invalid"}, - {"description": "Invalid", "string": "i"}, - {"description": "Invalid", "string": "in"}, - {"description": "Invalid", "string": "-in"}, - {"description": "Invalid", "string": "Na"}, - {"description": "Invalid", "string": "-Na"}, - {"description": "Invalid", "string": "1.23abc"}, - {"description": "Invalid", "string": "1.23abcE+02"}, - {"description": "Invalid", "string": "1.23E+0aabs2"} - ]; +var parseErrors = [ + {"description": "Incomplete Exponent", "string": "1e"}, + {"description": "Exponent at the beginning", "string": "E01"}, + {"description": "Just a decimal place", "string": "."}, + {"description": "2 decimal places", "string": "..3"}, + {"description": "2 decimal places", "string": ".13.3"}, + {"description": "2 decimal places", "string": "1..3"}, + {"description": "2 decimal places", "string": "1.3.4"}, + {"description": "2 decimal places", "string": "1.34."}, + {"description": "Decimal with no digits", "string": ".e"}, + {"description": "2 signs", "string": "+-32.4"}, + {"description": "2 signs", "string": "-+32.4"}, + {"description": "2 negative signs", "string": "--32.4"}, + {"description": "2 negative signs", "string": "-32.-4"}, + {"description": "End in negative sign", "string": "32.0-"}, + {"description": "2 negative signs", "string": "32.4E--21"}, + {"description": "2 negative signs", "string": "32.4E-2-1"}, + {"description": "2 signs", "string": "32.4E+-21"}, + {"description": "Empty string", "string": ""}, + {"description": "leading white space positive number", "string": " 1"}, + {"description": "leading white space negative number", "string": " -1"}, + {"description": "trailing white space", "string": "1 "}, + {"description": "Invalid", "string": "E"}, + {"description": "Invalid", "string": "invalid"}, + {"description": "Invalid", "string": "i"}, + {"description": "Invalid", "string": "in"}, + {"description": "Invalid", "string": "-in"}, + {"description": "Invalid", "string": "Na"}, + {"description": "Invalid", "string": "-Na"}, + {"description": "Invalid", "string": "1.23abc"}, + {"description": "Invalid", "string": "1.23abcE+02"}, + {"description": "Invalid", "string": "1.23E+0aabs2"} +]; - parseErrors.forEach(function(testCase) { - print(`Test - ${testCase.description}`); - function test() { - NumberDecimal(testCase.string); - } - assert.throws(test, [], `[Test - ${testCase.description}] should have failed with error.`); - }); +parseErrors.forEach(function(testCase) { + print(`Test - ${testCase.description}`); + function test() { + NumberDecimal(testCase.string); + } + assert.throws(test, [], `[Test - ${testCase.description}] should have failed with error.`); +}); }());
\ No newline at end of file diff --git a/jstests/decimal/decimal128_test7.js b/jstests/decimal/decimal128_test7.js index a0ea63d3efb..d9ff5774ade 100644 --- a/jstests/decimal/decimal128_test7.js +++ b/jstests/decimal/decimal128_test7.js @@ -3,384 +3,416 @@ */ (function() { - "use strict"; +"use strict"; - var parseErrors = [ - {"description": "[basx572] Near-specials " + "(Conversion_syntax)", "string": "-9Inf"}, - { - "description": "[basx516] The 'baddies' tests from DiagBigDecimal, plus some new ones " + - "(Conversion_syntax)", - "string": "-1-" - }, - { - "description": "[basx533] The 'baddies' tests from DiagBigDecimal, plus some new ones " + - "(Conversion_syntax)", - "string": "0000.." - }, - { - "description": "[basx534] The 'baddies' tests from DiagBigDecimal, plus some new ones " + - "(Conversion_syntax)", - "string": ".0000." - }, - { - "description": "[basx535] The 'baddies' tests from DiagBigDecimal, plus some new ones " + - "(Conversion_syntax)", - "string": "00..00" - }, - {"description": "[basx569] Near-specials " + "(Conversion_syntax)", "string": "0Inf"}, - {"description": "[basx571] Near-specials " + "(Conversion_syntax)", "string": "-0Inf"}, - {"description": "[basx575] Near-specials " + "(Conversion_syntax)", "string": "0sNaN"}, - { - "description": "[basx503] The 'baddies' tests from DiagBigDecimal, plus some new ones " + - "(Conversion_syntax)", - "string": "++1" - }, - { - "description": "[basx504] The 'baddies' tests from DiagBigDecimal, plus some new ones " + - "(Conversion_syntax)", - "string": "--1" - }, - { - "description": "[basx505] The 'baddies' tests from DiagBigDecimal, plus some new ones " + - "(Conversion_syntax)", - "string": "-+1" - }, - { - "description": "[basx506] The 'baddies' tests from DiagBigDecimal, plus some new ones " + - "(Conversion_syntax)", - "string": "+-1" - }, - { - "description": "[basx510] The 'baddies' tests from DiagBigDecimal, plus some new ones " + - "(Conversion_syntax)", - "string": " +1" - }, - { - "description": "[basx513] The 'baddies' tests from DiagBigDecimal, plus some new ones " + - "(Conversion_syntax)", - "string": " + 1" - }, - { - "description": "[basx514] The 'baddies' tests from DiagBigDecimal, plus some new ones " + - "(Conversion_syntax)", - "string": " - 1" - }, - { - "description": "[basx501] The 'baddies' tests from DiagBigDecimal, plus some new ones " + - "(Conversion_syntax)", - "string": "." - }, - { - "description": "[basx502] The 'baddies' tests from DiagBigDecimal, plus some new ones " + - "(Conversion_syntax)", - "string": ".." - }, - { - "description": "[basx519] The 'baddies' tests from DiagBigDecimal, plus some new ones " + - "(Conversion_syntax)", - "string": "" - }, - { - "description": "[basx525] The 'baddies' tests from DiagBigDecimal, plus some new ones " + - "(Conversion_syntax)", - "string": "e100" - }, - { - "description": "[basx549] The 'baddies' tests from DiagBigDecimal, plus some new ones " + - "(Conversion_syntax)", - "string": "e+1" - }, - { - "description": "[basx577] some baddies with dots and Es and dots and specials " + - "(Conversion_syntax)", - "string": ".e+1" - }, - { - "description": "[basx578] some baddies with dots and Es and dots and specials " + - "(Conversion_syntax)", - "string": "+.e+1" - }, - { - "description": "[basx581] some baddies with dots and Es and dots and specials " + - "(Conversion_syntax)", - "string": "E+1" - }, - { - "description": "[basx582] some baddies with dots and Es and dots and specials " + - "(Conversion_syntax)", - "string": ".E+1" - }, - { - "description": "[basx583] some baddies with dots and Es and dots and specials " + - "(Conversion_syntax)", - "string": "+.E+1" - }, - { - "description": "[basx579] some baddies with dots and Es and dots and specials " + - "(Conversion_syntax)", - "string": "-.e+" - }, - { - "description": "[basx580] some baddies with dots and Es and dots and specials " + - "(Conversion_syntax)", - "string": "-.e" - }, - { - "description": "[basx584] some baddies with dots and Es and dots and specials " + - "(Conversion_syntax)", - "string": "-.E+" - }, - { - "description": "[basx585] some baddies with dots and Es and dots and specials " + - "(Conversion_syntax)", - "string": "-.E" - }, - { - "description": "[basx589] some baddies with dots and Es and dots and specials " + - "(Conversion_syntax)", - "string": "+.Inf" - }, - { - "description": "[basx586] some baddies with dots and Es and dots and specials " + - "(Conversion_syntax)", - "string": ".NaN" - }, - { - "description": "[basx587] some baddies with dots and Es and dots and specials " + - "(Conversion_syntax)", - "string": "-.NaN" - }, - { - "description": "[basx545] The 'baddies' tests from DiagBigDecimal, plus some new ones " + - "(Conversion_syntax)", - "string": "ONE" - }, - {"description": "[basx561] Near-specials " + "(Conversion_syntax)", "string": "qNaN"}, - {"description": "[basx573] Near-specials " + "(Conversion_syntax)", "string": "-sNa"}, - { - "description": "[basx588] some baddies with dots and Es and dots and specials " + - "(Conversion_syntax)", - "string": "+.sNaN" - }, - { - "description": "[basx544] The 'baddies' tests from DiagBigDecimal, plus some new ones " + - "(Conversion_syntax)", - "string": "ten" - }, - { - "description": "[basx527] The 'baddies' tests from DiagBigDecimal, plus some new ones " + - "(Conversion_syntax)", - "string": "u0b65" - }, - { - "description": "[basx526] The 'baddies' tests from DiagBigDecimal, plus some new ones " + - "(Conversion_syntax)", - "string": "u0e5a" - }, - { - "description": "[basx515] The 'baddies' tests from DiagBigDecimal, plus some new ones " + - "(Conversion_syntax)", - "string": "x" - }, - {"description": "[basx574] Near-specials " + "(Conversion_syntax)", "string": "xNaN"}, - { - "description": "[basx530] The 'baddies' tests from DiagBigDecimal, plus some new ones " + - "(Conversion_syntax)", - "string": ".123.5" - }, - { - "description": "[basx500] The 'baddies' tests from DiagBigDecimal, plus some new ones " + - "(Conversion_syntax)", - "string": "1..2" - }, - { - "description": "[basx542] The 'baddies' tests from DiagBigDecimal, plus some new ones " + - "(Conversion_syntax)", - "string": "1e1.0" - }, - { - "description": "[basx553] The 'baddies' tests from DiagBigDecimal, plus some new ones " + - "(Conversion_syntax)", - "string": "1E+1.2.3" - }, - { - "description": "[basx543] The 'baddies' tests from DiagBigDecimal, plus some new ones " + - "(Conversion_syntax)", - "string": "1e123e" - }, - { - "description": "[basx552] The 'baddies' tests from DiagBigDecimal, plus some new ones " + - "(Conversion_syntax)", - "string": "1E+1.2" - }, - { - "description": "[basx546] The 'baddies' tests from DiagBigDecimal, plus some new ones " + - "(Conversion_syntax)", - "string": "1e.1" - }, - { - "description": "[basx547] The 'baddies' tests from DiagBigDecimal, plus some new ones " + - "(Conversion_syntax)", - "string": "1e1." - }, - { - "description": "[basx554] The 'baddies' tests from DiagBigDecimal, plus some new ones " + - "(Conversion_syntax)", - "string": "1E++1" - }, - { - "description": "[basx555] The 'baddies' tests from DiagBigDecimal, plus some new ones " + - "(Conversion_syntax)", - "string": "1E--1" - }, - { - "description": "[basx556] The 'baddies' tests from DiagBigDecimal, plus some new ones " + - "(Conversion_syntax)", - "string": "1E+-1" - }, - { - "description": "[basx557] The 'baddies' tests from DiagBigDecimal, plus some new ones " + - "(Conversion_syntax)", - "string": "1E-+1" - }, - { - "description": "[basx558] The 'baddies' tests from DiagBigDecimal, plus some new ones " + - "(Conversion_syntax)", - "string": "1E'1" - }, - { - "description": "[basx559] The 'baddies' tests from DiagBigDecimal, plus some new ones " + - "(Conversion_syntax)", - "string": "1E\"1" - }, - { - "description": "[basx520] The 'baddies' tests from DiagBigDecimal, plus some new ones " + - "(Conversion_syntax)", - "string": "1e-" - }, - { - "description": "[basx560] The 'baddies' tests from DiagBigDecimal, plus some new ones " + - "(Conversion_syntax)", - "string": "1E" - }, - { - "description": "[basx548] The 'baddies' tests from DiagBigDecimal, plus some new ones " + - "(Conversion_syntax)", - "string": "1ee" - }, - { - "description": "[basx551] The 'baddies' tests from DiagBigDecimal, plus some new ones " + - "(Conversion_syntax)", - "string": "1.2.1" - }, - { - "description": "[basx550] The 'baddies' tests from DiagBigDecimal, plus some new ones " + - "(Conversion_syntax)", - "string": "1.23.4" - }, - { - "description": "[basx529] The 'baddies' tests from DiagBigDecimal, plus some new ones " + - "(Conversion_syntax)", - "string": "1.34.5" - }, - { - "description": "[basx531] The 'baddies' tests from DiagBigDecimal, plus some new ones " + - "(Conversion_syntax)", - "string": "01.35." - }, - { - "description": "[basx532] The 'baddies' tests from DiagBigDecimal, plus some new ones " + - "(Conversion_syntax)", - "string": "01.35-" - }, - { - "description": "[basx518] The 'baddies' tests from DiagBigDecimal, plus some new ones " + - "(Conversion_syntax)", - "string": "3+" - }, - { - "description": "[basx521] The 'baddies' tests from DiagBigDecimal, plus some new ones " + - "(Conversion_syntax)", - "string": "7e99999a" - }, - {"description": "[basx570] Near-specials " + "(Conversion_syntax)", "string": "9Inf"}, - { - "description": "[basx512] The 'baddies' tests from DiagBigDecimal, plus some new ones " + - "(Conversion_syntax)", - "string": "12 " - }, - { - "description": "[basx517] The 'baddies' tests from DiagBigDecimal, plus some new ones " + - "(Conversion_syntax)", - "string": "12-" - }, - { - "description": "[basx507] The 'baddies' tests from DiagBigDecimal, plus some new ones " + - "(Conversion_syntax)", - "string": "12e" - }, - { - "description": "[basx508] The 'baddies' tests from DiagBigDecimal, plus some new ones " + - "(Conversion_syntax)", - "string": "12e++" - }, - { - "description": "[basx509] The 'baddies' tests from DiagBigDecimal, plus some new ones " + - "(Conversion_syntax)", - "string": "12f4" - }, - { - "description": "[basx536] The 'baddies' tests from DiagBigDecimal, plus some new ones " + - "(Conversion_syntax)", - "string": "111e*123" - }, - { - "description": "[basx537] The 'baddies' tests from DiagBigDecimal, plus some new ones " + - "(Conversion_syntax)", - "string": "111e123-" - }, - { - "description": "[basx540] The 'baddies' tests from DiagBigDecimal, plus some new ones " + - "(Conversion_syntax)", - "string": "111e1*23" - }, - { - "description": "[basx538] The 'baddies' tests from DiagBigDecimal, plus some new ones " + - "(Conversion_syntax)", - "string": "111e+12+" - }, - { - "description": "[basx539] The 'baddies' tests from DiagBigDecimal, plus some new ones " + - "(Conversion_syntax)", - "string": "111e1-3-" - }, - { - "description": "[basx541] The 'baddies' tests from DiagBigDecimal, plus some new ones " + - "(Conversion_syntax)", - "string": "111E1e+3" - }, - { - "description": "[basx528] The 'baddies' tests from DiagBigDecimal, plus some new ones " + - "(Conversion_syntax)", - "string": "123,65" - }, - { - "description": "[basx523] The 'baddies' tests from DiagBigDecimal, plus some new ones " + - "(Conversion_syntax)", - "string": "7e12356789012x" - }, - { - "description": "[basx522] The 'baddies' tests from DiagBigDecimal, plus some new ones " + - "(Conversion_syntax)", - "string": "7e123567890x" - } - ]; +var parseErrors = [ + { + "description": "[basx572] Near-specials " + + "(Conversion_syntax)", + "string": "-9Inf" + }, + { + "description": "[basx516] The 'baddies' tests from DiagBigDecimal, plus some new ones " + + "(Conversion_syntax)", + "string": "-1-" + }, + { + "description": "[basx533] The 'baddies' tests from DiagBigDecimal, plus some new ones " + + "(Conversion_syntax)", + "string": "0000.." + }, + { + "description": "[basx534] The 'baddies' tests from DiagBigDecimal, plus some new ones " + + "(Conversion_syntax)", + "string": ".0000." + }, + { + "description": "[basx535] The 'baddies' tests from DiagBigDecimal, plus some new ones " + + "(Conversion_syntax)", + "string": "00..00" + }, + { + "description": "[basx569] Near-specials " + + "(Conversion_syntax)", + "string": "0Inf" + }, + { + "description": "[basx571] Near-specials " + + "(Conversion_syntax)", + "string": "-0Inf" + }, + { + "description": "[basx575] Near-specials " + + "(Conversion_syntax)", + "string": "0sNaN" + }, + { + "description": "[basx503] The 'baddies' tests from DiagBigDecimal, plus some new ones " + + "(Conversion_syntax)", + "string": "++1" + }, + { + "description": "[basx504] The 'baddies' tests from DiagBigDecimal, plus some new ones " + + "(Conversion_syntax)", + "string": "--1" + }, + { + "description": "[basx505] The 'baddies' tests from DiagBigDecimal, plus some new ones " + + "(Conversion_syntax)", + "string": "-+1" + }, + { + "description": "[basx506] The 'baddies' tests from DiagBigDecimal, plus some new ones " + + "(Conversion_syntax)", + "string": "+-1" + }, + { + "description": "[basx510] The 'baddies' tests from DiagBigDecimal, plus some new ones " + + "(Conversion_syntax)", + "string": " +1" + }, + { + "description": "[basx513] The 'baddies' tests from DiagBigDecimal, plus some new ones " + + "(Conversion_syntax)", + "string": " + 1" + }, + { + "description": "[basx514] The 'baddies' tests from DiagBigDecimal, plus some new ones " + + "(Conversion_syntax)", + "string": " - 1" + }, + { + "description": "[basx501] The 'baddies' tests from DiagBigDecimal, plus some new ones " + + "(Conversion_syntax)", + "string": "." + }, + { + "description": "[basx502] The 'baddies' tests from DiagBigDecimal, plus some new ones " + + "(Conversion_syntax)", + "string": ".." + }, + { + "description": "[basx519] The 'baddies' tests from DiagBigDecimal, plus some new ones " + + "(Conversion_syntax)", + "string": "" + }, + { + "description": "[basx525] The 'baddies' tests from DiagBigDecimal, plus some new ones " + + "(Conversion_syntax)", + "string": "e100" + }, + { + "description": "[basx549] The 'baddies' tests from DiagBigDecimal, plus some new ones " + + "(Conversion_syntax)", + "string": "e+1" + }, + { + "description": "[basx577] some baddies with dots and Es and dots and specials " + + "(Conversion_syntax)", + "string": ".e+1" + }, + { + "description": "[basx578] some baddies with dots and Es and dots and specials " + + "(Conversion_syntax)", + "string": "+.e+1" + }, + { + "description": "[basx581] some baddies with dots and Es and dots and specials " + + "(Conversion_syntax)", + "string": "E+1" + }, + { + "description": "[basx582] some baddies with dots and Es and dots and specials " + + "(Conversion_syntax)", + "string": ".E+1" + }, + { + "description": "[basx583] some baddies with dots and Es and dots and specials " + + "(Conversion_syntax)", + "string": "+.E+1" + }, + { + "description": "[basx579] some baddies with dots and Es and dots and specials " + + "(Conversion_syntax)", + "string": "-.e+" + }, + { + "description": "[basx580] some baddies with dots and Es and dots and specials " + + "(Conversion_syntax)", + "string": "-.e" + }, + { + "description": "[basx584] some baddies with dots and Es and dots and specials " + + "(Conversion_syntax)", + "string": "-.E+" + }, + { + "description": "[basx585] some baddies with dots and Es and dots and specials " + + "(Conversion_syntax)", + "string": "-.E" + }, + { + "description": "[basx589] some baddies with dots and Es and dots and specials " + + "(Conversion_syntax)", + "string": "+.Inf" + }, + { + "description": "[basx586] some baddies with dots and Es and dots and specials " + + "(Conversion_syntax)", + "string": ".NaN" + }, + { + "description": "[basx587] some baddies with dots and Es and dots and specials " + + "(Conversion_syntax)", + "string": "-.NaN" + }, + { + "description": "[basx545] The 'baddies' tests from DiagBigDecimal, plus some new ones " + + "(Conversion_syntax)", + "string": "ONE" + }, + { + "description": "[basx561] Near-specials " + + "(Conversion_syntax)", + "string": "qNaN" + }, + { + "description": "[basx573] Near-specials " + + "(Conversion_syntax)", + "string": "-sNa" + }, + { + "description": "[basx588] some baddies with dots and Es and dots and specials " + + "(Conversion_syntax)", + "string": "+.sNaN" + }, + { + "description": "[basx544] The 'baddies' tests from DiagBigDecimal, plus some new ones " + + "(Conversion_syntax)", + "string": "ten" + }, + { + "description": "[basx527] The 'baddies' tests from DiagBigDecimal, plus some new ones " + + "(Conversion_syntax)", + "string": "u0b65" + }, + { + "description": "[basx526] The 'baddies' tests from DiagBigDecimal, plus some new ones " + + "(Conversion_syntax)", + "string": "u0e5a" + }, + { + "description": "[basx515] The 'baddies' tests from DiagBigDecimal, plus some new ones " + + "(Conversion_syntax)", + "string": "x" + }, + { + "description": "[basx574] Near-specials " + + "(Conversion_syntax)", + "string": "xNaN" + }, + { + "description": "[basx530] The 'baddies' tests from DiagBigDecimal, plus some new ones " + + "(Conversion_syntax)", + "string": ".123.5" + }, + { + "description": "[basx500] The 'baddies' tests from DiagBigDecimal, plus some new ones " + + "(Conversion_syntax)", + "string": "1..2" + }, + { + "description": "[basx542] The 'baddies' tests from DiagBigDecimal, plus some new ones " + + "(Conversion_syntax)", + "string": "1e1.0" + }, + { + "description": "[basx553] The 'baddies' tests from DiagBigDecimal, plus some new ones " + + "(Conversion_syntax)", + "string": "1E+1.2.3" + }, + { + "description": "[basx543] The 'baddies' tests from DiagBigDecimal, plus some new ones " + + "(Conversion_syntax)", + "string": "1e123e" + }, + { + "description": "[basx552] The 'baddies' tests from DiagBigDecimal, plus some new ones " + + "(Conversion_syntax)", + "string": "1E+1.2" + }, + { + "description": "[basx546] The 'baddies' tests from DiagBigDecimal, plus some new ones " + + "(Conversion_syntax)", + "string": "1e.1" + }, + { + "description": "[basx547] The 'baddies' tests from DiagBigDecimal, plus some new ones " + + "(Conversion_syntax)", + "string": "1e1." + }, + { + "description": "[basx554] The 'baddies' tests from DiagBigDecimal, plus some new ones " + + "(Conversion_syntax)", + "string": "1E++1" + }, + { + "description": "[basx555] The 'baddies' tests from DiagBigDecimal, plus some new ones " + + "(Conversion_syntax)", + "string": "1E--1" + }, + { + "description": "[basx556] The 'baddies' tests from DiagBigDecimal, plus some new ones " + + "(Conversion_syntax)", + "string": "1E+-1" + }, + { + "description": "[basx557] The 'baddies' tests from DiagBigDecimal, plus some new ones " + + "(Conversion_syntax)", + "string": "1E-+1" + }, + { + "description": "[basx558] The 'baddies' tests from DiagBigDecimal, plus some new ones " + + "(Conversion_syntax)", + "string": "1E'1" + }, + { + "description": "[basx559] The 'baddies' tests from DiagBigDecimal, plus some new ones " + + "(Conversion_syntax)", + "string": "1E\"1" + }, + { + "description": "[basx520] The 'baddies' tests from DiagBigDecimal, plus some new ones " + + "(Conversion_syntax)", + "string": "1e-" + }, + { + "description": "[basx560] The 'baddies' tests from DiagBigDecimal, plus some new ones " + + "(Conversion_syntax)", + "string": "1E" + }, + { + "description": "[basx548] The 'baddies' tests from DiagBigDecimal, plus some new ones " + + "(Conversion_syntax)", + "string": "1ee" + }, + { + "description": "[basx551] The 'baddies' tests from DiagBigDecimal, plus some new ones " + + "(Conversion_syntax)", + "string": "1.2.1" + }, + { + "description": "[basx550] The 'baddies' tests from DiagBigDecimal, plus some new ones " + + "(Conversion_syntax)", + "string": "1.23.4" + }, + { + "description": "[basx529] The 'baddies' tests from DiagBigDecimal, plus some new ones " + + "(Conversion_syntax)", + "string": "1.34.5" + }, + { + "description": "[basx531] The 'baddies' tests from DiagBigDecimal, plus some new ones " + + "(Conversion_syntax)", + "string": "01.35." + }, + { + "description": "[basx532] The 'baddies' tests from DiagBigDecimal, plus some new ones " + + "(Conversion_syntax)", + "string": "01.35-" + }, + { + "description": "[basx518] The 'baddies' tests from DiagBigDecimal, plus some new ones " + + "(Conversion_syntax)", + "string": "3+" + }, + { + "description": "[basx521] The 'baddies' tests from DiagBigDecimal, plus some new ones " + + "(Conversion_syntax)", + "string": "7e99999a" + }, + { + "description": "[basx570] Near-specials " + + "(Conversion_syntax)", + "string": "9Inf" + }, + { + "description": "[basx512] The 'baddies' tests from DiagBigDecimal, plus some new ones " + + "(Conversion_syntax)", + "string": "12 " + }, + { + "description": "[basx517] The 'baddies' tests from DiagBigDecimal, plus some new ones " + + "(Conversion_syntax)", + "string": "12-" + }, + { + "description": "[basx507] The 'baddies' tests from DiagBigDecimal, plus some new ones " + + "(Conversion_syntax)", + "string": "12e" + }, + { + "description": "[basx508] The 'baddies' tests from DiagBigDecimal, plus some new ones " + + "(Conversion_syntax)", + "string": "12e++" + }, + { + "description": "[basx509] The 'baddies' tests from DiagBigDecimal, plus some new ones " + + "(Conversion_syntax)", + "string": "12f4" + }, + { + "description": "[basx536] The 'baddies' tests from DiagBigDecimal, plus some new ones " + + "(Conversion_syntax)", + "string": "111e*123" + }, + { + "description": "[basx537] The 'baddies' tests from DiagBigDecimal, plus some new ones " + + "(Conversion_syntax)", + "string": "111e123-" + }, + { + "description": "[basx540] The 'baddies' tests from DiagBigDecimal, plus some new ones " + + "(Conversion_syntax)", + "string": "111e1*23" + }, + { + "description": "[basx538] The 'baddies' tests from DiagBigDecimal, plus some new ones " + + "(Conversion_syntax)", + "string": "111e+12+" + }, + { + "description": "[basx539] The 'baddies' tests from DiagBigDecimal, plus some new ones " + + "(Conversion_syntax)", + "string": "111e1-3-" + }, + { + "description": "[basx541] The 'baddies' tests from DiagBigDecimal, plus some new ones " + + "(Conversion_syntax)", + "string": "111E1e+3" + }, + { + "description": "[basx528] The 'baddies' tests from DiagBigDecimal, plus some new ones " + + "(Conversion_syntax)", + "string": "123,65" + }, + { + "description": "[basx523] The 'baddies' tests from DiagBigDecimal, plus some new ones " + + "(Conversion_syntax)", + "string": "7e12356789012x" + }, + { + "description": "[basx522] The 'baddies' tests from DiagBigDecimal, plus some new ones " + + "(Conversion_syntax)", + "string": "7e123567890x" + } +]; - parseErrors.forEach(function(testCase) { - print(`Test - ${testCase.description}`); - function test() { - NumberDecimal(testCase.string); - } - assert.throws(test, [], `[Test - ${testCase.description}] should have failed with error.`); - }); +parseErrors.forEach(function(testCase) { + print(`Test - ${testCase.description}`); + function test() { + NumberDecimal(testCase.string); + } + assert.throws(test, [], `[Test - ${testCase.description}] should have failed with error.`); +}); }());
\ No newline at end of file diff --git a/jstests/decimal/decimal_constructors.js b/jstests/decimal/decimal_constructors.js index dd8e6cfef75..93a5bfe9703 100644 --- a/jstests/decimal/decimal_constructors.js +++ b/jstests/decimal/decimal_constructors.js @@ -1,42 +1,40 @@ // Tests constructing NumberDecimal with various types (function() { - 'use strict'; - var col = db.d_constructors; - col.drop(); +'use strict'; +var col = db.d_constructors; +col.drop(); - // Insert some sample data. +// Insert some sample data. - assert.writeOK(col.insert([ - {d: NumberDecimal('1')}, - {d: NumberDecimal(1)}, - {d: NumberDecimal(NumberLong('1'))}, - {d: NumberDecimal(NumberInt('1'))}, - {d: NumberDecimal('NaN')}, - {d: NumberDecimal('-NaN')} - ]), - 'Initial insertion of decimals failed'); +assert.writeOK(col.insert([ + {d: NumberDecimal('1')}, + {d: NumberDecimal(1)}, + {d: NumberDecimal(NumberLong('1'))}, + {d: NumberDecimal(NumberInt('1'))}, + {d: NumberDecimal('NaN')}, + {d: NumberDecimal('-NaN')} +]), + 'Initial insertion of decimals failed'); - var exactDoubleString = "1427247692705959881058285969449495136382746624"; - var exactDoubleTinyString = - "0.00000000000000000000000000000000000000000000000000000000000062230152778611417071440640537801242405902521687211671331011166147896988340353834411839448231257136169569665895551224821247160434722900390625"; +var exactDoubleString = "1427247692705959881058285969449495136382746624"; +var exactDoubleTinyString = + "0.00000000000000000000000000000000000000000000000000000000000062230152778611417071440640537801242405902521687211671331011166147896988340353834411839448231257136169569665895551224821247160434722900390625"; - assert.throws( - NumberDecimal, [exactDoubleString], 'Unexpected success in creating invalid Decimal128'); - assert.throws(NumberDecimal, - [exactDoubleTinyString], - 'Unexpected success in creating invalid Decimal128'); - assert.throws( - NumberDecimal, ['some garbage'], 'Unexpected success in creating invalid Decimal128'); +assert.throws( + NumberDecimal, [exactDoubleString], 'Unexpected success in creating invalid Decimal128'); +assert.throws( + NumberDecimal, [exactDoubleTinyString], 'Unexpected success in creating invalid Decimal128'); +assert.throws(NumberDecimal, ['some garbage'], 'Unexpected success in creating invalid Decimal128'); - // Find values with various types and NumberDecimal constructed types - assert.eq(col.find({'d': NumberDecimal('1')}).count(), '4'); - assert.eq(col.find({'d': NumberDecimal(1)}).count(), '4'); - assert.eq(col.find({'d': NumberDecimal(NumberLong(1))}).count(), '4'); - assert.eq(col.find({'d': NumberDecimal(NumberInt(1))}).count(), '4'); - assert.eq(col.find({'d': 1}).count(), '4'); - assert.eq(col.find({'d': NumberLong(1)}).count(), '4'); - assert.eq(col.find({'d': NumberInt(1)}).count(), '4'); - // NaN and -NaN are both evaluated to NaN - assert.eq(col.find({'d': NumberDecimal('NaN')}).count(), 2); +// Find values with various types and NumberDecimal constructed types +assert.eq(col.find({'d': NumberDecimal('1')}).count(), '4'); +assert.eq(col.find({'d': NumberDecimal(1)}).count(), '4'); +assert.eq(col.find({'d': NumberDecimal(NumberLong(1))}).count(), '4'); +assert.eq(col.find({'d': NumberDecimal(NumberInt(1))}).count(), '4'); +assert.eq(col.find({'d': 1}).count(), '4'); +assert.eq(col.find({'d': NumberLong(1)}).count(), '4'); +assert.eq(col.find({'d': NumberInt(1)}).count(), '4'); +// NaN and -NaN are both evaluated to NaN +assert.eq(col.find({'d': NumberDecimal('NaN')}).count(), 2); }()); diff --git a/jstests/decimal/decimal_find_basic.js b/jstests/decimal/decimal_find_basic.js index a6a92419616..28a9040a912 100644 --- a/jstests/decimal/decimal_find_basic.js +++ b/jstests/decimal/decimal_find_basic.js @@ -1,55 +1,54 @@ // Tests finding NumberDecimal from the shell. (function() { - "use strict"; - var col = db.decimal_find_basic; - col.drop(); - - // Insert some sample data. - - assert.writeOK(col.insert([ - {"decimal": NumberDecimal("0")}, - {"decimal": NumberDecimal("0.00")}, - {"decimal": NumberDecimal("-0")}, - {"decimal": NumberDecimal("1.0")}, - {"decimal": NumberDecimal("1.00")}, - {"decimal": NumberDecimal("2.00")}, - {"decimal": NumberDecimal("12345678901234567890.12345678901234")}, - {"decimal": NumberDecimal("NaN")}, - {"decimal": NumberDecimal("-NaN")}, - {"decimal": NumberDecimal("-Infinity")}, - {"decimal": NumberDecimal("Infinity")}, - ]), - "Initial insertion of decimals failed"); - - // Zeros - assert.eq(col.find({"decimal": NumberDecimal("0")}).count(), "3"); - - // NaNs - assert.eq(col.find({"decimal": NumberDecimal("NaN")}).count(), 2, "NaN find failed"); - - var theNaNs = [{"decimal": NumberDecimal("NaN")}, {"decimal": NumberDecimal("-NaN")}]; - - assert(bsonWoCompare(theNaNs[0], theNaNs[1]) == 0, "NaN compares equal"); - - // Infinity - assert.eq(col.find({"decimal": NumberDecimal("Infinity")}).count(), 1, "Infinity count wrong"); - assert.eq(col.find({"decimal": NumberDecimal("-Infinity")}).count(), 1, "Infinity count wrong"); - - // Maximum Precision - assert.eq(col.find({"decimal": NumberDecimal("12345678901234567890.12345678901234")}).count(), - 1, - "Maximum precision decimal not found."); - - col.drop(); - - // Maximum and Minimum Values - assert.writeOK(col.insert([ - {"max": NumberDecimal("9999999999999999999999999999999999E6111")}, - {"min": NumberDecimal("1E-6176")} - ])); - - assert.eq(col.find({"max": NumberDecimal("9999999999999999999999999999999999E6111")}).count(), - 1); - assert.eq(col.find({"min": NumberDecimal("1E-6176")}).count(), 1); +"use strict"; +var col = db.decimal_find_basic; +col.drop(); + +// Insert some sample data. + +assert.writeOK(col.insert([ + {"decimal": NumberDecimal("0")}, + {"decimal": NumberDecimal("0.00")}, + {"decimal": NumberDecimal("-0")}, + {"decimal": NumberDecimal("1.0")}, + {"decimal": NumberDecimal("1.00")}, + {"decimal": NumberDecimal("2.00")}, + {"decimal": NumberDecimal("12345678901234567890.12345678901234")}, + {"decimal": NumberDecimal("NaN")}, + {"decimal": NumberDecimal("-NaN")}, + {"decimal": NumberDecimal("-Infinity")}, + {"decimal": NumberDecimal("Infinity")}, +]), + "Initial insertion of decimals failed"); + +// Zeros +assert.eq(col.find({"decimal": NumberDecimal("0")}).count(), "3"); + +// NaNs +assert.eq(col.find({"decimal": NumberDecimal("NaN")}).count(), 2, "NaN find failed"); + +var theNaNs = [{"decimal": NumberDecimal("NaN")}, {"decimal": NumberDecimal("-NaN")}]; + +assert(bsonWoCompare(theNaNs[0], theNaNs[1]) == 0, "NaN compares equal"); + +// Infinity +assert.eq(col.find({"decimal": NumberDecimal("Infinity")}).count(), 1, "Infinity count wrong"); +assert.eq(col.find({"decimal": NumberDecimal("-Infinity")}).count(), 1, "Infinity count wrong"); + +// Maximum Precision +assert.eq(col.find({"decimal": NumberDecimal("12345678901234567890.12345678901234")}).count(), + 1, + "Maximum precision decimal not found."); + +col.drop(); + +// Maximum and Minimum Values +assert.writeOK(col.insert([ + {"max": NumberDecimal("9999999999999999999999999999999999E6111")}, + {"min": NumberDecimal("1E-6176")} +])); + +assert.eq(col.find({"max": NumberDecimal("9999999999999999999999999999999999E6111")}).count(), 1); +assert.eq(col.find({"min": NumberDecimal("1E-6176")}).count(), 1); }()); diff --git a/jstests/decimal/decimal_find_mixed.js b/jstests/decimal/decimal_find_mixed.js index 078ada3ad0f..0224c1b3fd8 100644 --- a/jstests/decimal/decimal_find_mixed.js +++ b/jstests/decimal/decimal_find_mixed.js @@ -1,70 +1,70 @@ // Tests finding NumberDecimal from the shell in mixed collections. (function() { - "use strict"; - var col = db.decimal_find_mixed; - col.drop(); +"use strict"; +var col = db.decimal_find_mixed; +col.drop(); - // Insert some sample data. +// Insert some sample data. - assert.writeOK(col.insert([ - {"a": -1}, - {"a": NumberDecimal("-1")}, - {"a": NumberLong("-1")}, - {"a": NumberInt("-1")}, - {"a": -0.3}, - {"a": NumberDecimal("-0.3")}, - {"a": -0.1}, - {"a": NumberDecimal("-0.1")}, - {"a": NumberDecimal("0")}, - {"a": 0}, - {"a": NumberDecimal("-0")}, - {"a": NumberDecimal("0.00")}, - {"a": NumberDecimal("0.1")}, - {"a": 0.1}, - {"a": NumberDecimal("0.3")}, - {"a": 0.3}, - {"a": NumberDecimal("0.5")}, - {"a": 0.5}, - {"a": NumberDecimal("1.0")}, - {"a": NumberLong("1")}, - {"a": NumberDecimal("1.00")}, - {"a": NumberDecimal("2.00")}, - {"a": NumberDecimal("12345678901234567890.12345678901234")}, - {"a": NumberDecimal("NaN")}, - {"a": NumberDecimal("-NaN")}, - {"a": NaN}, - {"a": NumberDecimal("Infinity")}, - {"a": Infinity} - ]), - "Initial decimal insertion failed"); +assert.writeOK(col.insert([ + {"a": -1}, + {"a": NumberDecimal("-1")}, + {"a": NumberLong("-1")}, + {"a": NumberInt("-1")}, + {"a": -0.3}, + {"a": NumberDecimal("-0.3")}, + {"a": -0.1}, + {"a": NumberDecimal("-0.1")}, + {"a": NumberDecimal("0")}, + {"a": 0}, + {"a": NumberDecimal("-0")}, + {"a": NumberDecimal("0.00")}, + {"a": NumberDecimal("0.1")}, + {"a": 0.1}, + {"a": NumberDecimal("0.3")}, + {"a": 0.3}, + {"a": NumberDecimal("0.5")}, + {"a": 0.5}, + {"a": NumberDecimal("1.0")}, + {"a": NumberLong("1")}, + {"a": NumberDecimal("1.00")}, + {"a": NumberDecimal("2.00")}, + {"a": NumberDecimal("12345678901234567890.12345678901234")}, + {"a": NumberDecimal("NaN")}, + {"a": NumberDecimal("-NaN")}, + {"a": NaN}, + {"a": NumberDecimal("Infinity")}, + {"a": Infinity} +]), + "Initial decimal insertion failed"); - // Simple finds - assert.eq(col.find({"a": -1}).count(), 4, "A1"); - assert.eq(col.find({"a": NumberLong("-1")}).count(), 4, "A2"); - assert.eq(col.find({"a": NumberInt("-1")}).count(), 4, "A3"); - assert.eq(col.find({"a": NumberDecimal("-1")}).count(), 4, "A4"); +// Simple finds +assert.eq(col.find({"a": -1}).count(), 4, "A1"); +assert.eq(col.find({"a": NumberLong("-1")}).count(), 4, "A2"); +assert.eq(col.find({"a": NumberInt("-1")}).count(), 4, "A3"); +assert.eq(col.find({"a": NumberDecimal("-1")}).count(), 4, "A4"); - assert.eq(col.find({"a": NaN}).count(), 3, "B1"); - assert.eq(col.find({"a": NumberDecimal("NaN")}).count(), 3, "B2"); - assert.eq(col.find({"a": Infinity}).count(), 2, "B3"); - assert.eq(col.find({"a": NumberDecimal("Infinity")}).count(), 2, "B4"); +assert.eq(col.find({"a": NaN}).count(), 3, "B1"); +assert.eq(col.find({"a": NumberDecimal("NaN")}).count(), 3, "B2"); +assert.eq(col.find({"a": Infinity}).count(), 2, "B3"); +assert.eq(col.find({"a": NumberDecimal("Infinity")}).count(), 2, "B4"); - assert.eq(col.find({$and: [{"a": {$gte: 0}}, {"a": {$lte: 2}}]}).count(), 14, "C1"); +assert.eq(col.find({$and: [{"a": {$gte: 0}}, {"a": {$lte: 2}}]}).count(), 14, "C1"); - // Proper mixed ordering of decimals and doubles - col.drop(); - assert.writeOK(col.insert([{"a": NumberDecimal("0.3")}, {"a": 0.3}], "2 insertion failed")); +// Proper mixed ordering of decimals and doubles +col.drop(); +assert.writeOK(col.insert([{"a": NumberDecimal("0.3")}, {"a": 0.3}], "2 insertion failed")); - assert.eq(col.find({"a": {$lt: NumberDecimal("0.3")}}).count(), 1, "D1"); - assert.eq(col.find({"a": {$gt: 0.3}}).count(), 1, "D1"); +assert.eq(col.find({"a": {$lt: NumberDecimal("0.3")}}).count(), 1, "D1"); +assert.eq(col.find({"a": {$gt: 0.3}}).count(), 1, "D1"); - // Find with NumberLong, but not Double - col.drop(); - assert.writeOK(col.insert([{"a": NumberDecimal("36028797018963967")}], "3 insertion failed")); +// Find with NumberLong, but not Double +col.drop(); +assert.writeOK(col.insert([{"a": NumberDecimal("36028797018963967")}], "3 insertion failed")); - assert.eq(col.find({"a": NumberDecimal("36028797018963967")}).count(), 1, "E1"); - // Not representable as double - assert.eq(col.find({"a": 36028797018963967}).count(), 0, "E2"); - assert.eq(col.find({"a": NumberLong("36028797018963967")}).count(), 1, "E3"); +assert.eq(col.find({"a": NumberDecimal("36028797018963967")}).count(), 1, "E1"); +// Not representable as double +assert.eq(col.find({"a": 36028797018963967}).count(), 0, "E2"); +assert.eq(col.find({"a": NumberLong("36028797018963967")}).count(), 1, "E3"); }()); diff --git a/jstests/decimal/decimal_find_query.js b/jstests/decimal/decimal_find_query.js index 7f3d8c10284..e584e9e1f47 100644 --- a/jstests/decimal/decimal_find_query.js +++ b/jstests/decimal/decimal_find_query.js @@ -1,49 +1,49 @@ // Find the decimal using query operators (function() { - 'use strict'; - var col = db.decimal_find_query; - col.drop(); +'use strict'; +var col = db.decimal_find_query; +col.drop(); - // Insert some sample data. +// Insert some sample data. - assert.writeOK(col.insert([ - {'decimal': NumberDecimal('0')}, - {'decimal': NumberDecimal('0.00')}, - {'decimal': NumberDecimal('-0')}, - {'decimal': NumberDecimal('1.0')}, - {'decimal': NumberDecimal('1.00')}, - {'decimal': NumberDecimal('2.00')}, - {'decimal': NumberDecimal('12345678901234.56789012345678901234')}, - {'decimal': NumberDecimal('NaN')}, - {'decimal': NumberDecimal('-NaN')}, - {'decimal': NumberDecimal('Infinity')}, - {'decimal': NumberDecimal('-Infinity')}, - ]), - 'Initial insertion failed'); +assert.writeOK(col.insert([ + {'decimal': NumberDecimal('0')}, + {'decimal': NumberDecimal('0.00')}, + {'decimal': NumberDecimal('-0')}, + {'decimal': NumberDecimal('1.0')}, + {'decimal': NumberDecimal('1.00')}, + {'decimal': NumberDecimal('2.00')}, + {'decimal': NumberDecimal('12345678901234.56789012345678901234')}, + {'decimal': NumberDecimal('NaN')}, + {'decimal': NumberDecimal('-NaN')}, + {'decimal': NumberDecimal('Infinity')}, + {'decimal': NumberDecimal('-Infinity')}, +]), + 'Initial insertion failed'); - assert.eq(col.find({'decimal': {$eq: NumberDecimal('1')}}).count(), '2'); - assert.eq(col.find({'decimal': {$lt: NumberDecimal('1.00000000000001')}}).count(), 6); - assert.eq(col.find({'decimal': {$gt: NumberDecimal('1.5')}}).count(), 3); +assert.eq(col.find({'decimal': {$eq: NumberDecimal('1')}}).count(), '2'); +assert.eq(col.find({'decimal': {$lt: NumberDecimal('1.00000000000001')}}).count(), 6); +assert.eq(col.find({'decimal': {$gt: NumberDecimal('1.5')}}).count(), 3); - assert.eq(col.find({'decimal': {$gte: NumberDecimal('2.000')}}).count(), 3); - assert.eq(col.find({'decimal': {$lte: NumberDecimal('0.9999999999999999')}}).count(), 4); +assert.eq(col.find({'decimal': {$gte: NumberDecimal('2.000')}}).count(), 3); +assert.eq(col.find({'decimal': {$lte: NumberDecimal('0.9999999999999999')}}).count(), 4); - assert.eq(col.find({'decimal': {$nin: [NumberDecimal('Infinity'), NumberDecimal('-Infinity')]}}) - .count(), - 9, - 'Infinity count incorrect'); +assert.eq( + col.find({'decimal': {$nin: [NumberDecimal('Infinity'), NumberDecimal('-Infinity')]}}).count(), + 9, + 'Infinity count incorrect'); - // Test $mod - col.drop(); - assert.writeOK(col.insert([ - {'decimal': NumberDecimal('0')}, - {'decimal': NumberDecimal('0.00')}, - {'decimal': NumberDecimal('-0')}, - {'decimal': NumberDecimal('1.0')}, - {'decimal': NumberDecimal('1.00')}, - {'decimal': NumberDecimal('2.00')}, - ]), - '2 insertion failed'); - assert.eq(col.find({'decimal': {$mod: [2, 0]}}).count(), 4, "$mod count incorrect"); +// Test $mod +col.drop(); +assert.writeOK(col.insert([ + {'decimal': NumberDecimal('0')}, + {'decimal': NumberDecimal('0.00')}, + {'decimal': NumberDecimal('-0')}, + {'decimal': NumberDecimal('1.0')}, + {'decimal': NumberDecimal('1.00')}, + {'decimal': NumberDecimal('2.00')}, +]), + '2 insertion failed'); +assert.eq(col.find({'decimal': {$mod: [2, 0]}}).count(), 4, "$mod count incorrect"); }()); diff --git a/jstests/decimal/decimal_roundtrip_basic.js b/jstests/decimal/decimal_roundtrip_basic.js index b130eeebccb..612b6fcd631 100644 --- a/jstests/decimal/decimal_roundtrip_basic.js +++ b/jstests/decimal/decimal_roundtrip_basic.js @@ -1,52 +1,52 @@ // Tests doing simple round-trip operations from the shell. (function() { - "use strict"; - var col = db.roundtrip_basic; - col.drop(); +"use strict"; +var col = db.roundtrip_basic; +col.drop(); - // Insert some sample data. +// Insert some sample data. - assert.writeOK(col.insert([ - {"decimal": NumberDecimal("0")}, - {"decimal": NumberDecimal("0.00")}, - {"decimal": NumberDecimal("-0")}, - {"decimal": NumberDecimal("1.0")}, - {"decimal": NumberDecimal("0.10")}, - {"decimal": NumberDecimal("2.00")}, - {"decimal": NumberDecimal("12345678901234567890.12345678901234")}, - {"decimal": NumberDecimal("NaN")}, - {"decimal": NumberDecimal("-NaN")}, - {"decimal": NumberDecimal("Infinity")}, - {"decimal": NumberDecimal("-Infinity")}, - {"decimal": NumberDecimal("9999999999999999999999999999999999E6111")}, - {"decimal": NumberDecimal("1E-6176")}, - ]), - "Initial insertion of decimals failed"); +assert.writeOK(col.insert([ + {"decimal": NumberDecimal("0")}, + {"decimal": NumberDecimal("0.00")}, + {"decimal": NumberDecimal("-0")}, + {"decimal": NumberDecimal("1.0")}, + {"decimal": NumberDecimal("0.10")}, + {"decimal": NumberDecimal("2.00")}, + {"decimal": NumberDecimal("12345678901234567890.12345678901234")}, + {"decimal": NumberDecimal("NaN")}, + {"decimal": NumberDecimal("-NaN")}, + {"decimal": NumberDecimal("Infinity")}, + {"decimal": NumberDecimal("-Infinity")}, + {"decimal": NumberDecimal("9999999999999999999999999999999999E6111")}, + {"decimal": NumberDecimal("1E-6176")}, +]), + "Initial insertion of decimals failed"); - // Check that the searching for queryValue results in finding expectedValues. - // All arguments are string representations of NumberDecimal values. - function checkDecimals(queryValue, expectedValues) { - queryValue = NumberDecimal(queryValue); - expectedValues = expectedValues.map((function(string) { - return NumberDecimal(string); - })); - var docs = col.find({decimal: queryValue}, {_id: 0}).sort({decimal: 1, _id: 1}).toArray(); - var actualValues = docs.map((function(item) { - return item.decimal; - })); - assert.eq(actualValues, expectedValues, "problem retrieving " + queryValue.toString()); - } +// Check that the searching for queryValue results in finding expectedValues. +// All arguments are string representations of NumberDecimal values. +function checkDecimals(queryValue, expectedValues) { + queryValue = NumberDecimal(queryValue); + expectedValues = expectedValues.map((function(string) { + return NumberDecimal(string); + })); + var docs = col.find({decimal: queryValue}, {_id: 0}).sort({decimal: 1, _id: 1}).toArray(); + var actualValues = docs.map((function(item) { + return item.decimal; + })); + assert.eq(actualValues, expectedValues, "problem retrieving " + queryValue.toString()); +} - checkDecimals("0", ["0", "0.00", "-0"]); - checkDecimals("1.0", ["1.0"]); - checkDecimals("0.1", ["0.10"]); - checkDecimals("2", ["2.00"]); - checkDecimals("12345678901234567890.12345678901234", ["12345678901234567890.12345678901234"]); - checkDecimals("NaN", ["NaN", "-NaN"]); - checkDecimals("Infinity", ["Infinity"]); - checkDecimals("-Infinity", ["-Infinity"]); - checkDecimals("9999999999999999999999999999999999E6111", - ["9999999999999999999999999999999999E6111"]); - checkDecimals("1E-6176", ["1E-6176"]); +checkDecimals("0", ["0", "0.00", "-0"]); +checkDecimals("1.0", ["1.0"]); +checkDecimals("0.1", ["0.10"]); +checkDecimals("2", ["2.00"]); +checkDecimals("12345678901234567890.12345678901234", ["12345678901234567890.12345678901234"]); +checkDecimals("NaN", ["NaN", "-NaN"]); +checkDecimals("Infinity", ["Infinity"]); +checkDecimals("-Infinity", ["-Infinity"]); +checkDecimals("9999999999999999999999999999999999E6111", + ["9999999999999999999999999999999999E6111"]); +checkDecimals("1E-6176", ["1E-6176"]); }()); diff --git a/jstests/decimal/decimal_update.js b/jstests/decimal/decimal_update.js index 6be2bd9e3e6..f50994ce32b 100644 --- a/jstests/decimal/decimal_update.js +++ b/jstests/decimal/decimal_update.js @@ -1,40 +1,40 @@ // Test decimal updates (function() { - "use strict"; - var col = db.decimal_updates; - col.drop(); +"use strict"; +var col = db.decimal_updates; +col.drop(); - // Insert some sample data. - var docs = [ - {'a': NumberDecimal("1.0")}, - {'a': NumberDecimal("0.0")}, - {'a': NumberDecimal("1.00")}, - {'a': NumberLong("1")}, - {'a': 1} - ]; +// Insert some sample data. +var docs = [ + {'a': NumberDecimal("1.0")}, + {'a': NumberDecimal("0.0")}, + {'a': NumberDecimal("1.00")}, + {'a': NumberLong("1")}, + {'a': 1} +]; - assert.writeOK(col.insert(docs), "Initial insertion failed"); +assert.writeOK(col.insert(docs), "Initial insertion failed"); - assert.writeOK(col.update({}, {$inc: {'a': NumberDecimal("10")}}, {multi: true}), - "update $inc failed"); - assert.eq(col.find({a: 11}).count(), 4, "count after $inc incorrect"); - assert.writeOK(col.update({}, {$inc: {'a': NumberDecimal("0")}}, {multi: true}), - "update $inc 0 failed"); - assert.eq(col.find({a: 11}).count(), 4, "count after $inc 0 incorrect"); +assert.writeOK(col.update({}, {$inc: {'a': NumberDecimal("10")}}, {multi: true}), + "update $inc failed"); +assert.eq(col.find({a: 11}).count(), 4, "count after $inc incorrect"); +assert.writeOK(col.update({}, {$inc: {'a': NumberDecimal("0")}}, {multi: true}), + "update $inc 0 failed"); +assert.eq(col.find({a: 11}).count(), 4, "count after $inc 0 incorrect"); - col.drop(); - assert.writeOK(col.insert(docs), "Second insertion failed"); +col.drop(); +assert.writeOK(col.insert(docs), "Second insertion failed"); - assert.writeOK(col.update({}, {$mul: {'a': NumberDecimal("1")}}, {multi: true}), - "update $mul failed"); - assert.eq(col.find({a: 1}).count(), 4, "count after $mul incorrect"); - assert.writeOK(col.update({}, {$mul: {'a': NumberDecimal("2")}}, {multi: true}), - "update $mul 2 failed"); - assert.eq(col.find({a: 2}).count(), 4, "count after $mul incorrect"); - assert.writeOK(col.update({}, {$mul: {'a': NumberDecimal("0")}}, {multi: true}), - "update $mul 0 failed"); - assert.eq(col.find({a: 0}).count(), 5, "count after $mul 0 incorrect"); +assert.writeOK(col.update({}, {$mul: {'a': NumberDecimal("1")}}, {multi: true}), + "update $mul failed"); +assert.eq(col.find({a: 1}).count(), 4, "count after $mul incorrect"); +assert.writeOK(col.update({}, {$mul: {'a': NumberDecimal("2")}}, {multi: true}), + "update $mul 2 failed"); +assert.eq(col.find({a: 2}).count(), 4, "count after $mul incorrect"); +assert.writeOK(col.update({}, {$mul: {'a': NumberDecimal("0")}}, {multi: true}), + "update $mul 0 failed"); +assert.eq(col.find({a: 0}).count(), 5, "count after $mul 0 incorrect"); - assert.writeError(col.update({}, {$bit: {'a': {and: 1}}}, {multi: true}), "$bit should fail"); +assert.writeError(col.update({}, {$bit: {'a': {and: 1}}}, {multi: true}), "$bit should fail"); }()); |