You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
259 lines
12 KiB
Plaintext
259 lines
12 KiB
Plaintext
------------------------------------------------------------------------
|
|
-- divide0.decTest -- decimal division (simplified) --
|
|
-- Copyright (c) IBM Corporation, 1981, 2008. 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.58
|
|
|
|
extended: 0
|
|
precision: 9
|
|
rounding: half_up
|
|
maxExponent: 999
|
|
minexponent: -999
|
|
|
|
div001 divide 1 1 -> 1
|
|
div002 divide 2 1 -> 2
|
|
div003 divide 1 2 -> 0.5
|
|
div004 divide 2 2 -> 1
|
|
div005 divide 0 1 -> 0
|
|
div006 divide 0 2 -> 0
|
|
div007 divide 1 3 -> 0.333333333 Inexact Rounded
|
|
div008 divide 2 3 -> 0.666666667 Inexact Rounded
|
|
div009 divide 3 3 -> 1
|
|
|
|
div010 divide 2.4 1 -> 2.4
|
|
div011 divide 2.4 -1 -> -2.4
|
|
div012 divide -2.4 1 -> -2.4
|
|
div013 divide -2.4 -1 -> 2.4
|
|
div014 divide 2.40 1 -> 2.4
|
|
div015 divide 2.400 1 -> 2.4
|
|
div016 divide 2.4 2 -> 1.2
|
|
div017 divide 2.400 2 -> 1.2
|
|
div018 divide 2. 2 -> 1
|
|
div019 divide 20 20 -> 1
|
|
|
|
div020 divide 187 187 -> 1
|
|
div021 divide 5 2 -> 2.5
|
|
div022 divide 5 2.0 -> 2.5
|
|
div023 divide 5 2.000 -> 2.5
|
|
div024 divide 5 0.200 -> 25
|
|
div025 divide 5 0.200 -> 25
|
|
div026 divide 10 1 -> 10
|
|
div027 divide 100 1 -> 100
|
|
div028 divide 1000 1 -> 1000
|
|
div029 divide 1000 100 -> 10
|
|
|
|
div030 divide 1 2 -> 0.5
|
|
div031 divide 1 4 -> 0.25
|
|
div032 divide 1 8 -> 0.125
|
|
div033 divide 1 16 -> 0.0625
|
|
div034 divide 1 32 -> 0.03125
|
|
div035 divide 1 64 -> 0.015625
|
|
div040 divide 1 -2 -> -0.5
|
|
div041 divide 1 -4 -> -0.25
|
|
div042 divide 1 -8 -> -0.125
|
|
div043 divide 1 -16 -> -0.0625
|
|
div044 divide 1 -32 -> -0.03125
|
|
div045 divide 1 -64 -> -0.015625
|
|
div050 divide -1 2 -> -0.5
|
|
div051 divide -1 4 -> -0.25
|
|
div052 divide -1 8 -> -0.125
|
|
div053 divide -1 16 -> -0.0625
|
|
div054 divide -1 32 -> -0.03125
|
|
div055 divide -1 64 -> -0.015625
|
|
div060 divide -1 -2 -> 0.5
|
|
div061 divide -1 -4 -> 0.25
|
|
div062 divide -1 -8 -> 0.125
|
|
div063 divide -1 -16 -> 0.0625
|
|
div064 divide -1 -32 -> 0.03125
|
|
div065 divide -1 -64 -> 0.015625
|
|
|
|
div070 divide 999999999 1 -> 999999999
|
|
div071 divide 999999999.4 1 -> 999999999 Inexact Lost_digits Rounded
|
|
div072 divide 999999999.5 1 -> 1E+9 Inexact Lost_digits Rounded
|
|
div073 divide 999999999.9 1 -> 1E+9 Inexact Lost_digits Rounded
|
|
div074 divide 999999999.999 1 -> 1E+9 Inexact Lost_digits Rounded
|
|
precision: 6
|
|
div080 divide 999999999 1 -> 1E+9 Inexact Lost_digits Rounded
|
|
div081 divide 99999999 1 -> 1E+8 Inexact Lost_digits Rounded
|
|
div082 divide 9999999 1 -> 1E+7 Inexact Lost_digits Rounded
|
|
div083 divide 999999 1 -> 999999
|
|
div084 divide 99999 1 -> 99999
|
|
div085 divide 9999 1 -> 9999
|
|
div086 divide 999 1 -> 999
|
|
div087 divide 99 1 -> 99
|
|
div088 divide 9 1 -> 9
|
|
|
|
precision: 9
|
|
div090 divide 0. 1 -> 0
|
|
div091 divide .0 1 -> 0
|
|
div092 divide 0.00 1 -> 0
|
|
div093 divide 0.00E+9 1 -> 0
|
|
div094 divide 0.0000E-50 1 -> 0
|
|
|
|
div095 divide 1 1E-8 -> 100000000
|
|
div096 divide 1 1E-9 -> 1E+9
|
|
div097 divide 1 1E-10 -> 1E+10
|
|
div098 divide 1 1E-11 -> 1E+11
|
|
div099 divide 1 1E-12 -> 1E+12
|
|
|
|
div100 divide 1 1 -> 1
|
|
div101 divide 1 2 -> 0.5
|
|
div102 divide 1 3 -> 0.333333333 Inexact Rounded
|
|
div103 divide 1 4 -> 0.25
|
|
div104 divide 1 5 -> 0.2
|
|
div105 divide 1 6 -> 0.166666667 Inexact Rounded
|
|
div106 divide 1 7 -> 0.142857143 Inexact Rounded
|
|
div107 divide 1 8 -> 0.125
|
|
div108 divide 1 9 -> 0.111111111 Inexact Rounded
|
|
div109 divide 1 10 -> 0.1
|
|
div110 divide 1 1 -> 1
|
|
div111 divide 2 1 -> 2
|
|
div112 divide 3 1 -> 3
|
|
div113 divide 4 1 -> 4
|
|
div114 divide 5 1 -> 5
|
|
div115 divide 6 1 -> 6
|
|
div116 divide 7 1 -> 7
|
|
div117 divide 8 1 -> 8
|
|
div118 divide 9 1 -> 9
|
|
div119 divide 10 1 -> 10
|
|
|
|
div130 divide 12345 4.999 -> 2469.4939 Inexact Rounded
|
|
div131 divide 12345 4.99 -> 2473.9479 Inexact Rounded
|
|
div132 divide 12345 4.9 -> 2519.38776 Inexact Rounded
|
|
div133 divide 12345 5 -> 2469
|
|
div134 divide 12345 5.1 -> 2420.58824 Inexact Rounded
|
|
div135 divide 12345 5.01 -> 2464.07186 Inexact Rounded
|
|
div136 divide 12345 5.001 -> 2468.5063 Inexact Rounded
|
|
|
|
-- Various flavours of divide by 0
|
|
maxexponent: 999999999
|
|
minexponent: -999999999
|
|
div201 divide 0 0 -> ? Division_undefined
|
|
div202 divide 0.0E5 0 -> ? Division_undefined
|
|
div203 divide 0.000 0 -> ? Division_undefined
|
|
div204 divide 0.0001 0 -> ? Division_by_zero
|
|
div205 divide 0.01 0 -> ? Division_by_zero
|
|
div206 divide 0.1 0 -> ? Division_by_zero
|
|
div207 divide 1 0 -> ? Division_by_zero
|
|
div208 divide 1 0.0 -> ? Division_by_zero
|
|
div209 divide 10 0.0 -> ? Division_by_zero
|
|
div210 divide 1E+100 0.0 -> ? Division_by_zero
|
|
div211 divide 1E+1000 0 -> ? Division_by_zero
|
|
|
|
-- test possibly imprecise results
|
|
div220 divide 391 597 -> 0.654941374 Inexact Rounded
|
|
div221 divide 391 -597 -> -0.654941374 Inexact Rounded
|
|
div222 divide -391 597 -> -0.654941374 Inexact Rounded
|
|
div223 divide -391 -597 -> 0.654941374 Inexact Rounded
|
|
|
|
-- test some cases that are close to exponent overflow
|
|
maxexponent: 999999999
|
|
minexponent: -999999999
|
|
div270 divide 1 1e999999999 -> 1E-999999999
|
|
div271 divide 1 0.9e999999999 -> 1.11111111E-999999999 Inexact Rounded
|
|
div272 divide 1 0.99e999999999 -> 1.01010101E-999999999 Inexact Rounded
|
|
div273 divide 1 0.999999999e999999999 -> 1E-999999999 Inexact Rounded
|
|
div274 divide 9e999999999 1 -> 9E+999999999
|
|
div275 divide 9.9e999999999 1 -> 9.9E+999999999
|
|
div276 divide 9.99e999999999 1 -> 9.99E+999999999
|
|
div277 divide 9.99999999e999999999 1 -> 9.99999999E+999999999
|
|
|
|
div280 divide 0.1 9e-999999999 -> 1.11111111E+999999997 Inexact Rounded
|
|
div281 divide 0.1 99e-999999999 -> 1.01010101E+999999996 Inexact Rounded
|
|
div282 divide 0.1 999e-999999999 -> 1.001001E+999999995 Inexact Rounded
|
|
|
|
div283 divide 0.1 9e-999999998 -> 1.11111111E+999999996 Inexact Rounded
|
|
div284 divide 0.1 99e-999999998 -> 1.01010101E+999999995 Inexact Rounded
|
|
div285 divide 0.1 999e-999999998 -> 1.001001E+999999994 Inexact Rounded
|
|
div286 divide 0.1 999e-999999997 -> 1.001001E+999999993 Inexact Rounded
|
|
div287 divide 0.1 9999e-999999997 -> 1.00010001E+999999992 Inexact Rounded
|
|
div288 divide 0.1 99999e-999999997 -> 1.00001E+999999991 Inexact Rounded
|
|
|
|
-- overflow and underflow tests
|
|
maxexponent: 999999999
|
|
minexponent: -999999999
|
|
div330 divide +1.23456789012345E-0 9E+999999999 -> ? Inexact Lost_digits Rounded Underflow Subnormal
|
|
div331 divide 9E+999999999 +0.23456789012345E-0 -> ? Inexact Lost_digits Overflow Rounded
|
|
div332 divide +0.100 9E+999999999 -> ? Inexact Rounded Underflow Subnormal
|
|
div333 divide 9E-999999999 +9.100 -> ? Inexact Rounded Underflow Subnormal
|
|
div335 divide -1.23456789012345E-0 9E+999999999 -> ? Inexact Lost_digits Rounded Underflow Subnormal
|
|
div336 divide 9E+999999999 -0.83456789012345E-0 -> ? Inexact Lost_digits Overflow Rounded
|
|
div337 divide -0.100 9E+999999999 -> ? Inexact Rounded Underflow Subnormal
|
|
div338 divide 9E-999999999 -9.100 -> ? Inexact Rounded Underflow Subnormal
|
|
|
|
-- 'subnormal' results (all underflow or overflow in base arithemtic)
|
|
div360 divide 1e-600000000 1e+400000001 -> ? Underflow Subnormal Inexact Rounded
|
|
div361 divide 1e-600000000 1e+400000002 -> ? Underflow Subnormal Inexact Rounded
|
|
div362 divide 1e-600000000 1e+400000003 -> ? Underflow Subnormal Inexact Rounded
|
|
div363 divide 1e-600000000 1e+400000004 -> ? Underflow Subnormal Inexact Rounded
|
|
div364 divide 1e-600000000 1e+400000005 -> ? Underflow Subnormal Inexact Rounded
|
|
div365 divide 1e-600000000 1e+400000006 -> ? Underflow Subnormal Inexact Rounded
|
|
div366 divide 1e-600000000 1e+400000007 -> ? Underflow Subnormal Inexact Rounded
|
|
div367 divide 1e-600000000 1e+400000008 -> ? Underflow Subnormal Inexact Rounded
|
|
div368 divide 1e-600000000 1e+400000009 -> ? Underflow Subnormal Inexact Rounded
|
|
div369 divide 1e-600000000 1e+400000010 -> ? Underflow Subnormal Inexact Rounded
|
|
-- [no equivalent of 'subnormal' for overflow]
|
|
div370 divide 1e+600000000 1e-400000001 -> ? Overflow Inexact Rounded
|
|
div371 divide 1e+600000000 1e-400000002 -> ? Overflow Inexact Rounded
|
|
div372 divide 1e+600000000 1e-400000003 -> ? Overflow Inexact Rounded
|
|
div373 divide 1e+600000000 1e-400000004 -> ? Overflow Inexact Rounded
|
|
div374 divide 1e+600000000 1e-400000005 -> ? Overflow Inexact Rounded
|
|
div375 divide 1e+600000000 1e-400000006 -> ? Overflow Inexact Rounded
|
|
div376 divide 1e+600000000 1e-400000007 -> ? Overflow Inexact Rounded
|
|
div377 divide 1e+600000000 1e-400000008 -> ? Overflow Inexact Rounded
|
|
div378 divide 1e+600000000 1e-400000009 -> ? Overflow Inexact Rounded
|
|
div379 divide 1e+600000000 1e-400000010 -> ? Overflow Inexact Rounded
|
|
|
|
-- lostDigits checks
|
|
maxexponent: 999
|
|
minexponent: -999
|
|
precision: 9
|
|
div401 divide 12345678000 1 -> 1.2345678E+10 Rounded
|
|
div402 divide 1 12345678000 -> 8.10000066E-11 Inexact Rounded
|
|
div403 divide 1234567800 1 -> 1.2345678E+9 Rounded
|
|
div404 divide 1 1234567800 -> 8.10000066E-10 Inexact Rounded
|
|
div405 divide 1234567890 1 -> 1.23456789E+9 Rounded
|
|
div406 divide 1 1234567890 -> 8.10000007E-10 Inexact Rounded
|
|
div407 divide 1234567891 1 -> 1.23456789E+9 Inexact Lost_digits Rounded
|
|
div408 divide 1 1234567891 -> 8.10000007E-10 Inexact Lost_digits Rounded
|
|
div409 divide 12345678901 1 -> 1.23456789E+10 Inexact Lost_digits Rounded
|
|
div410 divide 1 12345678901 -> 8.10000007E-11 Inexact Lost_digits Rounded
|
|
div411 divide 1234567896 1 -> 1.2345679E+9 Inexact Lost_digits Rounded
|
|
div412 divide 1 1234567896 -> 8.10000001E-10 Inexact Lost_digits Rounded
|
|
-- previous case different (8.10000003E-10) if no input rounding
|
|
|
|
precision: 15
|
|
-- still checking for [no] lostDigits
|
|
div441 divide 12345678000 1 -> 12345678000
|
|
div442 divide 1 12345678000 -> 8.10000066420005E-11 Inexact Rounded
|
|
div443 divide 1234567800 1 -> 1234567800
|
|
div444 divide 1 1234567800 -> 8.10000066420005E-10 Inexact Rounded
|
|
div445 divide 1234567890 1 -> 1234567890
|
|
div446 divide 1 1234567890 -> 8.10000007371E-10 Inexact Rounded
|
|
div447 divide 1234567891 1 -> 1234567891
|
|
div448 divide 1 1234567891 -> 8.100000067149E-10 Inexact Rounded
|
|
div449 divide 12345678901 1 -> 12345678901
|
|
div450 divide 1 12345678901 -> 8.1000000730539E-11 Inexact Rounded
|
|
div451 divide 1234567896 1 -> 1234567896
|
|
div452 divide 1 1234567896 -> 8.100000034344E-10 Inexact Rounded
|
|
|
|
-- Null tests
|
|
div900 divide 10 # -> ? Invalid_operation
|
|
div901 divide # 10 -> ? Invalid_operation
|
|
|