2007-09-13 15:13:15 -03:00
|
|
|
------------------------------------------------------------------------
|
|
|
|
-- ddRemainder.decTest -- decDouble remainder --
|
2008-07-27 03:39:07 -03:00
|
|
|
-- Copyright (c) IBM Corporation, 1981, 2008. All rights reserved. --
|
2007-09-13 15:13:15 -03:00
|
|
|
------------------------------------------------------------------------
|
|
|
|
-- 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 --
|
|
|
|
------------------------------------------------------------------------
|
2009-10-27 14:02:46 -03:00
|
|
|
version: 2.59
|
2007-09-13 15:13:15 -03:00
|
|
|
|
|
|
|
precision: 16
|
|
|
|
maxExponent: 384
|
|
|
|
minExponent: -383
|
|
|
|
extended: 1
|
|
|
|
clamp: 1
|
|
|
|
rounding: half_even
|
|
|
|
|
|
|
|
-- sanity checks (as base, above)
|
|
|
|
ddrem001 remainder 1 1 -> 0
|
|
|
|
ddrem002 remainder 2 1 -> 0
|
|
|
|
ddrem003 remainder 1 2 -> 1
|
|
|
|
ddrem004 remainder 2 2 -> 0
|
|
|
|
ddrem005 remainder 0 1 -> 0
|
|
|
|
ddrem006 remainder 0 2 -> 0
|
|
|
|
ddrem007 remainder 1 3 -> 1
|
|
|
|
ddrem008 remainder 2 3 -> 2
|
|
|
|
ddrem009 remainder 3 3 -> 0
|
|
|
|
|
|
|
|
ddrem010 remainder 2.4 1 -> 0.4
|
|
|
|
ddrem011 remainder 2.4 -1 -> 0.4
|
|
|
|
ddrem012 remainder -2.4 1 -> -0.4
|
|
|
|
ddrem013 remainder -2.4 -1 -> -0.4
|
|
|
|
ddrem014 remainder 2.40 1 -> 0.40
|
|
|
|
ddrem015 remainder 2.400 1 -> 0.400
|
|
|
|
ddrem016 remainder 2.4 2 -> 0.4
|
|
|
|
ddrem017 remainder 2.400 2 -> 0.400
|
|
|
|
ddrem018 remainder 2. 2 -> 0
|
|
|
|
ddrem019 remainder 20 20 -> 0
|
|
|
|
|
|
|
|
ddrem020 remainder 187 187 -> 0
|
|
|
|
ddrem021 remainder 5 2 -> 1
|
|
|
|
ddrem022 remainder 5 2.0 -> 1.0
|
|
|
|
ddrem023 remainder 5 2.000 -> 1.000
|
|
|
|
ddrem024 remainder 5 0.200 -> 0.000
|
|
|
|
ddrem025 remainder 5 0.200 -> 0.000
|
|
|
|
|
|
|
|
ddrem030 remainder 1 2 -> 1
|
|
|
|
ddrem031 remainder 1 4 -> 1
|
|
|
|
ddrem032 remainder 1 8 -> 1
|
|
|
|
|
|
|
|
ddrem033 remainder 1 16 -> 1
|
|
|
|
ddrem034 remainder 1 32 -> 1
|
|
|
|
ddrem035 remainder 1 64 -> 1
|
|
|
|
ddrem040 remainder 1 -2 -> 1
|
|
|
|
ddrem041 remainder 1 -4 -> 1
|
|
|
|
ddrem042 remainder 1 -8 -> 1
|
|
|
|
ddrem043 remainder 1 -16 -> 1
|
|
|
|
ddrem044 remainder 1 -32 -> 1
|
|
|
|
ddrem045 remainder 1 -64 -> 1
|
|
|
|
ddrem050 remainder -1 2 -> -1
|
|
|
|
ddrem051 remainder -1 4 -> -1
|
|
|
|
ddrem052 remainder -1 8 -> -1
|
|
|
|
ddrem053 remainder -1 16 -> -1
|
|
|
|
ddrem054 remainder -1 32 -> -1
|
|
|
|
ddrem055 remainder -1 64 -> -1
|
|
|
|
ddrem060 remainder -1 -2 -> -1
|
|
|
|
ddrem061 remainder -1 -4 -> -1
|
|
|
|
ddrem062 remainder -1 -8 -> -1
|
|
|
|
ddrem063 remainder -1 -16 -> -1
|
|
|
|
ddrem064 remainder -1 -32 -> -1
|
|
|
|
ddrem065 remainder -1 -64 -> -1
|
|
|
|
|
|
|
|
ddrem066 remainder 999999999 1 -> 0
|
|
|
|
ddrem067 remainder 999999999.4 1 -> 0.4
|
|
|
|
ddrem068 remainder 999999999.5 1 -> 0.5
|
|
|
|
ddrem069 remainder 999999999.9 1 -> 0.9
|
|
|
|
ddrem070 remainder 999999999.999 1 -> 0.999
|
|
|
|
ddrem071 remainder 999999.999999 1 -> 0.999999
|
|
|
|
ddrem072 remainder 9 1 -> 0
|
|
|
|
ddrem073 remainder 9999999999999999 1 -> 0
|
|
|
|
ddrem074 remainder 9999999999999999 2 -> 1
|
|
|
|
ddrem075 remainder 9999999999999999 3 -> 0
|
|
|
|
ddrem076 remainder 9999999999999999 4 -> 3
|
|
|
|
|
|
|
|
ddrem080 remainder 0. 1 -> 0
|
|
|
|
ddrem081 remainder .0 1 -> 0.0
|
|
|
|
ddrem082 remainder 0.00 1 -> 0.00
|
|
|
|
ddrem083 remainder 0.00E+9 1 -> 0
|
|
|
|
ddrem084 remainder 0.00E+3 1 -> 0
|
|
|
|
ddrem085 remainder 0.00E+2 1 -> 0
|
|
|
|
ddrem086 remainder 0.00E+1 1 -> 0.0
|
|
|
|
ddrem087 remainder 0.00E+0 1 -> 0.00
|
|
|
|
ddrem088 remainder 0.00E-0 1 -> 0.00
|
|
|
|
ddrem089 remainder 0.00E-1 1 -> 0.000
|
|
|
|
ddrem090 remainder 0.00E-2 1 -> 0.0000
|
|
|
|
ddrem091 remainder 0.00E-3 1 -> 0.00000
|
|
|
|
ddrem092 remainder 0.00E-4 1 -> 0.000000
|
|
|
|
ddrem093 remainder 0.00E-5 1 -> 0E-7
|
|
|
|
ddrem094 remainder 0.00E-6 1 -> 0E-8
|
|
|
|
ddrem095 remainder 0.0000E-50 1 -> 0E-54
|
|
|
|
|
|
|
|
-- Various flavours of remainder by 0
|
|
|
|
ddrem101 remainder 0 0 -> NaN Division_undefined
|
|
|
|
ddrem102 remainder 0 -0 -> NaN Division_undefined
|
|
|
|
ddrem103 remainder -0 0 -> NaN Division_undefined
|
|
|
|
ddrem104 remainder -0 -0 -> NaN Division_undefined
|
|
|
|
ddrem105 remainder 0.0E5 0 -> NaN Division_undefined
|
|
|
|
ddrem106 remainder 0.000 0 -> NaN Division_undefined
|
|
|
|
-- [Some think this next group should be Division_by_zero exception, but
|
|
|
|
-- IEEE 854 is explicit that it is Invalid operation .. for
|
|
|
|
-- remainder-near, anyway]
|
|
|
|
ddrem107 remainder 0.0001 0 -> NaN Invalid_operation
|
|
|
|
ddrem108 remainder 0.01 0 -> NaN Invalid_operation
|
|
|
|
ddrem109 remainder 0.1 0 -> NaN Invalid_operation
|
|
|
|
ddrem110 remainder 1 0 -> NaN Invalid_operation
|
|
|
|
ddrem111 remainder 1 0.0 -> NaN Invalid_operation
|
|
|
|
ddrem112 remainder 10 0.0 -> NaN Invalid_operation
|
|
|
|
ddrem113 remainder 1E+100 0.0 -> NaN Invalid_operation
|
|
|
|
ddrem114 remainder 1E+380 0 -> NaN Invalid_operation
|
|
|
|
ddrem115 remainder 0.0001 -0 -> NaN Invalid_operation
|
|
|
|
ddrem116 remainder 0.01 -0 -> NaN Invalid_operation
|
|
|
|
ddrem119 remainder 0.1 -0 -> NaN Invalid_operation
|
|
|
|
ddrem120 remainder 1 -0 -> NaN Invalid_operation
|
|
|
|
ddrem121 remainder 1 -0.0 -> NaN Invalid_operation
|
|
|
|
ddrem122 remainder 10 -0.0 -> NaN Invalid_operation
|
|
|
|
ddrem123 remainder 1E+100 -0.0 -> NaN Invalid_operation
|
|
|
|
ddrem124 remainder 1E+384 -0 -> NaN Invalid_operation
|
|
|
|
-- and zeros on left
|
|
|
|
ddrem130 remainder 0 1 -> 0
|
|
|
|
ddrem131 remainder 0 -1 -> 0
|
|
|
|
ddrem132 remainder 0.0 1 -> 0.0
|
|
|
|
ddrem133 remainder 0.0 -1 -> 0.0
|
|
|
|
ddrem134 remainder -0 1 -> -0
|
|
|
|
ddrem135 remainder -0 -1 -> -0
|
|
|
|
ddrem136 remainder -0.0 1 -> -0.0
|
|
|
|
ddrem137 remainder -0.0 -1 -> -0.0
|
|
|
|
|
|
|
|
-- 0.5ers
|
|
|
|
ddrem143 remainder 0.5 2 -> 0.5
|
|
|
|
ddrem144 remainder 0.5 2.1 -> 0.5
|
|
|
|
ddrem145 remainder 0.5 2.01 -> 0.50
|
|
|
|
ddrem146 remainder 0.5 2.001 -> 0.500
|
|
|
|
ddrem147 remainder 0.50 2 -> 0.50
|
|
|
|
ddrem148 remainder 0.50 2.01 -> 0.50
|
|
|
|
ddrem149 remainder 0.50 2.001 -> 0.500
|
|
|
|
|
|
|
|
-- steadies
|
|
|
|
ddrem150 remainder 1 1 -> 0
|
|
|
|
ddrem151 remainder 1 2 -> 1
|
|
|
|
ddrem152 remainder 1 3 -> 1
|
|
|
|
ddrem153 remainder 1 4 -> 1
|
|
|
|
ddrem154 remainder 1 5 -> 1
|
|
|
|
ddrem155 remainder 1 6 -> 1
|
|
|
|
ddrem156 remainder 1 7 -> 1
|
|
|
|
ddrem157 remainder 1 8 -> 1
|
|
|
|
ddrem158 remainder 1 9 -> 1
|
|
|
|
ddrem159 remainder 1 10 -> 1
|
|
|
|
ddrem160 remainder 1 1 -> 0
|
|
|
|
ddrem161 remainder 2 1 -> 0
|
|
|
|
ddrem162 remainder 3 1 -> 0
|
|
|
|
ddrem163 remainder 4 1 -> 0
|
|
|
|
ddrem164 remainder 5 1 -> 0
|
|
|
|
ddrem165 remainder 6 1 -> 0
|
|
|
|
ddrem166 remainder 7 1 -> 0
|
|
|
|
ddrem167 remainder 8 1 -> 0
|
|
|
|
ddrem168 remainder 9 1 -> 0
|
|
|
|
ddrem169 remainder 10 1 -> 0
|
|
|
|
|
|
|
|
-- some differences from remainderNear
|
|
|
|
ddrem171 remainder 0.4 1.020 -> 0.400
|
|
|
|
ddrem172 remainder 0.50 1.020 -> 0.500
|
|
|
|
ddrem173 remainder 0.51 1.020 -> 0.510
|
|
|
|
ddrem174 remainder 0.52 1.020 -> 0.520
|
|
|
|
ddrem175 remainder 0.6 1.020 -> 0.600
|
|
|
|
|
|
|
|
-- More flavours of remainder by 0
|
|
|
|
ddrem201 remainder 0 0 -> NaN Division_undefined
|
|
|
|
ddrem202 remainder 0.0E5 0 -> NaN Division_undefined
|
|
|
|
ddrem203 remainder 0.000 0 -> NaN Division_undefined
|
|
|
|
ddrem204 remainder 0.0001 0 -> NaN Invalid_operation
|
|
|
|
ddrem205 remainder 0.01 0 -> NaN Invalid_operation
|
|
|
|
ddrem206 remainder 0.1 0 -> NaN Invalid_operation
|
|
|
|
ddrem207 remainder 1 0 -> NaN Invalid_operation
|
|
|
|
ddrem208 remainder 1 0.0 -> NaN Invalid_operation
|
|
|
|
ddrem209 remainder 10 0.0 -> NaN Invalid_operation
|
|
|
|
ddrem210 remainder 1E+100 0.0 -> NaN Invalid_operation
|
|
|
|
ddrem211 remainder 1E+380 0 -> NaN Invalid_operation
|
|
|
|
|
|
|
|
-- some differences from remainderNear
|
|
|
|
ddrem231 remainder -0.4 1.020 -> -0.400
|
|
|
|
ddrem232 remainder -0.50 1.020 -> -0.500
|
|
|
|
ddrem233 remainder -0.51 1.020 -> -0.510
|
|
|
|
ddrem234 remainder -0.52 1.020 -> -0.520
|
|
|
|
ddrem235 remainder -0.6 1.020 -> -0.600
|
|
|
|
|
|
|
|
-- high Xs
|
|
|
|
ddrem240 remainder 1E+2 1.00 -> 0.00
|
|
|
|
|
|
|
|
-- ddrem3xx are from DiagBigDecimal
|
|
|
|
ddrem301 remainder 1 3 -> 1
|
|
|
|
ddrem302 remainder 5 5 -> 0
|
|
|
|
ddrem303 remainder 13 10 -> 3
|
|
|
|
ddrem304 remainder 13 50 -> 13
|
|
|
|
ddrem305 remainder 13 100 -> 13
|
|
|
|
ddrem306 remainder 13 1000 -> 13
|
|
|
|
ddrem307 remainder .13 1 -> 0.13
|
|
|
|
ddrem308 remainder 0.133 1 -> 0.133
|
|
|
|
ddrem309 remainder 0.1033 1 -> 0.1033
|
|
|
|
ddrem310 remainder 1.033 1 -> 0.033
|
|
|
|
ddrem311 remainder 10.33 1 -> 0.33
|
|
|
|
ddrem312 remainder 10.33 10 -> 0.33
|
|
|
|
ddrem313 remainder 103.3 1 -> 0.3
|
|
|
|
ddrem314 remainder 133 10 -> 3
|
|
|
|
ddrem315 remainder 1033 10 -> 3
|
|
|
|
ddrem316 remainder 1033 50 -> 33
|
|
|
|
ddrem317 remainder 101.0 3 -> 2.0
|
|
|
|
ddrem318 remainder 102.0 3 -> 0.0
|
|
|
|
ddrem319 remainder 103.0 3 -> 1.0
|
|
|
|
ddrem320 remainder 2.40 1 -> 0.40
|
|
|
|
ddrem321 remainder 2.400 1 -> 0.400
|
|
|
|
ddrem322 remainder 2.4 1 -> 0.4
|
|
|
|
ddrem323 remainder 2.4 2 -> 0.4
|
|
|
|
ddrem324 remainder 2.400 2 -> 0.400
|
|
|
|
ddrem325 remainder 1 0.3 -> 0.1
|
|
|
|
ddrem326 remainder 1 0.30 -> 0.10
|
|
|
|
ddrem327 remainder 1 0.300 -> 0.100
|
|
|
|
ddrem328 remainder 1 0.3000 -> 0.1000
|
|
|
|
ddrem329 remainder 1.0 0.3 -> 0.1
|
|
|
|
ddrem330 remainder 1.00 0.3 -> 0.10
|
|
|
|
ddrem331 remainder 1.000 0.3 -> 0.100
|
|
|
|
ddrem332 remainder 1.0000 0.3 -> 0.1000
|
|
|
|
ddrem333 remainder 0.5 2 -> 0.5
|
|
|
|
ddrem334 remainder 0.5 2.1 -> 0.5
|
|
|
|
ddrem335 remainder 0.5 2.01 -> 0.50
|
|
|
|
ddrem336 remainder 0.5 2.001 -> 0.500
|
|
|
|
ddrem337 remainder 0.50 2 -> 0.50
|
|
|
|
ddrem338 remainder 0.50 2.01 -> 0.50
|
|
|
|
ddrem339 remainder 0.50 2.001 -> 0.500
|
|
|
|
|
|
|
|
ddrem340 remainder 0.5 0.5000001 -> 0.5000000
|
|
|
|
ddrem341 remainder 0.5 0.50000001 -> 0.50000000
|
|
|
|
ddrem342 remainder 0.5 0.500000001 -> 0.500000000
|
|
|
|
ddrem343 remainder 0.5 0.5000000001 -> 0.5000000000
|
|
|
|
ddrem344 remainder 0.5 0.50000000001 -> 0.50000000000
|
|
|
|
ddrem345 remainder 0.5 0.4999999 -> 1E-7
|
|
|
|
ddrem346 remainder 0.5 0.49999999 -> 1E-8
|
|
|
|
ddrem347 remainder 0.5 0.499999999 -> 1E-9
|
|
|
|
ddrem348 remainder 0.5 0.4999999999 -> 1E-10
|
|
|
|
ddrem349 remainder 0.5 0.49999999999 -> 1E-11
|
|
|
|
ddrem350 remainder 0.5 0.499999999999 -> 1E-12
|
|
|
|
|
|
|
|
ddrem351 remainder 0.03 7 -> 0.03
|
|
|
|
ddrem352 remainder 5 2 -> 1
|
|
|
|
ddrem353 remainder 4.1 2 -> 0.1
|
|
|
|
ddrem354 remainder 4.01 2 -> 0.01
|
|
|
|
ddrem355 remainder 4.001 2 -> 0.001
|
|
|
|
ddrem356 remainder 4.0001 2 -> 0.0001
|
|
|
|
ddrem357 remainder 4.00001 2 -> 0.00001
|
|
|
|
ddrem358 remainder 4.000001 2 -> 0.000001
|
|
|
|
ddrem359 remainder 4.0000001 2 -> 1E-7
|
|
|
|
|
|
|
|
ddrem360 remainder 1.2 0.7345 -> 0.4655
|
|
|
|
ddrem361 remainder 0.8 12 -> 0.8
|
|
|
|
ddrem362 remainder 0.8 0.2 -> 0.0
|
|
|
|
ddrem363 remainder 0.8 0.3 -> 0.2
|
|
|
|
ddrem364 remainder 0.800 12 -> 0.800
|
|
|
|
ddrem365 remainder 0.800 1.7 -> 0.800
|
|
|
|
ddrem366 remainder 2.400 2 -> 0.400
|
|
|
|
|
|
|
|
ddrem371 remainder 2.400 2 -> 0.400
|
|
|
|
|
|
|
|
ddrem381 remainder 12345 1 -> 0
|
|
|
|
ddrem382 remainder 12345 1.0001 -> 0.7657
|
|
|
|
ddrem383 remainder 12345 1.001 -> 0.668
|
|
|
|
ddrem384 remainder 12345 1.01 -> 0.78
|
|
|
|
ddrem385 remainder 12345 1.1 -> 0.8
|
|
|
|
ddrem386 remainder 12355 4 -> 3
|
|
|
|
ddrem387 remainder 12345 4 -> 1
|
|
|
|
ddrem388 remainder 12355 4.0001 -> 2.6912
|
|
|
|
ddrem389 remainder 12345 4.0001 -> 0.6914
|
|
|
|
ddrem390 remainder 12345 4.9 -> 1.9
|
|
|
|
ddrem391 remainder 12345 4.99 -> 4.73
|
|
|
|
ddrem392 remainder 12345 4.999 -> 2.469
|
|
|
|
ddrem393 remainder 12345 4.9999 -> 0.2469
|
|
|
|
ddrem394 remainder 12345 5 -> 0
|
|
|
|
ddrem395 remainder 12345 5.0001 -> 4.7532
|
|
|
|
ddrem396 remainder 12345 5.001 -> 2.532
|
|
|
|
ddrem397 remainder 12345 5.01 -> 0.36
|
|
|
|
ddrem398 remainder 12345 5.1 -> 3.0
|
|
|
|
|
|
|
|
-- the nasty division-by-1 cases
|
|
|
|
ddrem401 remainder 0.5 1 -> 0.5
|
|
|
|
ddrem402 remainder 0.55 1 -> 0.55
|
|
|
|
ddrem403 remainder 0.555 1 -> 0.555
|
|
|
|
ddrem404 remainder 0.5555 1 -> 0.5555
|
|
|
|
ddrem405 remainder 0.55555 1 -> 0.55555
|
|
|
|
ddrem406 remainder 0.555555 1 -> 0.555555
|
|
|
|
ddrem407 remainder 0.5555555 1 -> 0.5555555
|
|
|
|
ddrem408 remainder 0.55555555 1 -> 0.55555555
|
|
|
|
ddrem409 remainder 0.555555555 1 -> 0.555555555
|
|
|
|
|
|
|
|
-- folddowns
|
|
|
|
ddrem421 remainder 1E+384 1 -> NaN Division_impossible
|
|
|
|
ddrem422 remainder 1E+384 1E+383 -> 0E+369 Clamped
|
|
|
|
ddrem423 remainder 1E+384 2E+383 -> 0E+369 Clamped
|
|
|
|
ddrem424 remainder 1E+384 3E+383 -> 1.00000000000000E+383 Clamped
|
|
|
|
ddrem425 remainder 1E+384 4E+383 -> 2.00000000000000E+383 Clamped
|
|
|
|
ddrem426 remainder 1E+384 5E+383 -> 0E+369 Clamped
|
|
|
|
ddrem427 remainder 1E+384 6E+383 -> 4.00000000000000E+383 Clamped
|
|
|
|
ddrem428 remainder 1E+384 7E+383 -> 3.00000000000000E+383 Clamped
|
|
|
|
ddrem429 remainder 1E+384 8E+383 -> 2.00000000000000E+383 Clamped
|
|
|
|
ddrem430 remainder 1E+384 9E+383 -> 1.00000000000000E+383 Clamped
|
|
|
|
-- tinies
|
|
|
|
ddrem431 remainder 1E-397 1E-398 -> 0E-398
|
|
|
|
ddrem432 remainder 1E-397 2E-398 -> 0E-398
|
|
|
|
ddrem433 remainder 1E-397 3E-398 -> 1E-398 Subnormal
|
|
|
|
ddrem434 remainder 1E-397 4E-398 -> 2E-398 Subnormal
|
|
|
|
ddrem435 remainder 1E-397 5E-398 -> 0E-398
|
|
|
|
ddrem436 remainder 1E-397 6E-398 -> 4E-398 Subnormal
|
|
|
|
ddrem437 remainder 1E-397 7E-398 -> 3E-398 Subnormal
|
|
|
|
ddrem438 remainder 1E-397 8E-398 -> 2E-398 Subnormal
|
|
|
|
ddrem439 remainder 1E-397 9E-398 -> 1E-398 Subnormal
|
|
|
|
ddrem440 remainder 1E-397 10E-398 -> 0E-398
|
|
|
|
ddrem441 remainder 1E-397 11E-398 -> 1.0E-397 Subnormal
|
|
|
|
ddrem442 remainder 100E-397 11E-398 -> 1.0E-397 Subnormal
|
|
|
|
ddrem443 remainder 100E-397 20E-398 -> 0E-398
|
|
|
|
ddrem444 remainder 100E-397 21E-398 -> 1.3E-397 Subnormal
|
|
|
|
ddrem445 remainder 100E-397 30E-398 -> 1.0E-397 Subnormal
|
|
|
|
|
|
|
|
-- zero signs
|
|
|
|
ddrem650 remainder 1 1 -> 0
|
|
|
|
ddrem651 remainder -1 1 -> -0
|
|
|
|
ddrem652 remainder 1 -1 -> 0
|
|
|
|
ddrem653 remainder -1 -1 -> -0
|
|
|
|
ddrem654 remainder 0 1 -> 0
|
|
|
|
ddrem655 remainder -0 1 -> -0
|
|
|
|
ddrem656 remainder 0 -1 -> 0
|
|
|
|
ddrem657 remainder -0 -1 -> -0
|
|
|
|
ddrem658 remainder 0.00 1 -> 0.00
|
|
|
|
ddrem659 remainder -0.00 1 -> -0.00
|
|
|
|
|
|
|
|
-- Specials
|
|
|
|
ddrem680 remainder Inf -Inf -> NaN Invalid_operation
|
|
|
|
ddrem681 remainder Inf -1000 -> NaN Invalid_operation
|
|
|
|
ddrem682 remainder Inf -1 -> NaN Invalid_operation
|
|
|
|
ddrem683 remainder Inf 0 -> NaN Invalid_operation
|
|
|
|
ddrem684 remainder Inf -0 -> NaN Invalid_operation
|
|
|
|
ddrem685 remainder Inf 1 -> NaN Invalid_operation
|
|
|
|
ddrem686 remainder Inf 1000 -> NaN Invalid_operation
|
|
|
|
ddrem687 remainder Inf Inf -> NaN Invalid_operation
|
|
|
|
ddrem688 remainder -1000 Inf -> -1000
|
|
|
|
ddrem689 remainder -Inf Inf -> NaN Invalid_operation
|
|
|
|
ddrem691 remainder -1 Inf -> -1
|
|
|
|
ddrem692 remainder 0 Inf -> 0
|
|
|
|
ddrem693 remainder -0 Inf -> -0
|
|
|
|
ddrem694 remainder 1 Inf -> 1
|
|
|
|
ddrem695 remainder 1000 Inf -> 1000
|
|
|
|
ddrem696 remainder Inf Inf -> NaN Invalid_operation
|
|
|
|
|
|
|
|
ddrem700 remainder -Inf -Inf -> NaN Invalid_operation
|
|
|
|
ddrem701 remainder -Inf -1000 -> NaN Invalid_operation
|
|
|
|
ddrem702 remainder -Inf -1 -> NaN Invalid_operation
|
|
|
|
ddrem703 remainder -Inf -0 -> NaN Invalid_operation
|
|
|
|
ddrem704 remainder -Inf 0 -> NaN Invalid_operation
|
|
|
|
ddrem705 remainder -Inf 1 -> NaN Invalid_operation
|
|
|
|
ddrem706 remainder -Inf 1000 -> NaN Invalid_operation
|
|
|
|
ddrem707 remainder -Inf Inf -> NaN Invalid_operation
|
|
|
|
ddrem708 remainder -Inf -Inf -> NaN Invalid_operation
|
|
|
|
ddrem709 remainder -1000 Inf -> -1000
|
|
|
|
ddrem710 remainder -1 -Inf -> -1
|
|
|
|
ddrem711 remainder -0 -Inf -> -0
|
|
|
|
ddrem712 remainder 0 -Inf -> 0
|
|
|
|
ddrem713 remainder 1 -Inf -> 1
|
|
|
|
ddrem714 remainder 1000 -Inf -> 1000
|
|
|
|
ddrem715 remainder Inf -Inf -> NaN Invalid_operation
|
|
|
|
|
|
|
|
ddrem721 remainder NaN -Inf -> NaN
|
|
|
|
ddrem722 remainder NaN -1000 -> NaN
|
|
|
|
ddrem723 remainder NaN -1 -> NaN
|
|
|
|
ddrem724 remainder NaN -0 -> NaN
|
|
|
|
ddrem725 remainder -NaN 0 -> -NaN
|
|
|
|
ddrem726 remainder NaN 1 -> NaN
|
|
|
|
ddrem727 remainder NaN 1000 -> NaN
|
|
|
|
ddrem728 remainder NaN Inf -> NaN
|
|
|
|
ddrem729 remainder NaN -NaN -> NaN
|
|
|
|
ddrem730 remainder -Inf NaN -> NaN
|
|
|
|
ddrem731 remainder -1000 NaN -> NaN
|
|
|
|
ddrem732 remainder -1 NaN -> NaN
|
|
|
|
ddrem733 remainder -0 -NaN -> -NaN
|
|
|
|
ddrem734 remainder 0 NaN -> NaN
|
|
|
|
ddrem735 remainder 1 -NaN -> -NaN
|
|
|
|
ddrem736 remainder 1000 NaN -> NaN
|
|
|
|
ddrem737 remainder Inf NaN -> NaN
|
|
|
|
|
|
|
|
ddrem741 remainder sNaN -Inf -> NaN Invalid_operation
|
|
|
|
ddrem742 remainder sNaN -1000 -> NaN Invalid_operation
|
|
|
|
ddrem743 remainder -sNaN -1 -> -NaN Invalid_operation
|
|
|
|
ddrem744 remainder sNaN -0 -> NaN Invalid_operation
|
|
|
|
ddrem745 remainder sNaN 0 -> NaN Invalid_operation
|
|
|
|
ddrem746 remainder sNaN 1 -> NaN Invalid_operation
|
|
|
|
ddrem747 remainder sNaN 1000 -> NaN Invalid_operation
|
|
|
|
ddrem749 remainder sNaN NaN -> NaN Invalid_operation
|
|
|
|
ddrem750 remainder sNaN sNaN -> NaN Invalid_operation
|
|
|
|
ddrem751 remainder NaN sNaN -> NaN Invalid_operation
|
|
|
|
ddrem752 remainder -Inf sNaN -> NaN Invalid_operation
|
|
|
|
ddrem753 remainder -1000 sNaN -> NaN Invalid_operation
|
|
|
|
ddrem754 remainder -1 sNaN -> NaN Invalid_operation
|
|
|
|
ddrem755 remainder -0 sNaN -> NaN Invalid_operation
|
|
|
|
ddrem756 remainder 0 sNaN -> NaN Invalid_operation
|
|
|
|
ddrem757 remainder 1 sNaN -> NaN Invalid_operation
|
|
|
|
ddrem758 remainder 1000 sNaN -> NaN Invalid_operation
|
|
|
|
ddrem759 remainder Inf -sNaN -> -NaN Invalid_operation
|
|
|
|
|
|
|
|
-- propaging NaNs
|
|
|
|
ddrem760 remainder NaN1 NaN7 -> NaN1
|
|
|
|
ddrem761 remainder sNaN2 NaN8 -> NaN2 Invalid_operation
|
|
|
|
ddrem762 remainder NaN3 sNaN9 -> NaN9 Invalid_operation
|
|
|
|
ddrem763 remainder sNaN4 sNaN10 -> NaN4 Invalid_operation
|
|
|
|
ddrem764 remainder 15 NaN11 -> NaN11
|
|
|
|
ddrem765 remainder NaN6 NaN12 -> NaN6
|
|
|
|
ddrem766 remainder Inf NaN13 -> NaN13
|
|
|
|
ddrem767 remainder NaN14 -Inf -> NaN14
|
|
|
|
ddrem768 remainder 0 NaN15 -> NaN15
|
|
|
|
ddrem769 remainder NaN16 -0 -> NaN16
|
|
|
|
|
|
|
|
-- edge cases of impossible
|
|
|
|
ddrem770 remainder 1234567890123456 10 -> 6
|
|
|
|
ddrem771 remainder 1234567890123456 1 -> 0
|
|
|
|
ddrem772 remainder 1234567890123456 0.1 -> NaN Division_impossible
|
|
|
|
ddrem773 remainder 1234567890123456 0.01 -> NaN Division_impossible
|
|
|
|
|
|
|
|
-- long operand checks
|
|
|
|
ddrem801 remainder 12345678000 100 -> 0
|
|
|
|
ddrem802 remainder 1 12345678000 -> 1
|
|
|
|
ddrem803 remainder 1234567800 10 -> 0
|
|
|
|
ddrem804 remainder 1 1234567800 -> 1
|
|
|
|
ddrem805 remainder 1234567890 10 -> 0
|
|
|
|
ddrem806 remainder 1 1234567890 -> 1
|
|
|
|
ddrem807 remainder 1234567891 10 -> 1
|
|
|
|
ddrem808 remainder 1 1234567891 -> 1
|
|
|
|
ddrem809 remainder 12345678901 100 -> 1
|
|
|
|
ddrem810 remainder 1 12345678901 -> 1
|
|
|
|
ddrem811 remainder 1234567896 10 -> 6
|
|
|
|
ddrem812 remainder 1 1234567896 -> 1
|
|
|
|
|
|
|
|
ddrem821 remainder 12345678000 100 -> 0
|
|
|
|
ddrem822 remainder 1 12345678000 -> 1
|
|
|
|
ddrem823 remainder 1234567800 10 -> 0
|
|
|
|
ddrem824 remainder 1 1234567800 -> 1
|
|
|
|
ddrem825 remainder 1234567890 10 -> 0
|
|
|
|
ddrem826 remainder 1 1234567890 -> 1
|
|
|
|
ddrem827 remainder 1234567891 10 -> 1
|
|
|
|
ddrem828 remainder 1 1234567891 -> 1
|
|
|
|
ddrem829 remainder 12345678901 100 -> 1
|
|
|
|
ddrem830 remainder 1 12345678901 -> 1
|
|
|
|
ddrem831 remainder 1234567896 10 -> 6
|
|
|
|
ddrem832 remainder 1 1234567896 -> 1
|
|
|
|
|
|
|
|
-- from divideint
|
|
|
|
ddrem840 remainder 100000000.0 1 -> 0.0
|
|
|
|
ddrem841 remainder 100000000.4 1 -> 0.4
|
|
|
|
ddrem842 remainder 100000000.5 1 -> 0.5
|
|
|
|
ddrem843 remainder 100000000.9 1 -> 0.9
|
|
|
|
ddrem844 remainder 100000000.999 1 -> 0.999
|
|
|
|
ddrem850 remainder 100000003 5 -> 3
|
|
|
|
ddrem851 remainder 10000003 5 -> 3
|
|
|
|
ddrem852 remainder 1000003 5 -> 3
|
|
|
|
ddrem853 remainder 100003 5 -> 3
|
|
|
|
ddrem854 remainder 10003 5 -> 3
|
|
|
|
ddrem855 remainder 1003 5 -> 3
|
|
|
|
ddrem856 remainder 103 5 -> 3
|
|
|
|
ddrem857 remainder 13 5 -> 3
|
|
|
|
ddrem858 remainder 1 5 -> 1
|
|
|
|
|
|
|
|
-- Vladimir's cases 1234567890123456
|
|
|
|
ddrem860 remainder 123.0e1 1000000000000000 -> 1230
|
|
|
|
ddrem861 remainder 1230 1000000000000000 -> 1230
|
|
|
|
ddrem862 remainder 12.3e2 1000000000000000 -> 1230
|
|
|
|
ddrem863 remainder 1.23e3 1000000000000000 -> 1230
|
|
|
|
ddrem864 remainder 123e1 1000000000000000 -> 1230
|
|
|
|
ddrem870 remainder 123e1 1000000000000000 -> 1230
|
|
|
|
ddrem871 remainder 123e1 100000000000000 -> 1230
|
|
|
|
ddrem872 remainder 123e1 10000000000000 -> 1230
|
|
|
|
ddrem873 remainder 123e1 1000000000000 -> 1230
|
|
|
|
ddrem874 remainder 123e1 100000000000 -> 1230
|
|
|
|
ddrem875 remainder 123e1 10000000000 -> 1230
|
|
|
|
ddrem876 remainder 123e1 1000000000 -> 1230
|
|
|
|
ddrem877 remainder 123e1 100000000 -> 1230
|
|
|
|
ddrem878 remainder 1230 100000000 -> 1230
|
|
|
|
ddrem879 remainder 123e1 10000000 -> 1230
|
|
|
|
ddrem880 remainder 123e1 1000000 -> 1230
|
|
|
|
ddrem881 remainder 123e1 100000 -> 1230
|
|
|
|
ddrem882 remainder 123e1 10000 -> 1230
|
|
|
|
ddrem883 remainder 123e1 1000 -> 230
|
|
|
|
ddrem884 remainder 123e1 100 -> 30
|
|
|
|
ddrem885 remainder 123e1 10 -> 0
|
|
|
|
ddrem886 remainder 123e1 1 -> 0
|
|
|
|
|
|
|
|
ddrem890 remainder 123e1 2000000000000000 -> 1230
|
|
|
|
ddrem891 remainder 123e1 200000000000000 -> 1230
|
|
|
|
ddrem892 remainder 123e1 20000000000000 -> 1230
|
|
|
|
ddrem893 remainder 123e1 2000000000000 -> 1230
|
|
|
|
ddrem894 remainder 123e1 200000000000 -> 1230
|
|
|
|
ddrem895 remainder 123e1 20000000000 -> 1230
|
|
|
|
ddrem896 remainder 123e1 2000000000 -> 1230
|
|
|
|
ddrem897 remainder 123e1 200000000 -> 1230
|
|
|
|
ddrem899 remainder 123e1 20000000 -> 1230
|
|
|
|
ddrem900 remainder 123e1 2000000 -> 1230
|
|
|
|
ddrem901 remainder 123e1 200000 -> 1230
|
|
|
|
ddrem902 remainder 123e1 20000 -> 1230
|
|
|
|
ddrem903 remainder 123e1 2000 -> 1230
|
|
|
|
ddrem904 remainder 123e1 200 -> 30
|
|
|
|
ddrem905 remainder 123e1 20 -> 10
|
|
|
|
ddrem906 remainder 123e1 2 -> 0
|
|
|
|
|
|
|
|
ddrem910 remainder 123e1 5000000000000000 -> 1230
|
|
|
|
ddrem911 remainder 123e1 500000000000000 -> 1230
|
|
|
|
ddrem912 remainder 123e1 50000000000000 -> 1230
|
|
|
|
ddrem913 remainder 123e1 5000000000000 -> 1230
|
|
|
|
ddrem914 remainder 123e1 500000000000 -> 1230
|
|
|
|
ddrem915 remainder 123e1 50000000000 -> 1230
|
|
|
|
ddrem916 remainder 123e1 5000000000 -> 1230
|
|
|
|
ddrem917 remainder 123e1 500000000 -> 1230
|
|
|
|
ddrem919 remainder 123e1 50000000 -> 1230
|
|
|
|
ddrem920 remainder 123e1 5000000 -> 1230
|
|
|
|
ddrem921 remainder 123e1 500000 -> 1230
|
|
|
|
ddrem922 remainder 123e1 50000 -> 1230
|
|
|
|
ddrem923 remainder 123e1 5000 -> 1230
|
|
|
|
ddrem924 remainder 123e1 500 -> 230
|
|
|
|
ddrem925 remainder 123e1 50 -> 30
|
|
|
|
ddrem926 remainder 123e1 5 -> 0
|
|
|
|
|
|
|
|
ddrem930 remainder 123e1 9000000000000000 -> 1230
|
|
|
|
ddrem931 remainder 123e1 900000000000000 -> 1230
|
|
|
|
ddrem932 remainder 123e1 90000000000000 -> 1230
|
|
|
|
ddrem933 remainder 123e1 9000000000000 -> 1230
|
|
|
|
ddrem934 remainder 123e1 900000000000 -> 1230
|
|
|
|
ddrem935 remainder 123e1 90000000000 -> 1230
|
|
|
|
ddrem936 remainder 123e1 9000000000 -> 1230
|
|
|
|
ddrem937 remainder 123e1 900000000 -> 1230
|
|
|
|
ddrem939 remainder 123e1 90000000 -> 1230
|
|
|
|
ddrem940 remainder 123e1 9000000 -> 1230
|
|
|
|
ddrem941 remainder 123e1 900000 -> 1230
|
|
|
|
ddrem942 remainder 123e1 90000 -> 1230
|
|
|
|
ddrem943 remainder 123e1 9000 -> 1230
|
|
|
|
ddrem944 remainder 123e1 900 -> 330
|
|
|
|
ddrem945 remainder 123e1 90 -> 60
|
|
|
|
ddrem946 remainder 123e1 9 -> 6
|
|
|
|
|
|
|
|
ddrem950 remainder 123e1 1000000000000000 -> 1230
|
|
|
|
ddrem961 remainder 123e1 2999999999999999 -> 1230
|
|
|
|
ddrem962 remainder 123e1 3999999999999999 -> 1230
|
|
|
|
ddrem963 remainder 123e1 4999999999999999 -> 1230
|
|
|
|
ddrem964 remainder 123e1 5999999999999999 -> 1230
|
|
|
|
ddrem965 remainder 123e1 6999999999999999 -> 1230
|
|
|
|
ddrem966 remainder 123e1 7999999999999999 -> 1230
|
|
|
|
ddrem967 remainder 123e1 8999999999999999 -> 1230
|
|
|
|
ddrem968 remainder 123e1 9999999999999999 -> 1230
|
|
|
|
ddrem969 remainder 123e1 9876543210987654 -> 1230
|
|
|
|
|
|
|
|
ddrem980 remainder 123e1 1000E299 -> 1.23E+3 -- 123E+1 internally
|
|
|
|
|
|
|
|
-- overflow and underflow tests [from divide]
|
|
|
|
ddrem1051 remainder 1e+277 1e-311 -> NaN Division_impossible
|
|
|
|
ddrem1052 remainder 1e+277 -1e-311 -> NaN Division_impossible
|
|
|
|
ddrem1053 remainder -1e+277 1e-311 -> NaN Division_impossible
|
|
|
|
ddrem1054 remainder -1e+277 -1e-311 -> NaN Division_impossible
|
|
|
|
ddrem1055 remainder 1e-277 1e+311 -> 1E-277
|
|
|
|
ddrem1056 remainder 1e-277 -1e+311 -> 1E-277
|
|
|
|
ddrem1057 remainder -1e-277 1e+311 -> -1E-277
|
|
|
|
ddrem1058 remainder -1e-277 -1e+311 -> -1E-277
|
|
|
|
|
2007-11-23 14:14:50 -04:00
|
|
|
-- destructive subtract
|
|
|
|
ddrem1101 remainder 1234567890123456 1.000000000000001 -> 0.765432109876546
|
|
|
|
ddrem1102 remainder 1234567890123456 1.00000000000001 -> 0.65432109876557
|
|
|
|
ddrem1103 remainder 1234567890123456 1.0000000000001 -> 0.5432109876668
|
|
|
|
ddrem1104 remainder 1234567890123455 4.000000000000001 -> 2.691358027469137
|
|
|
|
ddrem1105 remainder 1234567890123456 4.000000000000001 -> 3.691358027469137
|
|
|
|
ddrem1106 remainder 1234567890123456 4.9999999999999 -> 0.6913578024696
|
|
|
|
ddrem1107 remainder 1234567890123456 4.99999999999999 -> 3.46913578024691
|
|
|
|
ddrem1108 remainder 1234567890123456 4.999999999999999 -> 1.246913578024691
|
|
|
|
ddrem1109 remainder 1234567890123456 5.000000000000001 -> 0.753086421975309
|
|
|
|
ddrem1110 remainder 1234567890123456 5.00000000000001 -> 3.53086421975310
|
|
|
|
ddrem1111 remainder 1234567890123456 5.0000000000001 -> 1.3086421975314
|
|
|
|
|
2007-09-13 15:13:15 -03:00
|
|
|
-- Null tests
|
|
|
|
ddrem1000 remainder 10 # -> NaN Invalid_operation
|
|
|
|
ddrem1001 remainder # 10 -> NaN Invalid_operation
|
|
|
|
|