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.
		
		
		
		
		
			
		
			
				
	
	
		
			119 lines
		
	
	
		
			4.4 KiB
		
	
	
	
		
			Plaintext
		
	
			
		
		
	
	
			119 lines
		
	
	
		
			4.4 KiB
		
	
	
	
		
			Plaintext
		
	
------------------------------------------------------------------------
 | 
						|
-- plus0.decTest -- decimal monadic addition (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
 | 
						|
 | 
						|
-- This set of tests primarily tests the existence of the operator.
 | 
						|
-- Addition and rounding, and most overflows, are tested elsewhere.
 | 
						|
 | 
						|
extended:    0
 | 
						|
precision:   9
 | 
						|
rounding:    half_up
 | 
						|
maxExponent: 999
 | 
						|
minexponent: -999
 | 
						|
 | 
						|
plu001 plus '1'      -> '1'
 | 
						|
plu002 plus '-1'     -> '-1'
 | 
						|
plu003 plus '1.00'   -> '1.00'
 | 
						|
plu004 plus '-1.00'  -> '-1.00'
 | 
						|
plu005 plus '0'      -> '0'
 | 
						|
plu006 plus '0.00'   -> '0'
 | 
						|
plu007 plus '00.0'   -> '0'
 | 
						|
plu008 plus '00.00'  -> '0'
 | 
						|
plu009 plus '00'     -> '0'
 | 
						|
 | 
						|
plu010 plus '-2'     -> '-2'
 | 
						|
plu011 plus '2'      -> '2'
 | 
						|
plu012 plus '-2.00'  -> '-2.00'
 | 
						|
plu013 plus '2.00'   -> '2.00'
 | 
						|
plu014 plus '-0'     -> '0'
 | 
						|
plu015 plus '-0.00'  -> '0'
 | 
						|
plu016 plus '-00.0'  -> '0'
 | 
						|
plu017 plus '-00.00' -> '0'
 | 
						|
plu018 plus '-00'    -> '0'
 | 
						|
 | 
						|
plu020 plus '-2000000' -> '-2000000'
 | 
						|
plu021 plus '2000000'  -> '2000000'
 | 
						|
precision: 7
 | 
						|
plu022 plus '-2000000' -> '-2000000'
 | 
						|
plu023 plus '2000000'  -> '2000000'
 | 
						|
precision: 6
 | 
						|
plu024 plus '-2000000' -> '-2.00000E+6' Rounded
 | 
						|
plu025 plus '2000000'  -> '2.00000E+6' Rounded
 | 
						|
precision: 3
 | 
						|
plu026 plus '-2000000' -> '-2.00E+6' Rounded
 | 
						|
plu027 plus '2000000'  -> '2.00E+6' Rounded
 | 
						|
 | 
						|
-- more fixed, potential LHS swaps if done by add 0
 | 
						|
precision: 9
 | 
						|
plu060 plus '56267E-10'   -> '0.0000056267'
 | 
						|
plu061 plus '56267E-5'    -> '0.56267'
 | 
						|
plu062 plus '56267E-2'    -> '562.67'
 | 
						|
plu063 plus '56267E-1'    -> '5626.7'
 | 
						|
plu065 plus '56267E-0'    -> '56267'
 | 
						|
plu066 plus '56267E+0'    -> '56267'
 | 
						|
plu067 plus '56267E+1'    -> '562670'
 | 
						|
plu068 plus '56267E+2'    -> '5626700'
 | 
						|
plu069 plus '56267E+3'    -> '56267000'
 | 
						|
plu070 plus '56267E+4'    -> '562670000'
 | 
						|
plu071 plus '56267E+5'    -> '5.6267E+9'
 | 
						|
plu072 plus '56267E+6'    -> '5.6267E+10'
 | 
						|
plu080 plus '-56267E-10'  -> '-0.0000056267'
 | 
						|
plu081 plus '-56267E-5'   -> '-0.56267'
 | 
						|
plu082 plus '-56267E-2'   -> '-562.67'
 | 
						|
plu083 plus '-56267E-1'   -> '-5626.7'
 | 
						|
plu085 plus '-56267E-0'   -> '-56267'
 | 
						|
plu086 plus '-56267E+0'   -> '-56267'
 | 
						|
plu087 plus '-56267E+1'   -> '-562670'
 | 
						|
plu088 plus '-56267E+2'   -> '-5626700'
 | 
						|
plu089 plus '-56267E+3'   -> '-56267000'
 | 
						|
plu090 plus '-56267E+4'   -> '-562670000'
 | 
						|
plu091 plus '-56267E+5'   -> '-5.6267E+9'
 | 
						|
plu092 plus '-56267E+6'   -> '-5.6267E+10'
 | 
						|
 | 
						|
-- overflow tests [underflow not possible]
 | 
						|
maxexponent: 999999999
 | 
						|
minexponent: -999999999
 | 
						|
precision: 3
 | 
						|
plu120 plus 9.999E+999999999 -> ? Inexact Lost_digits Overflow Rounded
 | 
						|
 | 
						|
-- lostDigits checks
 | 
						|
maxexponent: 999
 | 
						|
minexponent: -999
 | 
						|
precision: 9
 | 
						|
plu301 plus 12345678000  -> 1.23456780E+10 Rounded
 | 
						|
plu302 plus 1234567800   -> 1.23456780E+9 Rounded
 | 
						|
plu303 plus 1234567890   -> 1.23456789E+9 Rounded
 | 
						|
plu304 plus 1234567891   -> 1.23456789E+9 Inexact Lost_digits Rounded
 | 
						|
plu305 plus 12345678901  -> 1.23456789E+10 Inexact Lost_digits Rounded
 | 
						|
plu306 plus 1234567896   -> 1.23456790E+9 Inexact Lost_digits Rounded
 | 
						|
 | 
						|
precision: 15
 | 
						|
-- still checking for [no] lostDigits
 | 
						|
plu321 plus 12345678000  -> 12345678000
 | 
						|
plu322 plus 1234567800   -> 1234567800
 | 
						|
plu323 plus 1234567890   -> 1234567890
 | 
						|
plu324 plus 1234567891   -> 1234567891
 | 
						|
plu325 plus 12345678901  -> 12345678901
 | 
						|
plu326 plus 1234567896   -> 1234567896
 | 
						|
 | 
						|
-- Null tests
 | 
						|
plu400 plus  # -> ? Invalid_operation
 | 
						|
 |