cpython/Lib/test/decimaltestdata/integer.decTest

152 lines
6.5 KiB
Plaintext

------------------------------------------------------------------------
-- integer.decTest -- round decimal to integer --
-- Copyright (c) IBM Corporation, 2001, 2003. 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.26
-- This set of tests tests the extended specification 'round-to-integer'
-- operation (from IEEE 854). All non-zero results are defined as
-- being those from either plus or rescale, so those are assumed to have
-- been tested.
extended: 1
precision: 9
rounding: half_up
maxExponent: 999
minExponent: -999
intx001 integer 0 -> 0
intx002 integer 0.0 -> 0
intx003 integer 0.1 -> 0 Rounded Inexact
intx004 integer 0.2 -> 0 Rounded Inexact
intx005 integer 0.3 -> 0 Rounded Inexact
intx006 integer 0.4 -> 0 Rounded Inexact
intx007 integer 0.5 -> 1 Rounded Inexact
intx008 integer 0.6 -> 1 Rounded Inexact
intx009 integer 0.7 -> 1 Rounded Inexact
intx010 integer 0.8 -> 1 Rounded Inexact
intx011 integer 0.9 -> 1 Rounded Inexact
intx012 integer 1 -> 1
intx013 integer 1.0 -> 1 Rounded
intx014 integer 1.1 -> 1 Rounded Inexact
intx015 integer 1.2 -> 1 Rounded Inexact
intx016 integer 1.3 -> 1 Rounded Inexact
intx017 integer 1.4 -> 1 Rounded Inexact
intx018 integer 1.5 -> 2 Rounded Inexact
intx019 integer 1.6 -> 2 Rounded Inexact
intx020 integer 1.7 -> 2 Rounded Inexact
intx021 integer 1.8 -> 2 Rounded Inexact
intx022 integer 1.9 -> 2 Rounded Inexact
-- negatives
intx031 integer -0 -> -0
intx032 integer -0.0 -> -0
intx033 integer -0.1 -> -0 Rounded Inexact
intx034 integer -0.2 -> -0 Rounded Inexact
intx035 integer -0.3 -> -0 Rounded Inexact
intx036 integer -0.4 -> -0 Rounded Inexact
intx037 integer -0.5 -> -1 Rounded Inexact
intx038 integer -0.6 -> -1 Rounded Inexact
intx039 integer -0.7 -> -1 Rounded Inexact
intx040 integer -0.8 -> -1 Rounded Inexact
intx041 integer -0.9 -> -1 Rounded Inexact
intx042 integer -1 -> -1
intx043 integer -1.0 -> -1 Rounded
intx044 integer -1.1 -> -1 Rounded Inexact
intx045 integer -1.2 -> -1 Rounded Inexact
intx046 integer -1.3 -> -1 Rounded Inexact
intx047 integer -1.4 -> -1 Rounded Inexact
intx048 integer -1.5 -> -2 Rounded Inexact
intx049 integer -1.6 -> -2 Rounded Inexact
intx050 integer -1.7 -> -2 Rounded Inexact
intx051 integer -1.8 -> -2 Rounded Inexact
intx052 integer -1.9 -> -2 Rounded Inexact
intx053 integer 10E+30 -> NaN Invalid_operation
intx054 integer -10E+30 -> NaN Invalid_operation
-- numbers around precision
precision: 9
intx060 integer '56267E-10' -> '0' Inexact Rounded
intx061 integer '56267E-5' -> '1' Inexact Rounded
intx062 integer '56267E-2' -> '563' Inexact Rounded
intx063 integer '56267E-1' -> '5627' Inexact Rounded
intx065 integer '56267E-0' -> '56267'
intx066 integer '56267E+0' -> '56267'
intx067 integer '56267E+1' -> '562670'
intx068 integer '56267E+2' -> '5626700'
intx069 integer '56267E+3' -> '56267000'
intx070 integer '56267E+4' -> '562670000'
intx071 integer '56267E+5' -> NaN Invalid_operation
intx072 integer '56267E+6' -> NaN Invalid_operation
intx080 integer '-56267E-10' -> '-0' Inexact Rounded
intx081 integer '-56267E-5' -> '-1' Inexact Rounded
intx082 integer '-56267E-2' -> '-563' Inexact Rounded
intx083 integer '-56267E-1' -> '-5627' Inexact Rounded
intx085 integer '-56267E-0' -> '-56267'
intx086 integer '-56267E+0' -> '-56267'
intx087 integer '-56267E+1' -> '-562670'
intx088 integer '-56267E+2' -> '-5626700'
intx089 integer '-56267E+3' -> '-56267000'
intx090 integer '-56267E+4' -> '-562670000'
intx091 integer '-56267E+5' -> NaN Invalid_operation
intx092 integer '-56267E+6' -> NaN Invalid_operation
-- specials and zeros
intx120 integer 'Inf' -> NaN Invalid_operation
intx121 integer '-Inf' -> NaN Invalid_operation
intx122 integer NaN -> NaN
intx123 integer sNaN -> NaN Invalid_operation
intx124 integer 0 -> 0
intx125 integer -0 -> -0
intx126 integer 0.000 -> 0
intx127 integer 0.00 -> 0
intx128 integer 0.0 -> 0
intx129 integer 0 -> 0
intx130 integer 0E-3 -> 0
intx131 integer 0E-2 -> 0
intx132 integer 0E-1 -> 0
intx133 integer 0E-0 -> 0
intx134 integer 0E+1 -> 0
intx135 integer 0E+2 -> 0
intx136 integer 0E+3 -> 0
intx137 integer 0E+4 -> 0
intx138 integer 0E+5 -> 0
intx139 integer -0.000 -> -0
intx140 integer -0.00 -> -0
intx141 integer -0.0 -> -0
intx142 integer -0 -> -0
intx143 integer -0E-3 -> -0
intx144 integer -0E-2 -> -0
intx145 integer -0E-1 -> -0
intx146 integer -0E-0 -> -0
intx147 integer -0E+1 -> -0
intx148 integer -0E+2 -> -0
intx149 integer -0E+3 -> -0
intx150 integer -0E+4 -> -0
intx151 integer -0E+5 -> -0
-- examples
rounding: half_up
precision: 9
intx200 integer 2.1 -> 2 Rounded Inexact
intx201 integer 100 -> 100
intx202 integer 100.0 -> 100 Rounded
intx203 integer 101.5 -> 102 Rounded Inexact
intx204 integer -101.5 -> -102 Rounded Inexact
intx205 integer 10E+5 -> 1000000