github.com/cockroachdb/apd/v3@v3.2.0/testdata/subtract.decTest (about)

     1  ------------------------------------------------------------------------
     2  -- subtract.decTest -- decimal subtraction                            --
     3  -- Copyright (c) Mike Cowlishaw,  1981, 2010.  All rights reserved.   --
     4  -- Parts copyright (c) IBM Corporation, 1981, 2008.                   --
     5  ------------------------------------------------------------------------
     6  -- Please see the document "General Decimal Arithmetic Testcases"     --
     7  -- at http://speleotrove.com/decimal for the description of           --
     8  -- these testcases.                                                   --
     9  --                                                                    --
    10  -- These testcases are experimental ('beta' versions), and they       --
    11  -- may contain errors.  They are offered on an as-is basis.  In       --
    12  -- particular, achieving the same results as the tests here is not    --
    13  -- a guarantee that an implementation complies with any Standard      --
    14  -- or specification.  The tests are not exhaustive.                   --
    15  --                                                                    --
    16  -- Please send comments, suggestions, and corrections to the author:  --
    17  --   Mike Cowlishaw, mfc@speleotrove.com                              --
    18  ------------------------------------------------------------------------
    19  version: 2.62
    20  
    21  extended:    1
    22  precision:   9
    23  rounding:    half_up
    24  maxExponent: 384
    25  minexponent: -383
    26  
    27  -- [first group are 'quick confidence check']
    28  subx001 subtract  0   0  -> '0'
    29  subx002 subtract  1   1  -> '0'
    30  subx003 subtract  1   2  -> '-1'
    31  subx004 subtract  2   1  -> '1'
    32  subx005 subtract  2   2  -> '0'
    33  subx006 subtract  3   2  -> '1'
    34  subx007 subtract  2   3  -> '-1'
    35  
    36  subx011 subtract -0   0  -> '-0'
    37  subx012 subtract -1   1  -> '-2'
    38  subx013 subtract -1   2  -> '-3'
    39  subx014 subtract -2   1  -> '-3'
    40  subx015 subtract -2   2  -> '-4'
    41  subx016 subtract -3   2  -> '-5'
    42  subx017 subtract -2   3  -> '-5'
    43  
    44  subx021 subtract  0  -0  -> '0'
    45  subx022 subtract  1  -1  -> '2'
    46  subx023 subtract  1  -2  -> '3'
    47  subx024 subtract  2  -1  -> '3'
    48  subx025 subtract  2  -2  -> '4'
    49  subx026 subtract  3  -2  -> '5'
    50  subx027 subtract  2  -3  -> '5'
    51  
    52  subx030 subtract  11  1  -> 10
    53  subx031 subtract  10  1  ->  9
    54  subx032 subtract  9   1  ->  8
    55  subx033 subtract  1   1  ->  0
    56  subx034 subtract  0   1  -> -1
    57  subx035 subtract -1   1  -> -2
    58  subx036 subtract -9   1  -> -10
    59  subx037 subtract -10  1  -> -11
    60  subx038 subtract -11  1  -> -12
    61  
    62  subx040 subtract '5.75' '3.3'  -> '2.45'
    63  subx041 subtract '5'    '-3'   -> '8'
    64  subx042 subtract '-5'   '-3'   -> '-2'
    65  subx043 subtract '-7'   '2.5'  -> '-9.5'
    66  subx044 subtract '0.7'  '0.3'  -> '0.4'
    67  subx045 subtract '1.3'  '0.3'  -> '1.0'
    68  subx046 subtract '1.25' '1.25' -> '0.00'
    69  
    70  subx050 subtract '1.23456789'    '1.00000000' -> '0.23456789'
    71  subx051 subtract '1.23456789'    '1.00000089' -> '0.23456700'
    72  subx052 subtract '0.5555555559'    '0.0000000001' -> '0.555555556' Inexact Rounded
    73  subx053 subtract '0.5555555559'    '0.0000000005' -> '0.555555555' Inexact Rounded
    74  subx054 subtract '0.4444444444'    '0.1111111111' -> '0.333333333' Inexact Rounded
    75  subx055 subtract '1.0000000000'    '0.00000001' -> '0.999999990' Rounded
    76  subx056 subtract '0.4444444444999'    '0' -> '0.444444444' Inexact Rounded
    77  subx057 subtract '0.4444444445000'    '0' -> '0.444444445' Inexact Rounded
    78  
    79  subx060 subtract '70'    '10000e+9' -> '-1.00000000E+13' Inexact Rounded
    80  subx061 subtract '700'    '10000e+9' -> '-1.00000000E+13' Inexact Rounded
    81  subx062 subtract '7000'    '10000e+9' -> '-9.99999999E+12' Inexact Rounded
    82  subx063 subtract '70000'    '10000e+9' -> '-9.99999993E+12' Rounded
    83  subx064 subtract '700000'    '10000e+9' -> '-9.99999930E+12' Rounded
    84    -- symmetry:
    85  subx065 subtract '10000e+9'    '70' -> '1.00000000E+13' Inexact Rounded
    86  subx066 subtract '10000e+9'    '700' -> '1.00000000E+13' Inexact Rounded
    87  subx067 subtract '10000e+9'    '7000' -> '9.99999999E+12' Inexact Rounded
    88  subx068 subtract '10000e+9'    '70000' -> '9.99999993E+12' Rounded
    89  subx069 subtract '10000e+9'    '700000' -> '9.99999930E+12' Rounded
    90  
    91    -- change precision
    92  subx080 subtract '10000e+9'    '70000' -> '9.99999993E+12' Rounded
    93  precision: 6
    94  subx081 subtract '10000e+9'    '70000' -> '1.00000E+13' Inexact Rounded
    95  precision: 9
    96  
    97    -- some of the next group are really constructor tests
    98  subx090 subtract '00.0'    '0.0'  -> '0.0'
    99  subx091 subtract '00.0'    '0.00' -> '0.00'
   100  subx092 subtract '0.00'    '00.0' -> '0.00'
   101  subx093 subtract '00.0'    '0.00' -> '0.00'
   102  subx094 subtract '0.00'    '00.0' -> '0.00'
   103  subx095 subtract '3'    '.3'   -> '2.7'
   104  subx096 subtract '3.'   '.3'   -> '2.7'
   105  subx097 subtract '3.0'  '.3'   -> '2.7'
   106  subx098 subtract '3.00' '.3'   -> '2.70'
   107  subx099 subtract '3'    '3'    -> '0'
   108  subx100 subtract '3'    '+3'   -> '0'
   109  subx101 subtract '3'    '-3'   -> '6'
   110  subx102 subtract '3'    '0.3'  -> '2.7'
   111  subx103 subtract '3.'   '0.3'  -> '2.7'
   112  subx104 subtract '3.0'  '0.3'  -> '2.7'
   113  subx105 subtract '3.00' '0.3'  -> '2.70'
   114  subx106 subtract '3'    '3.0'  -> '0.0'
   115  subx107 subtract '3'    '+3.0' -> '0.0'
   116  subx108 subtract '3'    '-3.0' -> '6.0'
   117  
   118  -- the above all from add; massaged and extended.  Now some new ones...
   119  -- [particularly important for comparisons]
   120  -- NB: -xE-8 below were non-exponents pre-ANSI X3-274, and -1E-7 or 0E-7
   121  -- with input rounding.
   122  subx120 subtract  '10.23456784'    '10.23456789'  -> '-5E-8'
   123  subx121 subtract  '10.23456785'    '10.23456789'  -> '-4E-8'
   124  subx122 subtract  '10.23456786'    '10.23456789'  -> '-3E-8'
   125  subx123 subtract  '10.23456787'    '10.23456789'  -> '-2E-8'
   126  subx124 subtract  '10.23456788'    '10.23456789'  -> '-1E-8'
   127  subx125 subtract  '10.23456789'    '10.23456789'  -> '0E-8'
   128  subx126 subtract  '10.23456790'    '10.23456789'  -> '1E-8'
   129  subx127 subtract  '10.23456791'    '10.23456789'  -> '2E-8'
   130  subx128 subtract  '10.23456792'    '10.23456789'  -> '3E-8'
   131  subx129 subtract  '10.23456793'    '10.23456789'  -> '4E-8'
   132  subx130 subtract  '10.23456794'    '10.23456789'  -> '5E-8'
   133  subx131 subtract  '10.23456781'    '10.23456786'  -> '-5E-8'
   134  subx132 subtract  '10.23456782'    '10.23456786'  -> '-4E-8'
   135  subx133 subtract  '10.23456783'    '10.23456786'  -> '-3E-8'
   136  subx134 subtract  '10.23456784'    '10.23456786'  -> '-2E-8'
   137  subx135 subtract  '10.23456785'    '10.23456786'  -> '-1E-8'
   138  subx136 subtract  '10.23456786'    '10.23456786'  -> '0E-8'
   139  subx137 subtract  '10.23456787'    '10.23456786'  -> '1E-8'
   140  subx138 subtract  '10.23456788'    '10.23456786'  -> '2E-8'
   141  subx139 subtract  '10.23456789'    '10.23456786'  -> '3E-8'
   142  subx140 subtract  '10.23456790'    '10.23456786'  -> '4E-8'
   143  subx141 subtract  '10.23456791'    '10.23456786'  -> '5E-8'
   144  subx142 subtract  '1'              '0.999999999'  -> '1E-9'
   145  subx143 subtract  '0.999999999'    '1'            -> '-1E-9'
   146  subx144 subtract  '-10.23456780'   '-10.23456786' -> '6E-8'
   147  subx145 subtract  '-10.23456790'   '-10.23456786' -> '-4E-8'
   148  subx146 subtract  '-10.23456791'   '-10.23456786' -> '-5E-8'
   149  
   150  precision: 3
   151  subx150 subtract '12345678900000' '9999999999999'  -> 2.35E+12 Inexact Rounded
   152  subx151 subtract '9999999999999'  '12345678900000' -> -2.35E+12 Inexact Rounded
   153  precision: 6
   154  subx152 subtract '12345678900000' '9999999999999'  -> 2.34568E+12 Inexact Rounded
   155  subx153 subtract '9999999999999'  '12345678900000' -> -2.34568E+12 Inexact Rounded
   156  precision: 9
   157  subx154 subtract '12345678900000' '9999999999999'  -> 2.34567890E+12 Inexact Rounded
   158  subx155 subtract '9999999999999'  '12345678900000' -> -2.34567890E+12 Inexact Rounded
   159  precision: 12
   160  subx156 subtract '12345678900000' '9999999999999'  -> 2.34567890000E+12 Inexact Rounded
   161  subx157 subtract '9999999999999'  '12345678900000' -> -2.34567890000E+12 Inexact Rounded
   162  precision: 15
   163  subx158 subtract '12345678900000' '9999999999999'  -> 2345678900001
   164  subx159 subtract '9999999999999'  '12345678900000' -> -2345678900001
   165  precision: 9
   166  
   167  -- additional scaled arithmetic tests [0.97 problem]
   168  subx160 subtract '0'     '.1'      -> '-0.1'
   169  subx161 subtract '00'    '.97983'  -> '-0.97983'
   170  subx162 subtract '0'     '.9'      -> '-0.9'
   171  subx163 subtract '0'     '0.102'   -> '-0.102'
   172  subx164 subtract '0'     '.4'      -> '-0.4'
   173  subx165 subtract '0'     '.307'    -> '-0.307'
   174  subx166 subtract '0'     '.43822'  -> '-0.43822'
   175  subx167 subtract '0'     '.911'    -> '-0.911'
   176  subx168 subtract '.0'    '.02'     -> '-0.02'
   177  subx169 subtract '00'    '.392'    -> '-0.392'
   178  subx170 subtract '0'     '.26'     -> '-0.26'
   179  subx171 subtract '0'     '0.51'    -> '-0.51'
   180  subx172 subtract '0'     '.2234'   -> '-0.2234'
   181  subx173 subtract '0'     '.2'      -> '-0.2'
   182  subx174 subtract '.0'    '.0008'   -> '-0.0008'
   183  -- 0. on left
   184  subx180 subtract '0.0'     '-.1'      -> '0.1'
   185  subx181 subtract '0.00'    '-.97983'  -> '0.97983'
   186  subx182 subtract '0.0'     '-.9'      -> '0.9'
   187  subx183 subtract '0.0'     '-0.102'   -> '0.102'
   188  subx184 subtract '0.0'     '-.4'      -> '0.4'
   189  subx185 subtract '0.0'     '-.307'    -> '0.307'
   190  subx186 subtract '0.0'     '-.43822'  -> '0.43822'
   191  subx187 subtract '0.0'     '-.911'    -> '0.911'
   192  subx188 subtract '0.0'     '-.02'     -> '0.02'
   193  subx189 subtract '0.00'    '-.392'    -> '0.392'
   194  subx190 subtract '0.0'     '-.26'     -> '0.26'
   195  subx191 subtract '0.0'     '-0.51'    -> '0.51'
   196  subx192 subtract '0.0'     '-.2234'   -> '0.2234'
   197  subx193 subtract '0.0'     '-.2'      -> '0.2'
   198  subx194 subtract '0.0'     '-.0008'   -> '0.0008'
   199  -- negatives of same
   200  subx200 subtract '0'     '-.1'      -> '0.1'
   201  subx201 subtract '00'    '-.97983'  -> '0.97983'
   202  subx202 subtract '0'     '-.9'      -> '0.9'
   203  subx203 subtract '0'     '-0.102'   -> '0.102'
   204  subx204 subtract '0'     '-.4'      -> '0.4'
   205  subx205 subtract '0'     '-.307'    -> '0.307'
   206  subx206 subtract '0'     '-.43822'  -> '0.43822'
   207  subx207 subtract '0'     '-.911'    -> '0.911'
   208  subx208 subtract '.0'    '-.02'     -> '0.02'
   209  subx209 subtract '00'    '-.392'    -> '0.392'
   210  subx210 subtract '0'     '-.26'     -> '0.26'
   211  subx211 subtract '0'     '-0.51'    -> '0.51'
   212  subx212 subtract '0'     '-.2234'   -> '0.2234'
   213  subx213 subtract '0'     '-.2'      -> '0.2'
   214  subx214 subtract '.0'    '-.0008'   -> '0.0008'
   215  
   216  -- more fixed, LHS swaps [really the same as testcases under add]
   217  subx220 subtract '-56267E-12' 0  -> '-5.6267E-8'
   218  subx221 subtract '-56267E-11' 0  -> '-5.6267E-7'
   219  subx222 subtract '-56267E-10' 0  -> '-0.0000056267'
   220  subx223 subtract '-56267E-9'  0  -> '-0.000056267'
   221  subx224 subtract '-56267E-8'  0  -> '-0.00056267'
   222  subx225 subtract '-56267E-7'  0  -> '-0.0056267'
   223  subx226 subtract '-56267E-6'  0  -> '-0.056267'
   224  subx227 subtract '-56267E-5'  0  -> '-0.56267'
   225  subx228 subtract '-56267E-2'  0  -> '-562.67'
   226  subx229 subtract '-56267E-1'  0  -> '-5626.7'
   227  subx230 subtract '-56267E-0'  0  -> '-56267'
   228  -- symmetry ...
   229  subx240 subtract 0 '-56267E-12'  -> '5.6267E-8'
   230  subx241 subtract 0 '-56267E-11'  -> '5.6267E-7'
   231  subx242 subtract 0 '-56267E-10'  -> '0.0000056267'
   232  subx243 subtract 0 '-56267E-9'   -> '0.000056267'
   233  subx244 subtract 0 '-56267E-8'   -> '0.00056267'
   234  subx245 subtract 0 '-56267E-7'   -> '0.0056267'
   235  subx246 subtract 0 '-56267E-6'   -> '0.056267'
   236  subx247 subtract 0 '-56267E-5'   -> '0.56267'
   237  subx248 subtract 0 '-56267E-2'   -> '562.67'
   238  subx249 subtract 0 '-56267E-1'   -> '5626.7'
   239  subx250 subtract 0 '-56267E-0'   -> '56267'
   240  
   241  -- now some more from the 'new' add
   242  precision: 9
   243  subx301 subtract '1.23456789'  '1.00000000' -> '0.23456789'
   244  subx302 subtract '1.23456789'  '1.00000011' -> '0.23456778'
   245  
   246  subx311 subtract '0.4444444444'  '0.5555555555' -> '-0.111111111' Inexact Rounded
   247  subx312 subtract '0.4444444440'  '0.5555555555' -> '-0.111111112' Inexact Rounded
   248  subx313 subtract '0.4444444444'  '0.5555555550' -> '-0.111111111' Inexact Rounded
   249  subx314 subtract '0.44444444449'    '0' -> '0.444444444' Inexact Rounded
   250  subx315 subtract '0.444444444499'   '0' -> '0.444444444' Inexact Rounded
   251  subx316 subtract '0.4444444444999'  '0' -> '0.444444444' Inexact Rounded
   252  subx317 subtract '0.4444444445000'  '0' -> '0.444444445' Inexact Rounded
   253  subx318 subtract '0.4444444445001'  '0' -> '0.444444445' Inexact Rounded
   254  subx319 subtract '0.444444444501'   '0' -> '0.444444445' Inexact Rounded
   255  subx320 subtract '0.44444444451'    '0' -> '0.444444445' Inexact Rounded
   256  
   257  -- some carrying effects
   258  subx321 subtract '0.9998'  '0.0000' -> '0.9998'
   259  subx322 subtract '0.9998'  '0.0001' -> '0.9997'
   260  subx323 subtract '0.9998'  '0.0002' -> '0.9996'
   261  subx324 subtract '0.9998'  '0.0003' -> '0.9995'
   262  subx325 subtract '0.9998'  '-0.0000' -> '0.9998'
   263  subx326 subtract '0.9998'  '-0.0001' -> '0.9999'
   264  subx327 subtract '0.9998'  '-0.0002' -> '1.0000'
   265  subx328 subtract '0.9998'  '-0.0003' -> '1.0001'
   266  
   267  subx330 subtract '70'  '10000e+9' -> '-1.00000000E+13' Inexact Rounded
   268  subx331 subtract '700'  '10000e+9' -> '-1.00000000E+13' Inexact Rounded
   269  subx332 subtract '7000'  '10000e+9' -> '-9.99999999E+12' Inexact Rounded
   270  subx333 subtract '70000'  '10000e+9' -> '-9.99999993E+12' Rounded
   271  subx334 subtract '700000'  '10000e+9' -> '-9.99999930E+12' Rounded
   272  subx335 subtract '7000000'  '10000e+9' -> '-9.99999300E+12' Rounded
   273  -- symmetry:
   274  subx340 subtract '10000e+9'  '70' -> '1.00000000E+13' Inexact Rounded
   275  subx341 subtract '10000e+9'  '700' -> '1.00000000E+13' Inexact Rounded
   276  subx342 subtract '10000e+9'  '7000' -> '9.99999999E+12' Inexact Rounded
   277  subx343 subtract '10000e+9'  '70000' -> '9.99999993E+12' Rounded
   278  subx344 subtract '10000e+9'  '700000' -> '9.99999930E+12' Rounded
   279  subx345 subtract '10000e+9'  '7000000' -> '9.99999300E+12' Rounded
   280  
   281  -- same, higher precision
   282  precision: 15
   283  subx346 subtract '10000e+9'  '7'   -> '9999999999993'
   284  subx347 subtract '10000e+9'  '70'   -> '9999999999930'
   285  subx348 subtract '10000e+9'  '700'   -> '9999999999300'
   286  subx349 subtract '10000e+9'  '7000'   -> '9999999993000'
   287  subx350 subtract '10000e+9'  '70000'   -> '9999999930000'
   288  subx351 subtract '10000e+9'  '700000'   -> '9999999300000'
   289  subx352 subtract '7' '10000e+9'   -> '-9999999999993'
   290  subx353 subtract '70' '10000e+9'   -> '-9999999999930'
   291  subx354 subtract '700' '10000e+9'   -> '-9999999999300'
   292  subx355 subtract '7000' '10000e+9'   -> '-9999999993000'
   293  subx356 subtract '70000' '10000e+9'   -> '-9999999930000'
   294  subx357 subtract '700000' '10000e+9'   -> '-9999999300000'
   295  
   296  -- zero preservation
   297  precision: 6
   298  subx360 subtract '10000e+9'  '70000' -> '1.00000E+13' Inexact Rounded
   299  subx361 subtract 1 '0.0001' -> '0.9999'
   300  subx362 subtract 1 '0.00001' -> '0.99999'
   301  subx363 subtract 1 '0.000001' -> '0.999999'
   302  subx364 subtract 1 '0.0000001' -> '1.00000' Inexact Rounded
   303  subx365 subtract 1 '0.00000001' -> '1.00000' Inexact Rounded
   304  
   305  -- some funny zeros [in case of bad signum]
   306  subx370 subtract 1  0  -> 1
   307  subx371 subtract 1 0.  -> 1
   308  subx372 subtract 1  .0 -> 1.0
   309  subx373 subtract 1 0.0 -> 1.0
   310  subx374 subtract  0  1 -> -1
   311  subx375 subtract 0.  1 -> -1
   312  subx376 subtract  .0 1 -> -1.0
   313  subx377 subtract 0.0 1 -> -1.0
   314  
   315  precision: 9
   316  
   317  -- leading 0 digit before round
   318  subx910 subtract -103519362 -51897955.3 -> -51621406.7
   319  subx911 subtract 159579.444 89827.5229 -> 69751.9211
   320  
   321  subx920 subtract 333.123456 33.1234566 -> 299.999999 Inexact Rounded
   322  subx921 subtract 333.123456 33.1234565 -> 300.000000 Inexact Rounded
   323  subx922 subtract 133.123456 33.1234565 ->  99.9999995
   324  subx923 subtract 133.123456 33.1234564 ->  99.9999996
   325  subx924 subtract 133.123456 33.1234540 -> 100.000002 Rounded
   326  subx925 subtract 133.123456 43.1234560 ->  90.0000000
   327  subx926 subtract 133.123456 43.1234561 ->  89.9999999
   328  subx927 subtract 133.123456 43.1234566 ->  89.9999994
   329  subx928 subtract 101.123456 91.1234566 ->   9.9999994
   330  subx929 subtract 101.123456 99.1234566 ->   1.9999994
   331  
   332  -- more of the same; probe for cluster boundary problems
   333  precision: 1
   334  subx930 subtract  11 2           -> 9
   335  precision: 2
   336  subx932 subtract 101 2           -> 99
   337  precision: 3
   338  subx934 subtract 101 2.1         -> 98.9
   339  subx935 subtract 101 92.01       ->  8.99
   340  precision: 4
   341  subx936 subtract 101 2.01        -> 98.99
   342  subx937 subtract 101 92.01       ->  8.99
   343  subx938 subtract 101 92.006      ->  8.994
   344  precision: 5
   345  subx939 subtract 101 2.001       -> 98.999
   346  subx940 subtract 101 92.001      ->  8.999
   347  subx941 subtract 101 92.0006     ->  8.9994
   348  precision: 6
   349  subx942 subtract 101 2.0001      -> 98.9999
   350  subx943 subtract 101 92.0001     ->  8.9999
   351  subx944 subtract 101 92.00006    ->  8.99994
   352  precision: 7
   353  subx945 subtract 101 2.00001     -> 98.99999
   354  subx946 subtract 101 92.00001    ->  8.99999
   355  subx947 subtract 101 92.000006   ->  8.999994
   356  precision: 8
   357  subx948 subtract 101 2.000001    -> 98.999999
   358  subx949 subtract 101 92.000001   ->  8.999999
   359  subx950 subtract 101 92.0000006  ->  8.9999994
   360  precision: 9
   361  subx951 subtract 101 2.0000001   -> 98.9999999
   362  subx952 subtract 101 92.0000001  ->  8.9999999
   363  subx953 subtract 101 92.00000006 ->  8.99999994
   364  
   365  precision: 9
   366  
   367  -- more LHS swaps [were fixed]
   368  subx390 subtract '-56267E-10'   0 ->  '-0.0000056267'
   369  subx391 subtract '-56267E-6'    0 ->  '-0.056267'
   370  subx392 subtract '-56267E-5'    0 ->  '-0.56267'
   371  subx393 subtract '-56267E-4'    0 ->  '-5.6267'
   372  subx394 subtract '-56267E-3'    0 ->  '-56.267'
   373  subx395 subtract '-56267E-2'    0 ->  '-562.67'
   374  subx396 subtract '-56267E-1'    0 ->  '-5626.7'
   375  subx397 subtract '-56267E-0'    0 ->  '-56267'
   376  subx398 subtract '-5E-10'       0 ->  '-5E-10'
   377  subx399 subtract '-5E-7'        0 ->  '-5E-7'
   378  subx400 subtract '-5E-6'        0 ->  '-0.000005'
   379  subx401 subtract '-5E-5'        0 ->  '-0.00005'
   380  subx402 subtract '-5E-4'        0 ->  '-0.0005'
   381  subx403 subtract '-5E-1'        0 ->  '-0.5'
   382  subx404 subtract '-5E0'         0 ->  '-5'
   383  subx405 subtract '-5E1'         0 ->  '-50'
   384  subx406 subtract '-5E5'         0 ->  '-500000'
   385  subx407 subtract '-5E8'         0 ->  '-500000000'
   386  subx408 subtract '-5E9'         0 ->  '-5.00000000E+9'   Rounded
   387  subx409 subtract '-5E10'        0 ->  '-5.00000000E+10'  Rounded
   388  subx410 subtract '-5E11'        0 ->  '-5.00000000E+11'  Rounded
   389  subx411 subtract '-5E100'       0 ->  '-5.00000000E+100' Rounded
   390  
   391  -- more RHS swaps [were fixed]
   392  subx420 subtract 0  '-56267E-10' ->  '0.0000056267'
   393  subx421 subtract 0  '-56267E-6'  ->  '0.056267'
   394  subx422 subtract 0  '-56267E-5'  ->  '0.56267'
   395  subx423 subtract 0  '-56267E-4'  ->  '5.6267'
   396  subx424 subtract 0  '-56267E-3'  ->  '56.267'
   397  subx425 subtract 0  '-56267E-2'  ->  '562.67'
   398  subx426 subtract 0  '-56267E-1'  ->  '5626.7'
   399  subx427 subtract 0  '-56267E-0'  ->  '56267'
   400  subx428 subtract 0  '-5E-10'     ->  '5E-10'
   401  subx429 subtract 0  '-5E-7'      ->  '5E-7'
   402  subx430 subtract 0  '-5E-6'      ->  '0.000005'
   403  subx431 subtract 0  '-5E-5'      ->  '0.00005'
   404  subx432 subtract 0  '-5E-4'      ->  '0.0005'
   405  subx433 subtract 0  '-5E-1'      ->  '0.5'
   406  subx434 subtract 0  '-5E0'       ->  '5'
   407  subx435 subtract 0  '-5E1'       ->  '50'
   408  subx436 subtract 0  '-5E5'       ->  '500000'
   409  subx437 subtract 0  '-5E8'       ->  '500000000'
   410  subx438 subtract 0  '-5E9'       ->  '5.00000000E+9'    Rounded
   411  subx439 subtract 0  '-5E10'      ->  '5.00000000E+10'   Rounded
   412  subx440 subtract 0  '-5E11'      ->  '5.00000000E+11'   Rounded
   413  subx441 subtract 0  '-5E100'     ->  '5.00000000E+100'  Rounded
   414  
   415  
   416  -- try borderline precision, with carries, etc.
   417  precision: 15
   418  subx461 subtract '1E+12' '1'       -> '999999999999'
   419  subx462 subtract '1E+12' '-1.11'   -> '1000000000001.11'
   420  subx463 subtract '1.11'  '-1E+12'  -> '1000000000001.11'
   421  subx464 subtract '-1'    '-1E+12'  -> '999999999999'
   422  subx465 subtract '7E+12' '1'       -> '6999999999999'
   423  subx466 subtract '7E+12' '-1.11'   -> '7000000000001.11'
   424  subx467 subtract '1.11'  '-7E+12'  -> '7000000000001.11'
   425  subx468 subtract '-1'    '-7E+12'  -> '6999999999999'
   426  
   427  --                 123456789012345       123456789012345      1 23456789012345
   428  subx470 subtract '0.444444444444444'  '-0.555555555555563' -> '1.00000000000001' Inexact Rounded
   429  subx471 subtract '0.444444444444444'  '-0.555555555555562' -> '1.00000000000001' Inexact Rounded
   430  subx472 subtract '0.444444444444444'  '-0.555555555555561' -> '1.00000000000001' Inexact Rounded
   431  subx473 subtract '0.444444444444444'  '-0.555555555555560' -> '1.00000000000000' Inexact Rounded
   432  subx474 subtract '0.444444444444444'  '-0.555555555555559' -> '1.00000000000000' Inexact Rounded
   433  subx475 subtract '0.444444444444444'  '-0.555555555555558' -> '1.00000000000000' Inexact Rounded
   434  subx476 subtract '0.444444444444444'  '-0.555555555555557' -> '1.00000000000000' Inexact Rounded
   435  subx477 subtract '0.444444444444444'  '-0.555555555555556' -> '1.00000000000000' Rounded
   436  subx478 subtract '0.444444444444444'  '-0.555555555555555' -> '0.999999999999999'
   437  subx479 subtract '0.444444444444444'  '-0.555555555555554' -> '0.999999999999998'
   438  subx480 subtract '0.444444444444444'  '-0.555555555555553' -> '0.999999999999997'
   439  subx481 subtract '0.444444444444444'  '-0.555555555555552' -> '0.999999999999996'
   440  subx482 subtract '0.444444444444444'  '-0.555555555555551' -> '0.999999999999995'
   441  subx483 subtract '0.444444444444444'  '-0.555555555555550' -> '0.999999999999994'
   442  
   443  -- and some more, including residue effects and different roundings
   444  precision: 9
   445  rounding: half_up
   446  subx500 subtract '123456789' 0             -> '123456789'
   447  subx501 subtract '123456789' 0.000000001   -> '123456789' Inexact Rounded
   448  subx502 subtract '123456789' 0.000001      -> '123456789' Inexact Rounded
   449  subx503 subtract '123456789' 0.1           -> '123456789' Inexact Rounded
   450  subx504 subtract '123456789' 0.4           -> '123456789' Inexact Rounded
   451  subx505 subtract '123456789' 0.49          -> '123456789' Inexact Rounded
   452  subx506 subtract '123456789' 0.499999      -> '123456789' Inexact Rounded
   453  subx507 subtract '123456789' 0.499999999   -> '123456789' Inexact Rounded
   454  subx508 subtract '123456789' 0.5           -> '123456789' Inexact Rounded
   455  subx509 subtract '123456789' 0.500000001   -> '123456788' Inexact Rounded
   456  subx510 subtract '123456789' 0.500001      -> '123456788' Inexact Rounded
   457  subx511 subtract '123456789' 0.51          -> '123456788' Inexact Rounded
   458  subx512 subtract '123456789' 0.6           -> '123456788' Inexact Rounded
   459  subx513 subtract '123456789' 0.9           -> '123456788' Inexact Rounded
   460  subx514 subtract '123456789' 0.99999       -> '123456788' Inexact Rounded
   461  subx515 subtract '123456789' 0.999999999   -> '123456788' Inexact Rounded
   462  subx516 subtract '123456789' 1             -> '123456788'
   463  subx517 subtract '123456789' 1.000000001   -> '123456788' Inexact Rounded
   464  subx518 subtract '123456789' 1.00001       -> '123456788' Inexact Rounded
   465  subx519 subtract '123456789' 1.1           -> '123456788' Inexact Rounded
   466  
   467  rounding: half_even
   468  subx520 subtract '123456789' 0             -> '123456789'
   469  subx521 subtract '123456789' 0.000000001   -> '123456789' Inexact Rounded
   470  subx522 subtract '123456789' 0.000001      -> '123456789' Inexact Rounded
   471  subx523 subtract '123456789' 0.1           -> '123456789' Inexact Rounded
   472  subx524 subtract '123456789' 0.4           -> '123456789' Inexact Rounded
   473  subx525 subtract '123456789' 0.49          -> '123456789' Inexact Rounded
   474  subx526 subtract '123456789' 0.499999      -> '123456789' Inexact Rounded
   475  subx527 subtract '123456789' 0.499999999   -> '123456789' Inexact Rounded
   476  subx528 subtract '123456789' 0.5           -> '123456788' Inexact Rounded
   477  subx529 subtract '123456789' 0.500000001   -> '123456788' Inexact Rounded
   478  subx530 subtract '123456789' 0.500001      -> '123456788' Inexact Rounded
   479  subx531 subtract '123456789' 0.51          -> '123456788' Inexact Rounded
   480  subx532 subtract '123456789' 0.6           -> '123456788' Inexact Rounded
   481  subx533 subtract '123456789' 0.9           -> '123456788' Inexact Rounded
   482  subx534 subtract '123456789' 0.99999       -> '123456788' Inexact Rounded
   483  subx535 subtract '123456789' 0.999999999   -> '123456788' Inexact Rounded
   484  subx536 subtract '123456789' 1             -> '123456788'
   485  subx537 subtract '123456789' 1.00000001    -> '123456788' Inexact Rounded
   486  subx538 subtract '123456789' 1.00001       -> '123456788' Inexact Rounded
   487  subx539 subtract '123456789' 1.1           -> '123456788' Inexact Rounded
   488  -- critical few with even bottom digit...
   489  subx540 subtract '123456788' 0.499999999   -> '123456788' Inexact Rounded
   490  subx541 subtract '123456788' 0.5           -> '123456788' Inexact Rounded
   491  subx542 subtract '123456788' 0.500000001   -> '123456787' Inexact Rounded
   492  
   493  rounding: down
   494  subx550 subtract '123456789' 0             -> '123456789'
   495  subx551 subtract '123456789' 0.000000001   -> '123456788' Inexact Rounded
   496  subx552 subtract '123456789' 0.000001      -> '123456788' Inexact Rounded
   497  subx553 subtract '123456789' 0.1           -> '123456788' Inexact Rounded
   498  subx554 subtract '123456789' 0.4           -> '123456788' Inexact Rounded
   499  subx555 subtract '123456789' 0.49          -> '123456788' Inexact Rounded
   500  subx556 subtract '123456789' 0.499999      -> '123456788' Inexact Rounded
   501  subx557 subtract '123456789' 0.499999999   -> '123456788' Inexact Rounded
   502  subx558 subtract '123456789' 0.5           -> '123456788' Inexact Rounded
   503  subx559 subtract '123456789' 0.500000001   -> '123456788' Inexact Rounded
   504  subx560 subtract '123456789' 0.500001      -> '123456788' Inexact Rounded
   505  subx561 subtract '123456789' 0.51          -> '123456788' Inexact Rounded
   506  subx562 subtract '123456789' 0.6           -> '123456788' Inexact Rounded
   507  subx563 subtract '123456789' 0.9           -> '123456788' Inexact Rounded
   508  subx564 subtract '123456789' 0.99999       -> '123456788' Inexact Rounded
   509  subx565 subtract '123456789' 0.999999999   -> '123456788' Inexact Rounded
   510  subx566 subtract '123456789' 1             -> '123456788'
   511  subx567 subtract '123456789' 1.00000001    -> '123456787' Inexact Rounded
   512  subx568 subtract '123456789' 1.00001       -> '123456787' Inexact Rounded
   513  subx569 subtract '123456789' 1.1           -> '123456787' Inexact Rounded
   514  
   515  -- symmetry...
   516  rounding: half_up
   517  subx600 subtract 0             '123456789' -> '-123456789'
   518  subx601 subtract 0.000000001   '123456789' -> '-123456789' Inexact Rounded
   519  subx602 subtract 0.000001      '123456789' -> '-123456789' Inexact Rounded
   520  subx603 subtract 0.1           '123456789' -> '-123456789' Inexact Rounded
   521  subx604 subtract 0.4           '123456789' -> '-123456789' Inexact Rounded
   522  subx605 subtract 0.49          '123456789' -> '-123456789' Inexact Rounded
   523  subx606 subtract 0.499999      '123456789' -> '-123456789' Inexact Rounded
   524  subx607 subtract 0.499999999   '123456789' -> '-123456789' Inexact Rounded
   525  subx608 subtract 0.5           '123456789' -> '-123456789' Inexact Rounded
   526  subx609 subtract 0.500000001   '123456789' -> '-123456788' Inexact Rounded
   527  subx610 subtract 0.500001      '123456789' -> '-123456788' Inexact Rounded
   528  subx611 subtract 0.51          '123456789' -> '-123456788' Inexact Rounded
   529  subx612 subtract 0.6           '123456789' -> '-123456788' Inexact Rounded
   530  subx613 subtract 0.9           '123456789' -> '-123456788' Inexact Rounded
   531  subx614 subtract 0.99999       '123456789' -> '-123456788' Inexact Rounded
   532  subx615 subtract 0.999999999   '123456789' -> '-123456788' Inexact Rounded
   533  subx616 subtract 1             '123456789' -> '-123456788'
   534  subx617 subtract 1.000000001   '123456789' -> '-123456788' Inexact Rounded
   535  subx618 subtract 1.00001       '123456789' -> '-123456788' Inexact Rounded
   536  subx619 subtract 1.1           '123456789' -> '-123456788' Inexact Rounded
   537  
   538  rounding: half_even
   539  subx620 subtract 0             '123456789' -> '-123456789'
   540  subx621 subtract 0.000000001   '123456789' -> '-123456789' Inexact Rounded
   541  subx622 subtract 0.000001      '123456789' -> '-123456789' Inexact Rounded
   542  subx623 subtract 0.1           '123456789' -> '-123456789' Inexact Rounded
   543  subx624 subtract 0.4           '123456789' -> '-123456789' Inexact Rounded
   544  subx625 subtract 0.49          '123456789' -> '-123456789' Inexact Rounded
   545  subx626 subtract 0.499999      '123456789' -> '-123456789' Inexact Rounded
   546  subx627 subtract 0.499999999   '123456789' -> '-123456789' Inexact Rounded
   547  subx628 subtract 0.5           '123456789' -> '-123456788' Inexact Rounded
   548  subx629 subtract 0.500000001   '123456789' -> '-123456788' Inexact Rounded
   549  subx630 subtract 0.500001      '123456789' -> '-123456788' Inexact Rounded
   550  subx631 subtract 0.51          '123456789' -> '-123456788' Inexact Rounded
   551  subx632 subtract 0.6           '123456789' -> '-123456788' Inexact Rounded
   552  subx633 subtract 0.9           '123456789' -> '-123456788' Inexact Rounded
   553  subx634 subtract 0.99999       '123456789' -> '-123456788' Inexact Rounded
   554  subx635 subtract 0.999999999   '123456789' -> '-123456788' Inexact Rounded
   555  subx636 subtract 1             '123456789' -> '-123456788'
   556  subx637 subtract 1.00000001    '123456789' -> '-123456788' Inexact Rounded
   557  subx638 subtract 1.00001       '123456789' -> '-123456788' Inexact Rounded
   558  subx639 subtract 1.1           '123456789' -> '-123456788' Inexact Rounded
   559  -- critical few with even bottom digit...
   560  subx640 subtract 0.499999999   '123456788' -> '-123456788' Inexact Rounded
   561  subx641 subtract 0.5           '123456788' -> '-123456788' Inexact Rounded
   562  subx642 subtract 0.500000001   '123456788' -> '-123456787' Inexact Rounded
   563  
   564  rounding: down
   565  subx650 subtract 0             '123456789' -> '-123456789'
   566  subx651 subtract 0.000000001   '123456789' -> '-123456788' Inexact Rounded
   567  subx652 subtract 0.000001      '123456789' -> '-123456788' Inexact Rounded
   568  subx653 subtract 0.1           '123456789' -> '-123456788' Inexact Rounded
   569  subx654 subtract 0.4           '123456789' -> '-123456788' Inexact Rounded
   570  subx655 subtract 0.49          '123456789' -> '-123456788' Inexact Rounded
   571  subx656 subtract 0.499999      '123456789' -> '-123456788' Inexact Rounded
   572  subx657 subtract 0.499999999   '123456789' -> '-123456788' Inexact Rounded
   573  subx658 subtract 0.5           '123456789' -> '-123456788' Inexact Rounded
   574  subx659 subtract 0.500000001   '123456789' -> '-123456788' Inexact Rounded
   575  subx660 subtract 0.500001      '123456789' -> '-123456788' Inexact Rounded
   576  subx661 subtract 0.51          '123456789' -> '-123456788' Inexact Rounded
   577  subx662 subtract 0.6           '123456789' -> '-123456788' Inexact Rounded
   578  subx663 subtract 0.9           '123456789' -> '-123456788' Inexact Rounded
   579  subx664 subtract 0.99999       '123456789' -> '-123456788' Inexact Rounded
   580  subx665 subtract 0.999999999   '123456789' -> '-123456788' Inexact Rounded
   581  subx666 subtract 1             '123456789' -> '-123456788'
   582  subx667 subtract 1.00000001    '123456789' -> '-123456787' Inexact Rounded
   583  subx668 subtract 1.00001       '123456789' -> '-123456787' Inexact Rounded
   584  subx669 subtract 1.1           '123456789' -> '-123456787' Inexact Rounded
   585  
   586  
   587  -- lots of leading zeros in intermediate result, and showing effects of
   588  -- input rounding would have affected the following
   589  precision: 9
   590  rounding: half_up
   591  subx670 subtract '123456789' '123456788.1' -> 0.9
   592  subx671 subtract '123456789' '123456788.9' -> 0.1
   593  subx672 subtract '123456789' '123456789.1' -> -0.1
   594  subx673 subtract '123456789' '123456789.5' -> -0.5
   595  subx674 subtract '123456789' '123456789.9' -> -0.9
   596  
   597  rounding: half_even
   598  subx680 subtract '123456789' '123456788.1' -> 0.9
   599  subx681 subtract '123456789' '123456788.9' -> 0.1
   600  subx682 subtract '123456789' '123456789.1' -> -0.1
   601  subx683 subtract '123456789' '123456789.5' -> -0.5
   602  subx684 subtract '123456789' '123456789.9' -> -0.9
   603  
   604  subx685 subtract '123456788' '123456787.1' -> 0.9
   605  subx686 subtract '123456788' '123456787.9' -> 0.1
   606  subx687 subtract '123456788' '123456788.1' -> -0.1
   607  subx688 subtract '123456788' '123456788.5' -> -0.5
   608  subx689 subtract '123456788' '123456788.9' -> -0.9
   609  
   610  rounding: down
   611  subx690 subtract '123456789' '123456788.1' -> 0.9
   612  subx691 subtract '123456789' '123456788.9' -> 0.1
   613  subx692 subtract '123456789' '123456789.1' -> -0.1
   614  subx693 subtract '123456789' '123456789.5' -> -0.5
   615  subx694 subtract '123456789' '123456789.9' -> -0.9
   616  
   617  -- input preparation tests
   618  rounding: half_up
   619  precision: 3
   620  
   621  subx700 subtract '12345678900000'  -9999999999999 ->  '2.23E+13' Inexact Rounded
   622  subx701 subtract  '9999999999999' -12345678900000 ->  '2.23E+13' Inexact Rounded
   623  subx702 subtract '12E+3'  '-3456' ->  '1.55E+4' Inexact Rounded
   624  subx703 subtract '12E+3'  '-3446' ->  '1.54E+4' Inexact Rounded
   625  subx704 subtract '12E+3'  '-3454' ->  '1.55E+4' Inexact Rounded
   626  subx705 subtract '12E+3'  '-3444' ->  '1.54E+4' Inexact Rounded
   627  
   628  subx706 subtract '3456'  '-12E+3' ->  '1.55E+4' Inexact Rounded
   629  subx707 subtract '3446'  '-12E+3' ->  '1.54E+4' Inexact Rounded
   630  subx708 subtract '3454'  '-12E+3' ->  '1.55E+4' Inexact Rounded
   631  subx709 subtract '3444'  '-12E+3' ->  '1.54E+4' Inexact Rounded
   632  
   633  -- overflow and underflow tests [subnormals now possible]
   634  maxexponent: 999999999
   635  minexponent: -999999999
   636  precision: 9
   637  rounding: down
   638  subx710 subtract 1E+999999999    -9E+999999999   -> 9.99999999E+999999999 Overflow Inexact Rounded
   639  subx711 subtract 9E+999999999    -1E+999999999   -> 9.99999999E+999999999 Overflow Inexact Rounded
   640  rounding: half_up
   641  subx712 subtract 1E+999999999    -9E+999999999   -> Infinity Overflow Inexact Rounded
   642  subx713 subtract 9E+999999999    -1E+999999999   -> Infinity Overflow Inexact Rounded
   643  subx714 subtract -1.1E-999999999 -1E-999999999   -> -1E-1000000000 Subnormal
   644  subx715 subtract 1E-999999999    +1.1e-999999999 -> -1E-1000000000 Subnormal
   645  subx716 subtract -1E+999999999   +9E+999999999   -> -Infinity Overflow Inexact Rounded
   646  subx717 subtract -9E+999999999   +1E+999999999   -> -Infinity Overflow Inexact Rounded
   647  subx718 subtract +1.1E-999999999 +1E-999999999   -> 1E-1000000000 Subnormal
   648  subx719 subtract -1E-999999999   -1.1e-999999999 -> 1E-1000000000 Subnormal
   649  
   650  precision: 3
   651  subx720 subtract 1  9.999E+999999999   -> -Infinity Inexact Overflow Rounded
   652  subx721 subtract 1 -9.999E+999999999   ->  Infinity Inexact Overflow Rounded
   653  subx722 subtract    9.999E+999999999 1 ->  Infinity Inexact Overflow Rounded
   654  subx723 subtract   -9.999E+999999999 1 -> -Infinity Inexact Overflow Rounded
   655  subx724 subtract 1  9.999E+999999999   -> -Infinity Inexact Overflow Rounded
   656  subx725 subtract 1 -9.999E+999999999   ->  Infinity Inexact Overflow Rounded
   657  subx726 subtract    9.999E+999999999 1 ->  Infinity Inexact Overflow Rounded
   658  subx727 subtract   -9.999E+999999999 1 -> -Infinity Inexact Overflow Rounded
   659  
   660  -- [more below]
   661  
   662  -- long operand checks
   663  maxexponent: 999
   664  minexponent: -999
   665  precision: 9
   666  sub731 subtract 12345678000 0 ->  1.23456780E+10 Rounded
   667  sub732 subtract 0 12345678000 -> -1.23456780E+10 Rounded
   668  sub733 subtract 1234567800  0 ->  1.23456780E+9 Rounded
   669  sub734 subtract 0 1234567800  -> -1.23456780E+9 Rounded
   670  sub735 subtract 1234567890  0 ->  1.23456789E+9 Rounded
   671  sub736 subtract 0 1234567890  -> -1.23456789E+9 Rounded
   672  sub737 subtract 1234567891  0 ->  1.23456789E+9 Inexact Rounded
   673  sub738 subtract 0 1234567891  -> -1.23456789E+9 Inexact Rounded
   674  sub739 subtract 12345678901 0 ->  1.23456789E+10 Inexact Rounded
   675  sub740 subtract 0 12345678901 -> -1.23456789E+10 Inexact Rounded
   676  sub741 subtract 1234567896  0 ->  1.23456790E+9 Inexact Rounded
   677  sub742 subtract 0 1234567896  -> -1.23456790E+9 Inexact Rounded
   678  
   679  precision: 15
   680  sub751 subtract 12345678000 0 ->  12345678000
   681  sub752 subtract 0 12345678000 -> -12345678000
   682  sub753 subtract 1234567800  0 ->  1234567800
   683  sub754 subtract 0 1234567800  -> -1234567800
   684  sub755 subtract 1234567890  0 ->  1234567890
   685  sub756 subtract 0 1234567890  -> -1234567890
   686  sub757 subtract 1234567891  0 ->  1234567891
   687  sub758 subtract 0 1234567891  -> -1234567891
   688  sub759 subtract 12345678901 0 ->  12345678901
   689  sub760 subtract 0 12345678901 -> -12345678901
   690  sub761 subtract 1234567896  0 ->  1234567896
   691  sub762 subtract 0 1234567896  -> -1234567896
   692  
   693  -- Specials
   694  subx780 subtract -Inf   Inf   -> -Infinity
   695  subx781 subtract -Inf   1000  -> -Infinity
   696  subx782 subtract -Inf   1     -> -Infinity
   697  subx783 subtract -Inf  -0     -> -Infinity
   698  subx784 subtract -Inf  -1     -> -Infinity
   699  subx785 subtract -Inf  -1000  -> -Infinity
   700  subx787 subtract -1000  Inf   -> -Infinity
   701  subx788 subtract -Inf   Inf   -> -Infinity
   702  subx789 subtract -1     Inf   -> -Infinity
   703  subx790 subtract  0     Inf   -> -Infinity
   704  subx791 subtract  1     Inf   -> -Infinity
   705  subx792 subtract  1000  Inf   -> -Infinity
   706  
   707  subx800 subtract  Inf   Inf   ->  NaN  Invalid_operation
   708  subx801 subtract  Inf   1000  ->  Infinity
   709  subx802 subtract  Inf   1     ->  Infinity
   710  subx803 subtract  Inf   0     ->  Infinity
   711  subx804 subtract  Inf  -0     ->  Infinity
   712  subx805 subtract  Inf  -1     ->  Infinity
   713  subx806 subtract  Inf  -1000  ->  Infinity
   714  subx807 subtract  Inf  -Inf   ->  Infinity
   715  subx808 subtract -1000 -Inf   ->  Infinity
   716  subx809 subtract -Inf  -Inf   ->  NaN  Invalid_operation
   717  subx810 subtract -1    -Inf   ->  Infinity
   718  subx811 subtract -0    -Inf   ->  Infinity
   719  subx812 subtract  0    -Inf   ->  Infinity
   720  subx813 subtract  1    -Inf   ->  Infinity
   721  subx814 subtract  1000 -Inf   ->  Infinity
   722  subx815 subtract  Inf  -Inf   ->  Infinity
   723  
   724  subx821 subtract  NaN   Inf   ->  NaN
   725  subx822 subtract -NaN   1000  -> -NaN
   726  subx823 subtract  NaN   1     ->  NaN
   727  subx824 subtract  NaN   0     ->  NaN
   728  subx825 subtract  NaN  -0     ->  NaN
   729  subx826 subtract  NaN  -1     ->  NaN
   730  subx827 subtract  NaN  -1000  ->  NaN
   731  subx828 subtract  NaN  -Inf   ->  NaN
   732  subx829 subtract -NaN   NaN   -> -NaN
   733  subx830 subtract -Inf   NaN   ->  NaN
   734  subx831 subtract -1000  NaN   ->  NaN
   735  subx832 subtract -1     NaN   ->  NaN
   736  subx833 subtract -0     NaN   ->  NaN
   737  subx834 subtract  0     NaN   ->  NaN
   738  subx835 subtract  1     NaN   ->  NaN
   739  subx836 subtract  1000 -NaN   -> -NaN
   740  subx837 subtract  Inf   NaN   ->  NaN
   741  
   742  subx841 subtract  sNaN  Inf   ->  NaN  Invalid_operation
   743  subx842 subtract -sNaN  1000  -> -NaN  Invalid_operation
   744  subx843 subtract  sNaN  1     ->  NaN  Invalid_operation
   745  subx844 subtract  sNaN  0     ->  NaN  Invalid_operation
   746  subx845 subtract  sNaN -0     ->  NaN  Invalid_operation
   747  subx846 subtract  sNaN -1     ->  NaN  Invalid_operation
   748  subx847 subtract  sNaN -1000  ->  NaN  Invalid_operation
   749  subx848 subtract  sNaN  NaN   ->  NaN  Invalid_operation
   750  subx849 subtract  sNaN sNaN   ->  NaN  Invalid_operation
   751  subx850 subtract  NaN  sNaN   ->  NaN  Invalid_operation
   752  subx851 subtract -Inf -sNaN   -> -NaN  Invalid_operation
   753  subx852 subtract -1000 sNaN   ->  NaN  Invalid_operation
   754  subx853 subtract -1    sNaN   ->  NaN  Invalid_operation
   755  subx854 subtract -0    sNaN   ->  NaN  Invalid_operation
   756  subx855 subtract  0    sNaN   ->  NaN  Invalid_operation
   757  subx856 subtract  1    sNaN   ->  NaN  Invalid_operation
   758  subx857 subtract  1000 sNaN   ->  NaN  Invalid_operation
   759  subx858 subtract  Inf  sNaN   ->  NaN  Invalid_operation
   760  subx859 subtract  NaN  sNaN   ->  NaN  Invalid_operation
   761  
   762  -- propagating NaNs
   763  subx861 subtract  NaN01   -Inf     ->  NaN1
   764  subx862 subtract -NaN02   -1000    -> -NaN2
   765  subx863 subtract  NaN03    1000    ->  NaN3
   766  subx864 subtract  NaN04    Inf     ->  NaN4
   767  subx865 subtract  NaN05    NaN61   ->  NaN5
   768  subx866 subtract -Inf     -NaN71   -> -NaN71
   769  subx867 subtract -1000     NaN81   ->  NaN81
   770  subx868 subtract  1000     NaN91   ->  NaN91
   771  subx869 subtract  Inf      NaN101  ->  NaN101
   772  subx871 subtract  sNaN011  -Inf    ->  NaN11  Invalid_operation
   773  subx872 subtract  sNaN012  -1000   ->  NaN12  Invalid_operation
   774  subx873 subtract -sNaN013   1000   -> -NaN13  Invalid_operation
   775  subx874 subtract  sNaN014   NaN171 ->  NaN14  Invalid_operation
   776  subx875 subtract  sNaN015  sNaN181 ->  NaN15  Invalid_operation
   777  subx876 subtract  NaN016   sNaN191 ->  NaN191 Invalid_operation
   778  subx877 subtract -Inf      sNaN201 ->  NaN201 Invalid_operation
   779  subx878 subtract -1000     sNaN211 ->  NaN211 Invalid_operation
   780  subx879 subtract  1000    -sNaN221 -> -NaN221 Invalid_operation
   781  subx880 subtract  Inf      sNaN231 ->  NaN231 Invalid_operation
   782  subx881 subtract  NaN025   sNaN241 ->  NaN241 Invalid_operation
   783  
   784  -- edge case spills
   785  subx901 subtract  2.E-3  1.002  -> -1.000
   786  subx902 subtract  2.0E-3  1.002  -> -1.0000
   787  subx903 subtract  2.00E-3  1.0020  -> -1.00000
   788  subx904 subtract  2.000E-3  1.00200  -> -1.000000
   789  subx905 subtract  2.0000E-3  1.002000  -> -1.0000000
   790  subx906 subtract  2.00000E-3  1.0020000  -> -1.00000000
   791  subx907 subtract  2.000000E-3  1.00200000  -> -1.000000000
   792  subx908 subtract  2.0000000E-3  1.002000000  -> -1.0000000000
   793  
   794  -- subnormals and underflows
   795  precision: 3
   796  maxexponent: 999
   797  minexponent: -999
   798  subx1010 subtract  0  1.00E-999       ->  -1.00E-999
   799  subx1011 subtract  0  0.1E-999        ->  -1E-1000   Subnormal
   800  subx1012 subtract  0  0.10E-999       ->  -1.0E-1000 Subnormal
   801  subx1013 subtract  0  0.100E-999      ->  -1.0E-1000 Subnormal Rounded
   802  subx1014 subtract  0  0.01E-999       ->  -1E-1001   Subnormal
   803  -- next is rounded to Emin
   804  subx1015 subtract  0  0.999E-999      ->  -1.00E-999 Inexact Rounded Subnormal Underflow
   805  subx1016 subtract  0  0.099E-999      ->  -1.0E-1000 Inexact Rounded Subnormal Underflow
   806  subx1017 subtract  0  0.009E-999      ->  -1E-1001   Inexact Rounded Subnormal Underflow
   807  subx1018 subtract  0  0.001E-999      ->  -0E-1001   Inexact Rounded Subnormal Underflow Clamped
   808  subx1019 subtract  0  0.0009E-999     ->  -0E-1001   Inexact Rounded Subnormal Underflow Clamped
   809  subx1020 subtract  0  0.0001E-999     ->  -0E-1001   Inexact Rounded Subnormal Underflow Clamped
   810  
   811  subx1030 subtract  0 -1.00E-999       ->   1.00E-999
   812  subx1031 subtract  0 -0.1E-999        ->   1E-1000   Subnormal
   813  subx1032 subtract  0 -0.10E-999       ->   1.0E-1000 Subnormal
   814  subx1033 subtract  0 -0.100E-999      ->   1.0E-1000 Subnormal Rounded
   815  subx1034 subtract  0 -0.01E-999       ->   1E-1001   Subnormal
   816  -- next is rounded to Emin
   817  subx1035 subtract  0 -0.999E-999      ->   1.00E-999 Inexact Rounded Subnormal Underflow
   818  subx1036 subtract  0 -0.099E-999      ->   1.0E-1000 Inexact Rounded Subnormal Underflow
   819  subx1037 subtract  0 -0.009E-999      ->   1E-1001   Inexact Rounded Subnormal Underflow
   820  subx1038 subtract  0 -0.001E-999      ->   0E-1001   Inexact Rounded Subnormal Underflow Clamped
   821  subx1039 subtract  0 -0.0009E-999     ->   0E-1001   Inexact Rounded Subnormal Underflow Clamped
   822  subx1040 subtract  0 -0.0001E-999     ->   0E-1001   Inexact Rounded Subnormal Underflow Clamped
   823  
   824  -- some non-zero subnormal subtracts
   825  -- subx1056 is a tricky case
   826  rounding: half_up
   827  subx1050 subtract  1.00E-999   0.1E-999  ->   9.0E-1000  Subnormal
   828  subx1051 subtract  0.1E-999    0.1E-999  ->   0E-1000
   829  subx1052 subtract  0.10E-999   0.1E-999  ->   0E-1001
   830  subx1053 subtract  0.100E-999  0.1E-999  ->   0E-1001    Clamped
   831  subx1054 subtract  0.01E-999   0.1E-999  ->   -9E-1001   Subnormal
   832  subx1055 subtract  0.999E-999  0.1E-999  ->   9.0E-1000  Inexact Rounded Subnormal Underflow
   833  subx1056 subtract  0.099E-999  0.1E-999  ->   -0E-1001   Inexact Rounded Subnormal Underflow Clamped
   834  subx1057 subtract  0.009E-999  0.1E-999  ->   -9E-1001   Inexact Rounded Subnormal Underflow
   835  subx1058 subtract  0.001E-999  0.1E-999  ->   -1.0E-1000 Inexact Rounded Subnormal Underflow
   836  subx1059 subtract  0.0009E-999 0.1E-999  ->   -1.0E-1000 Inexact Rounded Subnormal Underflow
   837  subx1060 subtract  0.0001E-999 0.1E-999  ->   -1.0E-1000 Inexact Rounded Subnormal Underflow
   838  
   839  
   840  -- check for double-rounded subnormals
   841  precision:   5
   842  maxexponent: 79
   843  minexponent: -79
   844  subx1101 subtract  0 1.52444E-80 -> -1.524E-80 Inexact Rounded Subnormal Underflow
   845  subx1102 subtract  0 1.52445E-80 -> -1.524E-80 Inexact Rounded Subnormal Underflow
   846  subx1103 subtract  0 1.52446E-80 -> -1.524E-80 Inexact Rounded Subnormal Underflow
   847  subx1104 subtract  1.52444E-80 0 ->  1.524E-80 Inexact Rounded Subnormal Underflow
   848  subx1105 subtract  1.52445E-80 0 ->  1.524E-80 Inexact Rounded Subnormal Underflow
   849  subx1106 subtract  1.52446E-80 0 ->  1.524E-80 Inexact Rounded Subnormal Underflow
   850  
   851  subx1111 subtract  1.2345678E-80  1.2345671E-80 ->  0E-83 Inexact Rounded Subnormal Underflow Clamped
   852  subx1112 subtract  1.2345678E-80  1.2345618E-80 ->  0E-83 Inexact Rounded Subnormal Underflow Clamped
   853  subx1113 subtract  1.2345678E-80  1.2345178E-80 ->  0E-83 Inexact Rounded Subnormal Underflow Clamped
   854  subx1114 subtract  1.2345678E-80  1.2341678E-80 ->  0E-83 Inexact Rounded Subnormal Underflow Clamped
   855  subx1115 subtract  1.2345678E-80  1.2315678E-80 ->  3E-83         Rounded Subnormal
   856  subx1116 subtract  1.2345678E-80  1.2145678E-80 ->  2.0E-82       Rounded Subnormal
   857  subx1117 subtract  1.2345678E-80  1.1345678E-80 ->  1.00E-81      Rounded Subnormal
   858  subx1118 subtract  1.2345678E-80  0.2345678E-80 ->  1.000E-80     Rounded Subnormal
   859  
   860  precision:   34
   861  rounding:    half_up
   862  maxExponent: 6144
   863  minExponent: -6143
   864  -- Examples from SQL proposal (Krishna Kulkarni)
   865  subx1125  subtract 130E-2  120E-2 -> 0.10
   866  subx1126  subtract 130E-2  12E-1  -> 0.10
   867  subx1127  subtract 130E-2  1E0    -> 0.30
   868  subx1128  subtract 1E2     1E4    -> -9.9E+3
   869  
   870  -- Null tests
   871  subx9990 subtract 10  # -> NaN Invalid_operation
   872  subx9991 subtract  # 10 -> NaN Invalid_operation