1------------------------------------------------------------------------ 2-- invert.decTest -- digitwise logical INVERT -- 3-- Copyright (c) IBM Corporation, 1981, 2008. All rights reserved. -- 4------------------------------------------------------------------------ 5-- Please see the document "General Decimal Arithmetic Testcases" -- 6-- at http://www2.hursley.ibm.com/decimal for the description of -- 7-- these testcases. -- 8-- -- 9-- These testcases are experimental ('beta' versions), and they -- 10-- may contain errors. They are offered on an as-is basis. In -- 11-- particular, achieving the same results as the tests here is not -- 12-- a guarantee that an implementation complies with any Standard -- 13-- or specification. The tests are not exhaustive. -- 14-- -- 15-- Please send comments, suggestions, and corrections to the author: -- 16-- Mike Cowlishaw, IBM Fellow -- 17-- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- 18-- mfc@uk.ibm.com -- 19------------------------------------------------------------------------ 20version: 2.59 21 22extended: 1 23precision: 9 24rounding: half_up 25maxExponent: 999 26minExponent: -999 27 28-- Sanity check (truth table), and examples from decArith 29invx001 invert 0 -> 111111111 30invx002 invert 1 -> 111111110 31invx003 invert 10 -> 111111101 32invx004 invert 111111111 -> 0 33invx005 invert 000000000 -> 111111111 34invx006 invert 101010101 -> '10101010' 35-- and at msd and msd-1 36invx007 invert 000000000 -> 111111111 37invx009 invert 100000000 -> 11111111 38invx011 invert 000000000 -> 111111111 39invx013 invert 010000000 -> 101111111 40 41-- Various lengths 42-- 123456789 123456789 43invx021 invert 111111111 -> 0 44invx022 invert 111111111111 -> 0 45invx023 invert 11111111 -> 100000000 46invx025 invert 1111111 -> 110000000 47invx026 invert 111111 -> 111000000 48invx027 invert 11111 -> 111100000 49invx028 invert 1111 -> 111110000 50invx029 invert 111 -> 111111000 51invx031 invert 11 -> 111111100 52invx032 invert 1 -> 111111110 53invx033 invert 111111111111 -> 0 54invx034 invert 11111111111 -> 0 55invx035 invert 1111111111 -> 0 56invx036 invert 111111111 -> 0 57 58invx080 invert 011111111 -> 100000000 59invx081 invert 101111111 -> 10000000 60invx082 invert 110111111 -> 1000000 61invx083 invert 111011111 -> 100000 62invx084 invert 111101111 -> 10000 63invx085 invert 111110111 -> 1000 64invx086 invert 111111011 -> 100 65invx087 invert 111111101 -> 10 66invx088 invert 111111110 -> 1 67invx089 invert 011111011 -> 100000100 68invx090 invert 101111101 -> 10000010 69invx091 invert 110111110 -> 1000001 70invx092 invert 111011101 -> 100010 71invx093 invert 111101011 -> 10100 72invx094 invert 111110111 -> 1000 73invx095 invert 111101011 -> 10100 74invx096 invert 111011101 -> 100010 75invx097 invert 110111110 -> 1000001 76invx098 invert 101111101 -> 10000010 77invx099 invert 011111011 -> 100000100 78 79-- non-0/1 should not be accepted, nor should signs 80invx220 invert 111111112 -> NaN Invalid_operation 81invx221 invert 333333333 -> NaN Invalid_operation 82invx222 invert 555555555 -> NaN Invalid_operation 83invx223 invert 777777777 -> NaN Invalid_operation 84invx224 invert 999999999 -> NaN Invalid_operation 85invx225 invert 222222222 -> NaN Invalid_operation 86invx226 invert 444444444 -> NaN Invalid_operation 87invx227 invert 666666666 -> NaN Invalid_operation 88invx228 invert 888888888 -> NaN Invalid_operation 89invx229 invert 999999999 -> NaN Invalid_operation 90invx230 invert 999999999 -> NaN Invalid_operation 91invx231 invert 999999999 -> NaN Invalid_operation 92invx232 invert 999999999 -> NaN Invalid_operation 93-- a few randoms 94invx240 invert 567468689 -> NaN Invalid_operation 95invx241 invert 567367689 -> NaN Invalid_operation 96invx242 invert -631917772 -> NaN Invalid_operation 97invx243 invert -756253257 -> NaN Invalid_operation 98invx244 invert 835590149 -> NaN Invalid_operation 99-- test MSD 100invx250 invert 200000000 -> NaN Invalid_operation 101invx251 invert 300000000 -> NaN Invalid_operation 102invx252 invert 400000000 -> NaN Invalid_operation 103invx253 invert 500000000 -> NaN Invalid_operation 104invx254 invert 600000000 -> NaN Invalid_operation 105invx255 invert 700000000 -> NaN Invalid_operation 106invx256 invert 800000000 -> NaN Invalid_operation 107invx257 invert 900000000 -> NaN Invalid_operation 108-- test MSD-1 109invx270 invert 021000000 -> NaN Invalid_operation 110invx271 invert 030100000 -> NaN Invalid_operation 111invx272 invert 040010000 -> NaN Invalid_operation 112invx273 invert 050001000 -> NaN Invalid_operation 113invx274 invert 160000100 -> NaN Invalid_operation 114invx275 invert 170000010 -> NaN Invalid_operation 115invx276 invert 180000000 -> NaN Invalid_operation 116invx277 invert 190000000 -> NaN Invalid_operation 117-- test LSD 118invx280 invert 000000002 -> NaN Invalid_operation 119invx281 invert 000000003 -> NaN Invalid_operation 120invx282 invert 000000004 -> NaN Invalid_operation 121invx283 invert 000000005 -> NaN Invalid_operation 122invx284 invert 101000006 -> NaN Invalid_operation 123invx285 invert 100100007 -> NaN Invalid_operation 124invx286 invert 100010008 -> NaN Invalid_operation 125invx287 invert 100001009 -> NaN Invalid_operation 126-- test Middie 127invx288 invert 000020000 -> NaN Invalid_operation 128invx289 invert 000030001 -> NaN Invalid_operation 129invx290 invert 000040000 -> NaN Invalid_operation 130invx291 invert 000050000 -> NaN Invalid_operation 131invx292 invert 101060000 -> NaN Invalid_operation 132invx293 invert 100170010 -> NaN Invalid_operation 133invx294 invert 100080100 -> NaN Invalid_operation 134invx295 invert 100091000 -> NaN Invalid_operation 135-- signs 136invx296 invert -100001000 -> NaN Invalid_operation 137invx299 invert 100001000 -> 11110111 138 139-- Nmax, Nmin, Ntiny 140invx341 invert 9.99999999E+999 -> NaN Invalid_operation 141invx342 invert 1E-999 -> NaN Invalid_operation 142invx343 invert 1.00000000E-999 -> NaN Invalid_operation 143invx344 invert 1E-1007 -> NaN Invalid_operation 144invx345 invert -1E-1007 -> NaN Invalid_operation 145invx346 invert -1.00000000E-999 -> NaN Invalid_operation 146invx347 invert -1E-999 -> NaN Invalid_operation 147invx348 invert -9.99999999E+999 -> NaN Invalid_operation 148 149-- A few other non-integers 150invx361 invert 1.0 -> NaN Invalid_operation 151invx362 invert 1E+1 -> NaN Invalid_operation 152invx363 invert 0.0 -> NaN Invalid_operation 153invx364 invert 0E+1 -> NaN Invalid_operation 154invx365 invert 9.9 -> NaN Invalid_operation 155invx366 invert 9E+1 -> NaN Invalid_operation 156 157-- All Specials are in error 158invx788 invert -Inf -> NaN Invalid_operation 159invx794 invert Inf -> NaN Invalid_operation 160invx821 invert NaN -> NaN Invalid_operation 161invx841 invert sNaN -> NaN Invalid_operation 162-- propagating NaNs 163invx861 invert NaN1 -> NaN Invalid_operation 164invx862 invert +NaN2 -> NaN Invalid_operation 165invx863 invert NaN3 -> NaN Invalid_operation 166invx864 invert NaN4 -> NaN Invalid_operation 167invx865 invert NaN5 -> NaN Invalid_operation 168invx871 invert sNaN11 -> NaN Invalid_operation 169invx872 invert sNaN12 -> NaN Invalid_operation 170invx873 invert sNaN13 -> NaN Invalid_operation 171invx874 invert sNaN14 -> NaN Invalid_operation 172invx875 invert sNaN15 -> NaN Invalid_operation 173invx876 invert NaN16 -> NaN Invalid_operation 174invx881 invert +NaN25 -> NaN Invalid_operation 175invx882 invert -NaN26 -> NaN Invalid_operation 176invx883 invert -sNaN27 -> NaN Invalid_operation 177