OpenSimMirror/bin/ScriptEngines/Lib/test/decimaltestdata/decimal64.decTest

445 lines
23 KiB
Plaintext
Raw Normal View History

2008-02-22 18:11:10 +00:00
------------------------------------------------------------------------
-- decimal64.decTest -- decimal eight-byte format testcases --
-- Copyright (c) IBM Corporation, 2000, 2003. All rights reserved. --
------------------------------------------------------------------------
-- Please see the document "General Decimal Arithmetic Testcases" --
-- at http://www2.hursley.ibm.com/decimal for the description of --
-- these testcases. --
-- --
-- These testcases are experimental ('beta' versions), and they --
-- may contain errors. They are offered on an as-is basis. In --
-- particular, achieving the same results as the tests here is not --
-- a guarantee that an implementation complies with any Standard --
-- or specification. The tests are not exhaustive. --
-- --
-- Please send comments, suggestions, and corrections to the author: --
-- Mike Cowlishaw, IBM Fellow --
-- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK --
-- mfc@uk.ibm.com --
------------------------------------------------------------------------
version: 2.39
-- This set of tests is for the eight-byte concrete representation.
-- Its characteristics are:
--
-- 1 bit sign
-- 5 bits combination field
-- 8 bits exponent continuation
-- 50 bits coefficient continuation
--
-- Total exponent length 10 bits
-- Total coefficient length 54 bits (16 digits)
--
-- Elimit = 767 (maximum encoded exponent)
-- Emax = 384 (largest exponent value)
-- Emin = -383 (smallest exponent value)
-- bias = 398 (subtracted from encoded exponent) = -Etiny
extended: 1
precision: 16
rounding: half_up
maxExponent: 384
minExponent: -383
-- General testcases
-- (mostly derived from the Strawman 4 document and examples)
dece001 apply #A2300000000003D0 -> -7.50
dece002 apply -7.50 -> #A2300000000003D0
-- Normality
dece010 apply 1234567890123456 -> #263934b9c1e28e56
dece011 apply 1234567890123456.0 -> #263934b9c1e28e56 Rounded
dece012 apply 1234567890123456.1 -> #263934b9c1e28e56 Rounded Inexact
dece013 apply -1234567890123456 -> #a63934b9c1e28e56
dece014 apply -1234567890123456.0 -> #a63934b9c1e28e56 Rounded
dece015 apply -1234567890123456.1 -> #a63934b9c1e28e56 Rounded Inexact
-- Nmax and similar
dece022 apply 9.999999999999999E+384 -> #77fcff3fcff3fcff
dece023 apply #77fcff3fcff3fcff -> 9.999999999999999E+384
dece024 apply 1.234567890123456E+384 -> #47fd34b9c1e28e56
dece025 apply #47fd34b9c1e28e56 -> 1.234567890123456E+384
-- fold-downs (more below)
dece030 apply 1.23E+384 -> #47fd300000000000 Clamped
dece031 apply #47fd300000000000 -> 1.230000000000000E+384
dece032 apply 1E+384 -> #47fc000000000000 Clamped
dece033 apply #47fc000000000000 -> 1.000000000000000E+384
-- overflows
maxExponent: 999 -- set high so conversion causes the overflow
minExponent: -999
dece040 apply 10E+384 -> #7800000000000000 Overflow Rounded Inexact
dece041 apply 1.000000000000000E+385 -> #7800000000000000 Overflow Rounded Inexact
maxExponent: 384
minExponent: -383
dece051 apply 12345 -> #22380000000049c5
dece052 apply #22380000000049c5 -> 12345
dece053 apply 1234 -> #2238000000000534
dece054 apply #2238000000000534 -> 1234
dece055 apply 123 -> #22380000000000a3
dece056 apply #22380000000000a3 -> 123
dece057 apply 12 -> #2238000000000012
dece058 apply #2238000000000012 -> 12
dece059 apply 1 -> #2238000000000001
dece060 apply #2238000000000001 -> 1
dece061 apply 1.23 -> #22300000000000a3
dece062 apply #22300000000000a3 -> 1.23
dece063 apply 123.45 -> #22300000000049c5
dece064 apply #22300000000049c5 -> 123.45
-- Nmin and below
dece071 apply 1E-383 -> #003c000000000001
dece072 apply #003c000000000001 -> 1E-383
dece073 apply 1.000000000000000E-383 -> #0400000000000000
dece074 apply #0400000000000000 -> 1.000000000000000E-383
dece075 apply 1.000000000000001E-383 -> #0400000000000001
dece076 apply #0400000000000001 -> 1.000000000000001E-383
dece077 apply 0.100000000000000E-383 -> #0000800000000000 Subnormal
dece078 apply #0000800000000000 -> 1.00000000000000E-384 Subnormal
dece079 apply 0.000000000000010E-383 -> #0000000000000010 Subnormal
dece080 apply #0000000000000010 -> 1.0E-397 Subnormal
dece081 apply 0.00000000000001E-383 -> #0004000000000001 Subnormal
dece082 apply #0004000000000001 -> 1E-397 Subnormal
dece083 apply 0.000000000000001E-383 -> #0000000000000001 Subnormal
dece084 apply #0000000000000001 -> 1E-398 Subnormal
-- underflows
dece090 apply 1e-398 -> #0000000000000001 Subnormal
dece091 apply 1.9e-398 -> #0000000000000002 Subnormal Underflow Inexact Rounded
dece092 apply 1.1e-398 -> #0000000000000001 Subnormal Underflow Inexact Rounded
dece093 apply 1.00000000001e-398 -> #0000000000000001 Subnormal Underflow Inexact Rounded
dece094 apply 1.00000000000001e-398 -> #0000000000000001 Subnormal Underflow Inexact Rounded
dece095 apply 1.000000000000001e-398 -> #0000000000000001 Subnormal Underflow Inexact Rounded
dece096 apply 0.1e-398 -> #0000000000000000 Subnormal Underflow Inexact Rounded
dece097 apply 0.00000000001e-398 -> #0000000000000000 Subnormal Underflow Inexact Rounded
dece098 apply 0.00000000000001e-398 -> #0000000000000000 Subnormal Underflow Inexact Rounded
dece099 apply 0.000000000000001e-398 -> #0000000000000000 Subnormal Underflow Inexact Rounded
-- Same again, negatives
-- Nmax and similar
dece122 apply -9.999999999999999E+384 -> #f7fcff3fcff3fcff
dece123 apply #f7fcff3fcff3fcff -> -9.999999999999999E+384
dece124 apply -1.234567890123456E+384 -> #c7fd34b9c1e28e56
dece125 apply #c7fd34b9c1e28e56 -> -1.234567890123456E+384
-- fold-downs (more below)
dece130 apply -1.23E+384 -> #c7fd300000000000 Clamped
dece131 apply #c7fd300000000000 -> -1.230000000000000E+384
dece132 apply -1E+384 -> #c7fc000000000000 Clamped
dece133 apply #c7fc000000000000 -> -1.000000000000000E+384
-- overflows
maxExponent: 999 -- set high so conversion causes the overflow
minExponent: -999
dece140 apply -10E+384 -> #f800000000000000 Overflow Rounded Inexact
dece141 apply -1.000000000000000E+385 -> #f800000000000000 Overflow Rounded Inexact
maxExponent: 384
minExponent: -383
dece151 apply -12345 -> #a2380000000049c5
dece152 apply #a2380000000049c5 -> -12345
dece153 apply -1234 -> #a238000000000534
dece154 apply #a238000000000534 -> -1234
dece155 apply -123 -> #a2380000000000a3
dece156 apply #a2380000000000a3 -> -123
dece157 apply -12 -> #a238000000000012
dece158 apply #a238000000000012 -> -12
dece159 apply -1 -> #a238000000000001
dece160 apply #a238000000000001 -> -1
dece161 apply -1.23 -> #a2300000000000a3
dece162 apply #a2300000000000a3 -> -1.23
dece163 apply -123.45 -> #a2300000000049c5
dece164 apply #a2300000000049c5 -> -123.45
-- Nmin and below
dece171 apply -1E-383 -> #803c000000000001
dece172 apply #803c000000000001 -> -1E-383
dece173 apply -1.000000000000000E-383 -> #8400000000000000
dece174 apply #8400000000000000 -> -1.000000000000000E-383
dece175 apply -1.000000000000001E-383 -> #8400000000000001
dece176 apply #8400000000000001 -> -1.000000000000001E-383
dece177 apply -0.100000000000000E-383 -> #8000800000000000 Subnormal
dece178 apply #8000800000000000 -> -1.00000000000000E-384 Subnormal
dece179 apply -0.000000000000010E-383 -> #8000000000000010 Subnormal
dece180 apply #8000000000000010 -> -1.0E-397 Subnormal
dece181 apply -0.00000000000001E-383 -> #8004000000000001 Subnormal
dece182 apply #8004000000000001 -> -1E-397 Subnormal
dece183 apply -0.000000000000001E-383 -> #8000000000000001 Subnormal
dece184 apply #8000000000000001 -> -1E-398 Subnormal
-- underflows
dece189 apply -1e-398 -> #8000000000000001 Subnormal
dece190 apply -1.0e-398 -> #8000000000000001 Subnormal Rounded
dece191 apply -1.9e-398 -> #8000000000000002 Subnormal Underflow Inexact Rounded
dece192 apply -1.1e-398 -> #8000000000000001 Subnormal Underflow Inexact Rounded
dece193 apply -1.00000000001e-398 -> #8000000000000001 Subnormal Underflow Inexact Rounded
dece194 apply -1.00000000000001e-398 -> #8000000000000001 Subnormal Underflow Inexact Rounded
dece195 apply -1.000000000000001e-398 -> #8000000000000001 Subnormal Underflow Inexact Rounded
dece196 apply -0.1e-398 -> #8000000000000000 Subnormal Underflow Inexact Rounded
dece197 apply -0.00000000001e-398 -> #8000000000000000 Subnormal Underflow Inexact Rounded
dece198 apply -0.00000000000001e-398 -> #8000000000000000 Subnormal Underflow Inexact Rounded
dece199 apply -0.000000000000001e-398 -> #8000000000000000 Subnormal Underflow Inexact Rounded
-- zeros
dece401 apply 0E-500 -> #0000000000000000 Clamped
dece402 apply 0E-400 -> #0000000000000000 Clamped
dece403 apply 0E-398 -> #0000000000000000
dece404 apply #0000000000000000 -> 0E-398
dece405 apply 0.000000000000000E-383 -> #0000000000000000
dece406 apply #0000000000000000 -> 0E-398
dece407 apply 0E-2 -> #2230000000000000
dece408 apply #2230000000000000 -> 0.00
dece409 apply 0 -> #2238000000000000
dece410 apply #2238000000000000 -> 0
dece411 apply 0E+3 -> #2244000000000000
dece412 apply #2244000000000000 -> 0E+3
dece413 apply 0E+369 -> #43fc000000000000
dece414 apply #43fc000000000000 -> 0E+369
-- clamped zeros...
dece415 apply 0E+370 -> #43fc000000000000 Clamped
dece416 apply #43fc000000000000 -> 0E+369
dece417 apply 0E+384 -> #43fc000000000000 Clamped
dece418 apply #43fc000000000000 -> 0E+369
dece419 apply 0E+400 -> #43fc000000000000 Clamped
dece420 apply #43fc000000000000 -> 0E+369
dece421 apply 0E+500 -> #43fc000000000000 Clamped
dece422 apply #43fc000000000000 -> 0E+369
-- negative zeros
dece431 apply -0E-400 -> #8000000000000000 Clamped
dece432 apply -0E-400 -> #8000000000000000 Clamped
dece433 apply -0E-398 -> #8000000000000000
dece434 apply #8000000000000000 -> -0E-398
dece435 apply -0.000000000000000E-383 -> #8000000000000000
dece436 apply #8000000000000000 -> -0E-398
dece437 apply -0E-2 -> #a230000000000000
dece438 apply #a230000000000000 -> -0.00
dece439 apply -0 -> #a238000000000000
dece440 apply #a238000000000000 -> -0
dece441 apply -0E+3 -> #a244000000000000
dece442 apply #a244000000000000 -> -0E+3
dece443 apply -0E+369 -> #c3fc000000000000
dece444 apply #c3fc000000000000 -> -0E+369
-- clamped zeros...
dece445 apply -0E+370 -> #c3fc000000000000 Clamped
dece446 apply #c3fc000000000000 -> -0E+369
dece447 apply -0E+384 -> #c3fc000000000000 Clamped
dece448 apply #c3fc000000000000 -> -0E+369
dece449 apply -0E+400 -> #c3fc000000000000 Clamped
dece450 apply #c3fc000000000000 -> -0E+369
dece451 apply -0E+500 -> #c3fc000000000000 Clamped
dece452 apply #c3fc000000000000 -> -0E+369
-- Specials
dece500 apply Infinity -> #7800000000000000
dece501 apply #7878787878787878 -> #7800000000000000
dece502 apply #7800000000000000 -> Infinity
dece503 apply #7979797979797979 -> #7800000000000000
dece504 apply #7900000000000000 -> Infinity
dece505 apply #7a7a7a7a7a7a7a7a -> #7800000000000000
dece506 apply #7a00000000000000 -> Infinity
dece507 apply #7b7b7b7b7b7b7b7b -> #7800000000000000
dece508 apply #7b00000000000000 -> Infinity
dece509 apply NaN -> #7c00000000000000
dece510 apply #7c7c7c7c7c7c7c7c -> #7c007c7c7c7c7c7c
dece511 apply #7c00000000000000 -> NaN
dece512 apply #7d7d7d7d7d7d7d7d -> #7c017d7d7d7d7d7d
dece513 apply #7d00000000000000 -> NaN
dece514 apply #7e7e7e7e7e7e7e7e -> #7e007e7e7e7e7c7e
dece515 apply #7e00000000000000 -> sNaN
dece516 apply #7f7f7f7f7f7f7f7f -> #7e007f7f7f7f7c7f
dece517 apply #7f00000000000000 -> sNaN
dece518 apply #7fffffffffffffff -> sNaN999999999999999
dece519 apply #7fffffffffffffff -> #7e00ff3fcff3fcff
dece520 apply -Infinity -> #f800000000000000
dece521 apply #f878787878787878 -> #f800000000000000
dece522 apply #f800000000000000 -> -Infinity
dece523 apply #f979797979797979 -> #f800000000000000
dece524 apply #f900000000000000 -> -Infinity
dece525 apply #fa7a7a7a7a7a7a7a -> #f800000000000000
dece526 apply #fa00000000000000 -> -Infinity
dece527 apply #fb7b7b7b7b7b7b7b -> #f800000000000000
dece528 apply #fb00000000000000 -> -Infinity
dece529 apply -NaN -> #fc00000000000000
dece530 apply #fc7c7c7c7c7c7c7c -> #fc007c7c7c7c7c7c
dece531 apply #fc00000000000000 -> -NaN
dece532 apply #fd7d7d7d7d7d7d7d -> #fc017d7d7d7d7d7d
dece533 apply #fd00000000000000 -> -NaN
dece534 apply #fe7e7e7e7e7e7e7e -> #fe007e7e7e7e7c7e
dece535 apply #fe00000000000000 -> -sNaN
dece536 apply #ff7f7f7f7f7f7f7f -> #fe007f7f7f7f7c7f
dece537 apply #ff00000000000000 -> -sNaN
dece538 apply #ffffffffffffffff -> -sNaN999999999999999
dece539 apply #ffffffffffffffff -> #fe00ff3fcff3fcff
-- diagnostic NaNs
dece540 apply NaN -> #7c00000000000000
dece541 apply NaN0 -> #7c00000000000000
dece542 apply NaN1 -> #7c00000000000001
dece543 apply NaN12 -> #7c00000000000012
dece544 apply NaN79 -> #7c00000000000079
dece545 apply NaN12345 -> #7c000000000049c5
dece546 apply NaN123456 -> #7c00000000028e56
dece547 apply NaN799799 -> #7c000000000f7fdf
dece548 apply NaN799799799799799 -> #7c03dff7fdff7fdf
dece549 apply NaN999999999999999 -> #7c00ff3fcff3fcff
dece550 apply NaN1234567890123456 -> #7c00000000000000 -- too many digits
-- fold-down full sequence
dece601 apply 1E+384 -> #47fc000000000000 Clamped
dece602 apply #47fc000000000000 -> 1.000000000000000E+384
dece603 apply 1E+383 -> #43fc800000000000 Clamped
dece604 apply #43fc800000000000 -> 1.00000000000000E+383
dece605 apply 1E+382 -> #43fc100000000000 Clamped
dece606 apply #43fc100000000000 -> 1.0000000000000E+382
dece607 apply 1E+381 -> #43fc010000000000 Clamped
dece608 apply #43fc010000000000 -> 1.000000000000E+381
dece609 apply 1E+380 -> #43fc002000000000 Clamped
dece610 apply #43fc002000000000 -> 1.00000000000E+380
dece611 apply 1E+379 -> #43fc000400000000 Clamped
dece612 apply #43fc000400000000 -> 1.0000000000E+379
dece613 apply 1E+378 -> #43fc000040000000 Clamped
dece614 apply #43fc000040000000 -> 1.000000000E+378
dece615 apply 1E+377 -> #43fc000008000000 Clamped
dece616 apply #43fc000008000000 -> 1.00000000E+377
dece617 apply 1E+376 -> #43fc000001000000 Clamped
dece618 apply #43fc000001000000 -> 1.0000000E+376
dece619 apply 1E+375 -> #43fc000000100000 Clamped
dece620 apply #43fc000000100000 -> 1.000000E+375
dece621 apply 1E+374 -> #43fc000000020000 Clamped
dece622 apply #43fc000000020000 -> 1.00000E+374
dece623 apply 1E+373 -> #43fc000000004000 Clamped
dece624 apply #43fc000000004000 -> 1.0000E+373
dece625 apply 1E+372 -> #43fc000000000400 Clamped
dece626 apply #43fc000000000400 -> 1.000E+372
dece627 apply 1E+371 -> #43fc000000000080 Clamped
dece628 apply #43fc000000000080 -> 1.00E+371
dece629 apply 1E+370 -> #43fc000000000010 Clamped
dece630 apply #43fc000000000010 -> 1.0E+370
dece631 apply 1E+369 -> #43fc000000000001
dece632 apply #43fc000000000001 -> 1E+369
dece633 apply 1E+368 -> #43f8000000000001
dece634 apply #43f8000000000001 -> 1E+368
-- same with 9s
dece641 apply 9E+384 -> #77fc000000000000 Clamped
dece642 apply #77fc000000000000 -> 9.000000000000000E+384
dece643 apply 9E+383 -> #43fc8c0000000000 Clamped
dece644 apply #43fc8c0000000000 -> 9.00000000000000E+383
dece645 apply 9E+382 -> #43fc1a0000000000 Clamped
dece646 apply #43fc1a0000000000 -> 9.0000000000000E+382
dece647 apply 9E+381 -> #43fc090000000000 Clamped
dece648 apply #43fc090000000000 -> 9.000000000000E+381
dece649 apply 9E+380 -> #43fc002300000000 Clamped
dece650 apply #43fc002300000000 -> 9.00000000000E+380
dece651 apply 9E+379 -> #43fc000680000000 Clamped
dece652 apply #43fc000680000000 -> 9.0000000000E+379
dece653 apply 9E+378 -> #43fc000240000000 Clamped
dece654 apply #43fc000240000000 -> 9.000000000E+378
dece655 apply 9E+377 -> #43fc000008c00000 Clamped
dece656 apply #43fc000008c00000 -> 9.00000000E+377
dece657 apply 9E+376 -> #43fc000001a00000 Clamped
dece658 apply #43fc000001a00000 -> 9.0000000E+376
dece659 apply 9E+375 -> #43fc000000900000 Clamped
dece660 apply #43fc000000900000 -> 9.000000E+375
dece661 apply 9E+374 -> #43fc000000023000 Clamped
dece662 apply #43fc000000023000 -> 9.00000E+374
dece663 apply 9E+373 -> #43fc000000006800 Clamped
dece664 apply #43fc000000006800 -> 9.0000E+373
dece665 apply 9E+372 -> #43fc000000002400 Clamped
dece666 apply #43fc000000002400 -> 9.000E+372
dece667 apply 9E+371 -> #43fc00000000008c Clamped
dece668 apply #43fc00000000008c -> 9.00E+371
dece669 apply 9E+370 -> #43fc00000000001a Clamped
dece670 apply #43fc00000000001a -> 9.0E+370
dece671 apply 9E+369 -> #43fc000000000009
dece672 apply #43fc000000000009 -> 9E+369
dece673 apply 9E+368 -> #43f8000000000009
dece674 apply #43f8000000000009 -> 9E+368
-- Selected DPD codes
dece700 apply #2238000000000000 -> 0
dece701 apply #2238000000000009 -> 9
dece702 apply #2238000000000010 -> 10
dece703 apply #2238000000000019 -> 19
dece704 apply #2238000000000020 -> 20
dece705 apply #2238000000000029 -> 29
dece706 apply #2238000000000030 -> 30
dece707 apply #2238000000000039 -> 39
dece708 apply #2238000000000040 -> 40
dece709 apply #2238000000000049 -> 49
dece710 apply #2238000000000050 -> 50
dece711 apply #2238000000000059 -> 59
dece712 apply #2238000000000060 -> 60
dece713 apply #2238000000000069 -> 69
dece714 apply #2238000000000070 -> 70
dece715 apply #2238000000000071 -> 71
dece716 apply #2238000000000072 -> 72
dece717 apply #2238000000000073 -> 73
dece718 apply #2238000000000074 -> 74
dece719 apply #2238000000000075 -> 75
dece720 apply #2238000000000076 -> 76
dece721 apply #2238000000000077 -> 77
dece722 apply #2238000000000078 -> 78
dece723 apply #2238000000000079 -> 79
dece730 apply #223800000000029e -> 994
dece731 apply #223800000000029f -> 995
dece732 apply #22380000000002a0 -> 520
dece733 apply #22380000000002a1 -> 521
-- DPD: one of each of the huffman groups
dece740 apply #22380000000003f7 -> 777
dece741 apply #22380000000003f8 -> 778
dece742 apply #22380000000003eb -> 787
dece743 apply #223800000000037d -> 877
dece744 apply #223800000000039f -> 997
dece745 apply #22380000000003bf -> 979
dece746 apply #22380000000003df -> 799
dece747 apply #223800000000006e -> 888
-- DPD all-highs cases (includes the 24 redundant codes)
dece750 apply #223800000000006e -> 888
dece751 apply #223800000000016e -> 888
dece752 apply #223800000000026e -> 888
dece753 apply #223800000000036e -> 888
dece754 apply #223800000000006f -> 889
dece755 apply #223800000000016f -> 889
dece756 apply #223800000000026f -> 889
dece757 apply #223800000000036f -> 889
dece760 apply #223800000000007e -> 898
dece761 apply #223800000000017e -> 898
dece762 apply #223800000000027e -> 898
dece763 apply #223800000000037e -> 898
dece764 apply #223800000000007f -> 899
dece765 apply #223800000000017f -> 899
dece766 apply #223800000000027f -> 899
dece767 apply #223800000000037f -> 899
dece770 apply #22380000000000ee -> 988
dece771 apply #22380000000001ee -> 988
dece772 apply #22380000000002ee -> 988
dece773 apply #22380000000003ee -> 988
dece774 apply #22380000000000ef -> 989
dece775 apply #22380000000001ef -> 989
dece776 apply #22380000000002ef -> 989
dece777 apply #22380000000003ef -> 989
dece780 apply #22380000000000fe -> 998
dece781 apply #22380000000001fe -> 998
dece782 apply #22380000000002fe -> 998
dece783 apply #22380000000003fe -> 998
dece784 apply #22380000000000ff -> 999
dece785 apply #22380000000001ff -> 999
dece786 apply #22380000000002ff -> 999
dece787 apply #22380000000003ff -> 999