1------------------------------------------------------------------------ 2-- clamp.decTest -- clamped exponent tests (format-independent) -- 3-- Copyright (c) IBM Corporation, 2000, 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 22-- This set of tests uses the same limits as the 8-byte concrete 23-- representation, but applies clamping without using format-specific 24-- conversions. 25 26extended: 1 27precision: 16 28rounding: half_even 29maxExponent: 384 30minExponent: -383 31clamp: 1 32 33-- General testcases 34 35-- Normality 36clam010 apply 1234567890123456 -> 1234567890123456 37clam011 apply 1234567890123456.0 -> 1234567890123456 Rounded 38clam012 apply 1234567890123456.1 -> 1234567890123456 Rounded Inexact 39clam013 apply -1234567890123456 -> -1234567890123456 40clam014 apply -1234567890123456.0 -> -1234567890123456 Rounded 41clam015 apply -1234567890123456.1 -> -1234567890123456 Rounded Inexact 42 43 44-- Nmax and similar 45clam022 apply 9.999999999999999E+384 -> 9.999999999999999E+384 46clam024 apply 1.234567890123456E+384 -> 1.234567890123456E+384 47-- fold-downs (more below) 48clam030 apply 1.23E+384 -> 1.230000000000000E+384 Clamped 49clam032 apply 1E+384 -> 1.000000000000000E+384 Clamped 50 51clam051 apply 12345 -> 12345 52clam053 apply 1234 -> 1234 53clam055 apply 123 -> 123 54clam057 apply 12 -> 12 55clam059 apply 1 -> 1 56clam061 apply 1.23 -> 1.23 57clam063 apply 123.45 -> 123.45 58 59-- Nmin and below 60clam071 apply 1E-383 -> 1E-383 61clam073 apply 1.000000000000000E-383 -> 1.000000000000000E-383 62clam075 apply 1.000000000000001E-383 -> 1.000000000000001E-383 63 64clam077 apply 0.100000000000000E-383 -> 1.00000000000000E-384 Subnormal 65clam079 apply 0.000000000000010E-383 -> 1.0E-397 Subnormal 66clam081 apply 0.00000000000001E-383 -> 1E-397 Subnormal 67clam083 apply 0.000000000000001E-383 -> 1E-398 Subnormal 68 69-- underflows 70clam090 apply 1e-398 -> #0000000000000001 Subnormal 71clam091 apply 1.9e-398 -> #0000000000000002 Subnormal Underflow Inexact Rounded 72clam092 apply 1.1e-398 -> #0000000000000001 Subnormal Underflow Inexact Rounded 73clam093 apply 1.00000000001e-398 -> #0000000000000001 Subnormal Underflow Inexact Rounded 74clam094 apply 1.00000000000001e-398 -> #0000000000000001 Subnormal Underflow Inexact Rounded 75clam095 apply 1.000000000000001e-398 -> #0000000000000001 Subnormal Underflow Inexact Rounded 76clam096 apply 0.1e-398 -> #0000000000000000 Subnormal Underflow Inexact Rounded Clamped 77clam097 apply 0.00000000001e-398 -> #0000000000000000 Subnormal Underflow Inexact Rounded Clamped 78clam098 apply 0.00000000000001e-398 -> #0000000000000000 Subnormal Underflow Inexact Rounded Clamped 79clam099 apply 0.000000000000001e-398 -> #0000000000000000 Subnormal Underflow Inexact Rounded Clamped 80 81-- Same again, negatives 82-- Nmax and similar 83clam122 apply -9.999999999999999E+384 -> -9.999999999999999E+384 84clam124 apply -1.234567890123456E+384 -> -1.234567890123456E+384 85-- fold-downs (more below) 86clam130 apply -1.23E+384 -> -1.230000000000000E+384 Clamped 87clam132 apply -1E+384 -> -1.000000000000000E+384 Clamped 88 89clam151 apply -12345 -> -12345 90clam153 apply -1234 -> -1234 91clam155 apply -123 -> -123 92clam157 apply -12 -> -12 93clam159 apply -1 -> -1 94clam161 apply -1.23 -> -1.23 95clam163 apply -123.45 -> -123.45 96 97-- Nmin and below 98clam171 apply -1E-383 -> -1E-383 99clam173 apply -1.000000000000000E-383 -> -1.000000000000000E-383 100clam175 apply -1.000000000000001E-383 -> -1.000000000000001E-383 101 102clam177 apply -0.100000000000000E-383 -> -1.00000000000000E-384 Subnormal 103clam179 apply -0.000000000000010E-383 -> -1.0E-397 Subnormal 104clam181 apply -0.00000000000001E-383 -> -1E-397 Subnormal 105clam183 apply -0.000000000000001E-383 -> -1E-398 Subnormal 106 107-- underflows 108clam189 apply -1e-398 -> #8000000000000001 Subnormal 109clam190 apply -1.0e-398 -> #8000000000000001 Subnormal Rounded 110clam191 apply -1.9e-398 -> #8000000000000002 Subnormal Underflow Inexact Rounded 111clam192 apply -1.1e-398 -> #8000000000000001 Subnormal Underflow Inexact Rounded 112clam193 apply -1.00000000001e-398 -> #8000000000000001 Subnormal Underflow Inexact Rounded 113clam194 apply -1.00000000000001e-398 -> #8000000000000001 Subnormal Underflow Inexact Rounded 114clam195 apply -1.000000000000001e-398 -> #8000000000000001 Subnormal Underflow Inexact Rounded 115clam196 apply -0.1e-398 -> #8000000000000000 Subnormal Underflow Inexact Rounded Clamped 116clam197 apply -0.00000000001e-398 -> #8000000000000000 Subnormal Underflow Inexact Rounded Clamped 117clam198 apply -0.00000000000001e-398 -> #8000000000000000 Subnormal Underflow Inexact Rounded Clamped 118clam199 apply -0.000000000000001e-398 -> #8000000000000000 Subnormal Underflow Inexact Rounded Clamped 119 120-- zeros 121clam401 apply 0E-500 -> 0E-398 Clamped 122clam402 apply 0E-400 -> 0E-398 Clamped 123clam403 apply 0E-398 -> 0E-398 124clam404 apply 0.000000000000000E-383 -> 0E-398 125clam405 apply 0E-2 -> 0.00 126clam406 apply 0 -> 0 127clam407 apply 0E+3 -> 0E+3 128clam408 apply 0E+369 -> 0E+369 129-- clamped zeros... 130clam410 apply 0E+370 -> 0E+369 Clamped 131clam411 apply 0E+384 -> 0E+369 Clamped 132clam412 apply 0E+400 -> 0E+369 Clamped 133clam413 apply 0E+500 -> 0E+369 Clamped 134 135-- negative zeros 136clam420 apply -0E-500 -> -0E-398 Clamped 137clam421 apply -0E-400 -> -0E-398 Clamped 138clam422 apply -0E-398 -> -0E-398 139clam423 apply -0.000000000000000E-383 -> -0E-398 140clam424 apply -0E-2 -> -0.00 141clam425 apply -0 -> -0 142clam426 apply -0E+3 -> -0E+3 143clam427 apply -0E+369 -> -0E+369 144-- clamped zeros... 145clam431 apply -0E+370 -> -0E+369 Clamped 146clam432 apply -0E+384 -> -0E+369 Clamped 147clam433 apply -0E+400 -> -0E+369 Clamped 148clam434 apply -0E+500 -> -0E+369 Clamped 149 150-- fold-down full sequence 151clam601 apply 1E+384 -> 1.000000000000000E+384 Clamped 152clam603 apply 1E+383 -> 1.00000000000000E+383 Clamped 153clam605 apply 1E+382 -> 1.0000000000000E+382 Clamped 154clam607 apply 1E+381 -> 1.000000000000E+381 Clamped 155clam609 apply 1E+380 -> 1.00000000000E+380 Clamped 156clam611 apply 1E+379 -> 1.0000000000E+379 Clamped 157clam613 apply 1E+378 -> 1.000000000E+378 Clamped 158clam615 apply 1E+377 -> 1.00000000E+377 Clamped 159clam617 apply 1E+376 -> 1.0000000E+376 Clamped 160clam619 apply 1E+375 -> 1.000000E+375 Clamped 161clam621 apply 1E+374 -> 1.00000E+374 Clamped 162clam623 apply 1E+373 -> 1.0000E+373 Clamped 163clam625 apply 1E+372 -> 1.000E+372 Clamped 164clam627 apply 1E+371 -> 1.00E+371 Clamped 165clam629 apply 1E+370 -> 1.0E+370 Clamped 166clam631 apply 1E+369 -> 1E+369 167clam633 apply 1E+368 -> 1E+368 168-- same with 9s 169clam641 apply 9E+384 -> 9.000000000000000E+384 Clamped 170clam643 apply 9E+383 -> 9.00000000000000E+383 Clamped 171clam645 apply 9E+382 -> 9.0000000000000E+382 Clamped 172clam647 apply 9E+381 -> 9.000000000000E+381 Clamped 173clam649 apply 9E+380 -> 9.00000000000E+380 Clamped 174clam651 apply 9E+379 -> 9.0000000000E+379 Clamped 175clam653 apply 9E+378 -> 9.000000000E+378 Clamped 176clam655 apply 9E+377 -> 9.00000000E+377 Clamped 177clam657 apply 9E+376 -> 9.0000000E+376 Clamped 178clam659 apply 9E+375 -> 9.000000E+375 Clamped 179clam661 apply 9E+374 -> 9.00000E+374 Clamped 180clam663 apply 9E+373 -> 9.0000E+373 Clamped 181clam665 apply 9E+372 -> 9.000E+372 Clamped 182clam667 apply 9E+371 -> 9.00E+371 Clamped 183clam669 apply 9E+370 -> 9.0E+370 Clamped 184clam671 apply 9E+369 -> 9E+369 185clam673 apply 9E+368 -> 9E+368 186 187-- subnormals clamped to 0-Etiny 188precision: 16 189maxExponent: 384 190minExponent: -383 191clam681 apply 7E-398 -> 7E-398 Subnormal 192clam682 apply 0E-398 -> 0E-398 193clam683 apply 7E-399 -> 1E-398 Subnormal Underflow Inexact Rounded 194clam684 apply 4E-399 -> 0E-398 Clamped Subnormal Underflow Inexact Rounded 195clam685 apply 7E-400 -> 0E-398 Clamped Subnormal Underflow Inexact Rounded 196clam686 apply 7E-401 -> 0E-398 Clamped Subnormal Underflow Inexact Rounded 197clam687 apply 0E-399 -> 0E-398 Clamped 198clam688 apply 0E-400 -> 0E-398 Clamped 199clam689 apply 0E-401 -> 0E-398 Clamped 200 201-- example from documentation 202precision: 7 203rounding: half_even 204maxExponent: +96 205minExponent: -95 206 207clamp: 0 208clam700 apply 1.23E+96 -> 1.23E+96 209 210clamp: 1 211clam701 apply 1.23E+96 -> 1.230000E+96 Clamped 212