17db96d56Sopenharmony_ci------------------------------------------------------------------------ 27db96d56Sopenharmony_ci-- tointegralx.decTest -- round decimal to integral value, exact -- 37db96d56Sopenharmony_ci-- Copyright (c) IBM Corporation, 2001, 2008. All rights reserved. -- 47db96d56Sopenharmony_ci------------------------------------------------------------------------ 57db96d56Sopenharmony_ci-- Please see the document "General Decimal Arithmetic Testcases" -- 67db96d56Sopenharmony_ci-- at http://www2.hursley.ibm.com/decimal for the description of -- 77db96d56Sopenharmony_ci-- these testcases. -- 87db96d56Sopenharmony_ci-- -- 97db96d56Sopenharmony_ci-- These testcases are experimental ('beta' versions), and they -- 107db96d56Sopenharmony_ci-- may contain errors. They are offered on an as-is basis. In -- 117db96d56Sopenharmony_ci-- particular, achieving the same results as the tests here is not -- 127db96d56Sopenharmony_ci-- a guarantee that an implementation complies with any Standard -- 137db96d56Sopenharmony_ci-- or specification. The tests are not exhaustive. -- 147db96d56Sopenharmony_ci-- -- 157db96d56Sopenharmony_ci-- Please send comments, suggestions, and corrections to the author: -- 167db96d56Sopenharmony_ci-- Mike Cowlishaw, IBM Fellow -- 177db96d56Sopenharmony_ci-- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- 187db96d56Sopenharmony_ci-- mfc@uk.ibm.com -- 197db96d56Sopenharmony_ci------------------------------------------------------------------------ 207db96d56Sopenharmony_civersion: 2.59 217db96d56Sopenharmony_ci 227db96d56Sopenharmony_ci-- This set of tests tests the extended specification 'round-to-integral 237db96d56Sopenharmony_ci-- value' operation (from IEEE 854, later modified in 754r). 247db96d56Sopenharmony_ci-- All non-zero results are defined as being those from either copy or 257db96d56Sopenharmony_ci-- quantize, so those are assumed to have been tested. 267db96d56Sopenharmony_ci 277db96d56Sopenharmony_ci-- This tests toIntegraExact, which may set Inexact 287db96d56Sopenharmony_ci 297db96d56Sopenharmony_ciextended: 1 307db96d56Sopenharmony_ciprecision: 9 317db96d56Sopenharmony_cirounding: half_up 327db96d56Sopenharmony_cimaxExponent: 999 337db96d56Sopenharmony_ciminExponent: -999 347db96d56Sopenharmony_ci 357db96d56Sopenharmony_ciintxx001 tointegralx 0 -> 0 367db96d56Sopenharmony_ciintxx002 tointegralx 0.0 -> 0 377db96d56Sopenharmony_ciintxx003 tointegralx 0.1 -> 0 Inexact Rounded 387db96d56Sopenharmony_ciintxx004 tointegralx 0.2 -> 0 Inexact Rounded 397db96d56Sopenharmony_ciintxx005 tointegralx 0.3 -> 0 Inexact Rounded 407db96d56Sopenharmony_ciintxx006 tointegralx 0.4 -> 0 Inexact Rounded 417db96d56Sopenharmony_ciintxx007 tointegralx 0.5 -> 1 Inexact Rounded 427db96d56Sopenharmony_ciintxx008 tointegralx 0.6 -> 1 Inexact Rounded 437db96d56Sopenharmony_ciintxx009 tointegralx 0.7 -> 1 Inexact Rounded 447db96d56Sopenharmony_ciintxx010 tointegralx 0.8 -> 1 Inexact Rounded 457db96d56Sopenharmony_ciintxx011 tointegralx 0.9 -> 1 Inexact Rounded 467db96d56Sopenharmony_ciintxx012 tointegralx 1 -> 1 477db96d56Sopenharmony_ciintxx013 tointegralx 1.0 -> 1 Rounded 487db96d56Sopenharmony_ciintxx014 tointegralx 1.1 -> 1 Inexact Rounded 497db96d56Sopenharmony_ciintxx015 tointegralx 1.2 -> 1 Inexact Rounded 507db96d56Sopenharmony_ciintxx016 tointegralx 1.3 -> 1 Inexact Rounded 517db96d56Sopenharmony_ciintxx017 tointegralx 1.4 -> 1 Inexact Rounded 527db96d56Sopenharmony_ciintxx018 tointegralx 1.5 -> 2 Inexact Rounded 537db96d56Sopenharmony_ciintxx019 tointegralx 1.6 -> 2 Inexact Rounded 547db96d56Sopenharmony_ciintxx020 tointegralx 1.7 -> 2 Inexact Rounded 557db96d56Sopenharmony_ciintxx021 tointegralx 1.8 -> 2 Inexact Rounded 567db96d56Sopenharmony_ciintxx022 tointegralx 1.9 -> 2 Inexact Rounded 577db96d56Sopenharmony_ci-- negatives 587db96d56Sopenharmony_ciintxx031 tointegralx -0 -> -0 597db96d56Sopenharmony_ciintxx032 tointegralx -0.0 -> -0 607db96d56Sopenharmony_ciintxx033 tointegralx -0.1 -> -0 Inexact Rounded 617db96d56Sopenharmony_ciintxx034 tointegralx -0.2 -> -0 Inexact Rounded 627db96d56Sopenharmony_ciintxx035 tointegralx -0.3 -> -0 Inexact Rounded 637db96d56Sopenharmony_ciintxx036 tointegralx -0.4 -> -0 Inexact Rounded 647db96d56Sopenharmony_ciintxx037 tointegralx -0.5 -> -1 Inexact Rounded 657db96d56Sopenharmony_ciintxx038 tointegralx -0.6 -> -1 Inexact Rounded 667db96d56Sopenharmony_ciintxx039 tointegralx -0.7 -> -1 Inexact Rounded 677db96d56Sopenharmony_ciintxx040 tointegralx -0.8 -> -1 Inexact Rounded 687db96d56Sopenharmony_ciintxx041 tointegralx -0.9 -> -1 Inexact Rounded 697db96d56Sopenharmony_ciintxx042 tointegralx -1 -> -1 707db96d56Sopenharmony_ciintxx043 tointegralx -1.0 -> -1 Rounded 717db96d56Sopenharmony_ciintxx044 tointegralx -1.1 -> -1 Inexact Rounded 727db96d56Sopenharmony_ciintxx045 tointegralx -1.2 -> -1 Inexact Rounded 737db96d56Sopenharmony_ciintxx046 tointegralx -1.3 -> -1 Inexact Rounded 747db96d56Sopenharmony_ciintxx047 tointegralx -1.4 -> -1 Inexact Rounded 757db96d56Sopenharmony_ciintxx048 tointegralx -1.5 -> -2 Inexact Rounded 767db96d56Sopenharmony_ciintxx049 tointegralx -1.6 -> -2 Inexact Rounded 777db96d56Sopenharmony_ciintxx050 tointegralx -1.7 -> -2 Inexact Rounded 787db96d56Sopenharmony_ciintxx051 tointegralx -1.8 -> -2 Inexact Rounded 797db96d56Sopenharmony_ciintxx052 tointegralx -1.9 -> -2 Inexact Rounded 807db96d56Sopenharmony_ci-- next two would be NaN using quantize(x, 0) 817db96d56Sopenharmony_ciintxx053 tointegralx 10E+30 -> 1.0E+31 827db96d56Sopenharmony_ciintxx054 tointegralx -10E+30 -> -1.0E+31 837db96d56Sopenharmony_ci 847db96d56Sopenharmony_ci-- numbers around precision 857db96d56Sopenharmony_ciprecision: 9 867db96d56Sopenharmony_ciintxx060 tointegralx '56267E-10' -> '0' Inexact Rounded 877db96d56Sopenharmony_ciintxx061 tointegralx '56267E-5' -> '1' Inexact Rounded 887db96d56Sopenharmony_ciintxx062 tointegralx '56267E-2' -> '563' Inexact Rounded 897db96d56Sopenharmony_ciintxx063 tointegralx '56267E-1' -> '5627' Inexact Rounded 907db96d56Sopenharmony_ciintxx065 tointegralx '56267E-0' -> '56267' 917db96d56Sopenharmony_ciintxx066 tointegralx '56267E+0' -> '56267' 927db96d56Sopenharmony_ciintxx067 tointegralx '56267E+1' -> '5.6267E+5' 937db96d56Sopenharmony_ciintxx068 tointegralx '56267E+2' -> '5.6267E+6' 947db96d56Sopenharmony_ciintxx069 tointegralx '56267E+3' -> '5.6267E+7' 957db96d56Sopenharmony_ciintxx070 tointegralx '56267E+4' -> '5.6267E+8' 967db96d56Sopenharmony_ciintxx071 tointegralx '56267E+5' -> '5.6267E+9' 977db96d56Sopenharmony_ciintxx072 tointegralx '56267E+6' -> '5.6267E+10' 987db96d56Sopenharmony_ciintxx073 tointegralx '1.23E+96' -> '1.23E+96' 997db96d56Sopenharmony_ciintxx074 tointegralx '1.23E+384' -> '1.23E+384' 1007db96d56Sopenharmony_ciintxx075 tointegralx '1.23E+999' -> '1.23E+999' 1017db96d56Sopenharmony_ci 1027db96d56Sopenharmony_ciintxx080 tointegralx '-56267E-10' -> '-0' Inexact Rounded 1037db96d56Sopenharmony_ciintxx081 tointegralx '-56267E-5' -> '-1' Inexact Rounded 1047db96d56Sopenharmony_ciintxx082 tointegralx '-56267E-2' -> '-563' Inexact Rounded 1057db96d56Sopenharmony_ciintxx083 tointegralx '-56267E-1' -> '-5627' Inexact Rounded 1067db96d56Sopenharmony_ciintxx085 tointegralx '-56267E-0' -> '-56267' 1077db96d56Sopenharmony_ciintxx086 tointegralx '-56267E+0' -> '-56267' 1087db96d56Sopenharmony_ciintxx087 tointegralx '-56267E+1' -> '-5.6267E+5' 1097db96d56Sopenharmony_ciintxx088 tointegralx '-56267E+2' -> '-5.6267E+6' 1107db96d56Sopenharmony_ciintxx089 tointegralx '-56267E+3' -> '-5.6267E+7' 1117db96d56Sopenharmony_ciintxx090 tointegralx '-56267E+4' -> '-5.6267E+8' 1127db96d56Sopenharmony_ciintxx091 tointegralx '-56267E+5' -> '-5.6267E+9' 1137db96d56Sopenharmony_ciintxx092 tointegralx '-56267E+6' -> '-5.6267E+10' 1147db96d56Sopenharmony_ciintxx093 tointegralx '-1.23E+96' -> '-1.23E+96' 1157db96d56Sopenharmony_ciintxx094 tointegralx '-1.23E+384' -> '-1.23E+384' 1167db96d56Sopenharmony_ciintxx095 tointegralx '-1.23E+999' -> '-1.23E+999' 1177db96d56Sopenharmony_ci 1187db96d56Sopenharmony_ci-- subnormal inputs 1197db96d56Sopenharmony_ciintxx100 tointegralx 1E-999 -> 0 Inexact Rounded 1207db96d56Sopenharmony_ciintxx101 tointegralx 0.1E-999 -> 0 Inexact Rounded 1217db96d56Sopenharmony_ciintxx102 tointegralx 0.01E-999 -> 0 Inexact Rounded 1227db96d56Sopenharmony_ciintxx103 tointegralx 0E-999 -> 0 1237db96d56Sopenharmony_ci 1247db96d56Sopenharmony_ci-- specials and zeros 1257db96d56Sopenharmony_ciintxx120 tointegralx 'Inf' -> Infinity 1267db96d56Sopenharmony_ciintxx121 tointegralx '-Inf' -> -Infinity 1277db96d56Sopenharmony_ciintxx122 tointegralx NaN -> NaN 1287db96d56Sopenharmony_ciintxx123 tointegralx sNaN -> NaN Invalid_operation 1297db96d56Sopenharmony_ciintxx124 tointegralx 0 -> 0 1307db96d56Sopenharmony_ciintxx125 tointegralx -0 -> -0 1317db96d56Sopenharmony_ciintxx126 tointegralx 0.000 -> 0 1327db96d56Sopenharmony_ciintxx127 tointegralx 0.00 -> 0 1337db96d56Sopenharmony_ciintxx128 tointegralx 0.0 -> 0 1347db96d56Sopenharmony_ciintxx129 tointegralx 0 -> 0 1357db96d56Sopenharmony_ciintxx130 tointegralx 0E-3 -> 0 1367db96d56Sopenharmony_ciintxx131 tointegralx 0E-2 -> 0 1377db96d56Sopenharmony_ciintxx132 tointegralx 0E-1 -> 0 1387db96d56Sopenharmony_ciintxx133 tointegralx 0E-0 -> 0 1397db96d56Sopenharmony_ciintxx134 tointegralx 0E+1 -> 0E+1 1407db96d56Sopenharmony_ciintxx135 tointegralx 0E+2 -> 0E+2 1417db96d56Sopenharmony_ciintxx136 tointegralx 0E+3 -> 0E+3 1427db96d56Sopenharmony_ciintxx137 tointegralx 0E+4 -> 0E+4 1437db96d56Sopenharmony_ciintxx138 tointegralx 0E+5 -> 0E+5 1447db96d56Sopenharmony_ciintxx139 tointegralx -0.000 -> -0 1457db96d56Sopenharmony_ciintxx140 tointegralx -0.00 -> -0 1467db96d56Sopenharmony_ciintxx141 tointegralx -0.0 -> -0 1477db96d56Sopenharmony_ciintxx142 tointegralx -0 -> -0 1487db96d56Sopenharmony_ciintxx143 tointegralx -0E-3 -> -0 1497db96d56Sopenharmony_ciintxx144 tointegralx -0E-2 -> -0 1507db96d56Sopenharmony_ciintxx145 tointegralx -0E-1 -> -0 1517db96d56Sopenharmony_ciintxx146 tointegralx -0E-0 -> -0 1527db96d56Sopenharmony_ciintxx147 tointegralx -0E+1 -> -0E+1 1537db96d56Sopenharmony_ciintxx148 tointegralx -0E+2 -> -0E+2 1547db96d56Sopenharmony_ciintxx149 tointegralx -0E+3 -> -0E+3 1557db96d56Sopenharmony_ciintxx150 tointegralx -0E+4 -> -0E+4 1567db96d56Sopenharmony_ciintxx151 tointegralx -0E+5 -> -0E+5 1577db96d56Sopenharmony_ci-- propagating NaNs 1587db96d56Sopenharmony_ciintxx152 tointegralx NaN808 -> NaN808 1597db96d56Sopenharmony_ciintxx153 tointegralx sNaN080 -> NaN80 Invalid_operation 1607db96d56Sopenharmony_ciintxx154 tointegralx -NaN808 -> -NaN808 1617db96d56Sopenharmony_ciintxx155 tointegralx -sNaN080 -> -NaN80 Invalid_operation 1627db96d56Sopenharmony_ciintxx156 tointegralx -NaN -> -NaN 1637db96d56Sopenharmony_ciintxx157 tointegralx -sNaN -> -NaN Invalid_operation 1647db96d56Sopenharmony_ci 1657db96d56Sopenharmony_ci-- examples 1667db96d56Sopenharmony_cirounding: half_up 1677db96d56Sopenharmony_ciprecision: 9 1687db96d56Sopenharmony_ciintxx200 tointegralx 2.1 -> 2 Inexact Rounded 1697db96d56Sopenharmony_ciintxx201 tointegralx 100 -> 100 1707db96d56Sopenharmony_ciintxx202 tointegralx 100.0 -> 100 Rounded 1717db96d56Sopenharmony_ciintxx203 tointegralx 101.5 -> 102 Inexact Rounded 1727db96d56Sopenharmony_ciintxx204 tointegralx -101.5 -> -102 Inexact Rounded 1737db96d56Sopenharmony_ciintxx205 tointegralx 10E+5 -> 1.0E+6 1747db96d56Sopenharmony_ciintxx206 tointegralx 7.89E+77 -> 7.89E+77 1757db96d56Sopenharmony_ciintxx207 tointegralx -Inf -> -Infinity 1767db96d56Sopenharmony_ci 1777db96d56Sopenharmony_ci 1787db96d56Sopenharmony_ci-- all rounding modes 1797db96d56Sopenharmony_cirounding: half_even 1807db96d56Sopenharmony_ci 1817db96d56Sopenharmony_ciintxx210 tointegralx 55.5 -> 56 Inexact Rounded 1827db96d56Sopenharmony_ciintxx211 tointegralx 56.5 -> 56 Inexact Rounded 1837db96d56Sopenharmony_ciintxx212 tointegralx 57.5 -> 58 Inexact Rounded 1847db96d56Sopenharmony_ciintxx213 tointegralx -55.5 -> -56 Inexact Rounded 1857db96d56Sopenharmony_ciintxx214 tointegralx -56.5 -> -56 Inexact Rounded 1867db96d56Sopenharmony_ciintxx215 tointegralx -57.5 -> -58 Inexact Rounded 1877db96d56Sopenharmony_ci 1887db96d56Sopenharmony_cirounding: half_up 1897db96d56Sopenharmony_ci 1907db96d56Sopenharmony_ciintxx220 tointegralx 55.5 -> 56 Inexact Rounded 1917db96d56Sopenharmony_ciintxx221 tointegralx 56.5 -> 57 Inexact Rounded 1927db96d56Sopenharmony_ciintxx222 tointegralx 57.5 -> 58 Inexact Rounded 1937db96d56Sopenharmony_ciintxx223 tointegralx -55.5 -> -56 Inexact Rounded 1947db96d56Sopenharmony_ciintxx224 tointegralx -56.5 -> -57 Inexact Rounded 1957db96d56Sopenharmony_ciintxx225 tointegralx -57.5 -> -58 Inexact Rounded 1967db96d56Sopenharmony_ci 1977db96d56Sopenharmony_cirounding: half_down 1987db96d56Sopenharmony_ci 1997db96d56Sopenharmony_ciintxx230 tointegralx 55.5 -> 55 Inexact Rounded 2007db96d56Sopenharmony_ciintxx231 tointegralx 56.5 -> 56 Inexact Rounded 2017db96d56Sopenharmony_ciintxx232 tointegralx 57.5 -> 57 Inexact Rounded 2027db96d56Sopenharmony_ciintxx233 tointegralx -55.5 -> -55 Inexact Rounded 2037db96d56Sopenharmony_ciintxx234 tointegralx -56.5 -> -56 Inexact Rounded 2047db96d56Sopenharmony_ciintxx235 tointegralx -57.5 -> -57 Inexact Rounded 2057db96d56Sopenharmony_ci 2067db96d56Sopenharmony_cirounding: up 2077db96d56Sopenharmony_ci 2087db96d56Sopenharmony_ciintxx240 tointegralx 55.3 -> 56 Inexact Rounded 2097db96d56Sopenharmony_ciintxx241 tointegralx 56.3 -> 57 Inexact Rounded 2107db96d56Sopenharmony_ciintxx242 tointegralx 57.3 -> 58 Inexact Rounded 2117db96d56Sopenharmony_ciintxx243 tointegralx -55.3 -> -56 Inexact Rounded 2127db96d56Sopenharmony_ciintxx244 tointegralx -56.3 -> -57 Inexact Rounded 2137db96d56Sopenharmony_ciintxx245 tointegralx -57.3 -> -58 Inexact Rounded 2147db96d56Sopenharmony_ci 2157db96d56Sopenharmony_cirounding: down 2167db96d56Sopenharmony_ci 2177db96d56Sopenharmony_ciintxx250 tointegralx 55.7 -> 55 Inexact Rounded 2187db96d56Sopenharmony_ciintxx251 tointegralx 56.7 -> 56 Inexact Rounded 2197db96d56Sopenharmony_ciintxx252 tointegralx 57.7 -> 57 Inexact Rounded 2207db96d56Sopenharmony_ciintxx253 tointegralx -55.7 -> -55 Inexact Rounded 2217db96d56Sopenharmony_ciintxx254 tointegralx -56.7 -> -56 Inexact Rounded 2227db96d56Sopenharmony_ciintxx255 tointegralx -57.7 -> -57 Inexact Rounded 2237db96d56Sopenharmony_ci 2247db96d56Sopenharmony_cirounding: ceiling 2257db96d56Sopenharmony_ci 2267db96d56Sopenharmony_ciintxx260 tointegralx 55.3 -> 56 Inexact Rounded 2277db96d56Sopenharmony_ciintxx261 tointegralx 56.3 -> 57 Inexact Rounded 2287db96d56Sopenharmony_ciintxx262 tointegralx 57.3 -> 58 Inexact Rounded 2297db96d56Sopenharmony_ciintxx263 tointegralx -55.3 -> -55 Inexact Rounded 2307db96d56Sopenharmony_ciintxx264 tointegralx -56.3 -> -56 Inexact Rounded 2317db96d56Sopenharmony_ciintxx265 tointegralx -57.3 -> -57 Inexact Rounded 2327db96d56Sopenharmony_ci 2337db96d56Sopenharmony_cirounding: floor 2347db96d56Sopenharmony_ci 2357db96d56Sopenharmony_ciintxx270 tointegralx 55.7 -> 55 Inexact Rounded 2367db96d56Sopenharmony_ciintxx271 tointegralx 56.7 -> 56 Inexact Rounded 2377db96d56Sopenharmony_ciintxx272 tointegralx 57.7 -> 57 Inexact Rounded 2387db96d56Sopenharmony_ciintxx273 tointegralx -55.7 -> -56 Inexact Rounded 2397db96d56Sopenharmony_ciintxx274 tointegralx -56.7 -> -57 Inexact Rounded 2407db96d56Sopenharmony_ciintxx275 tointegralx -57.7 -> -58 Inexact Rounded 2417db96d56Sopenharmony_ci 2427db96d56Sopenharmony_ci-- Int and uInt32 edge values for testing conversions 2437db96d56Sopenharmony_ciprecision: 16 2447db96d56Sopenharmony_ciintxx300 tointegralx -2147483646 -> -2147483646 2457db96d56Sopenharmony_ciintxx301 tointegralx -2147483647 -> -2147483647 2467db96d56Sopenharmony_ciintxx302 tointegralx -2147483648 -> -2147483648 2477db96d56Sopenharmony_ciintxx303 tointegralx -2147483649 -> -2147483649 2487db96d56Sopenharmony_ciintxx304 tointegralx 2147483646 -> 2147483646 2497db96d56Sopenharmony_ciintxx305 tointegralx 2147483647 -> 2147483647 2507db96d56Sopenharmony_ciintxx306 tointegralx 2147483648 -> 2147483648 2517db96d56Sopenharmony_ciintxx307 tointegralx 2147483649 -> 2147483649 2527db96d56Sopenharmony_ciintxx308 tointegralx 4294967294 -> 4294967294 2537db96d56Sopenharmony_ciintxx309 tointegralx 4294967295 -> 4294967295 2547db96d56Sopenharmony_ciintxx310 tointegralx 4294967296 -> 4294967296 2557db96d56Sopenharmony_ciintxx311 tointegralx 4294967297 -> 4294967297 256