Repository URL to install this package:
------------------------------------------------------------------------
-- ddFMA.decTest -- decDouble Fused Multiply Add --
-- 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.59
precision: 16
maxExponent: 384
minExponent: -383
extended: 1
clamp: 1
rounding: half_even
-- These tests comprise three parts:
-- 1. Sanity checks and other three-operand tests (especially those
-- where the fused operation makes a difference)
-- 2. Multiply tests (third operand is neutral zero [0E+emax])
-- 3. Addition tests (first operand is 1)
-- The multiply and addition tests are extensive because FMA may have
-- its own dedicated multiplication or addition routine(s), and they
-- also inherently check the left-to-right properties.
-- Sanity checks
ddfma0001 fma 1 1 1 -> 2
ddfma0002 fma 1 1 2 -> 3
ddfma0003 fma 2 2 3 -> 7
ddfma0004 fma 9 9 9 -> 90
ddfma0005 fma -1 1 1 -> 0
ddfma0006 fma -1 1 2 -> 1
ddfma0007 fma -2 2 3 -> -1
ddfma0008 fma -9 9 9 -> -72
ddfma0011 fma 1 -1 1 -> 0
ddfma0012 fma 1 -1 2 -> 1
ddfma0013 fma 2 -2 3 -> -1
ddfma0014 fma 9 -9 9 -> -72
ddfma0015 fma 1 1 -1 -> 0
ddfma0016 fma 1 1 -2 -> -1
ddfma0017 fma 2 2 -3 -> 1
ddfma0018 fma 9 9 -9 -> 72
-- non-integer exacts
ddfma0100 fma 25.2 63.6 -438 -> 1164.72
ddfma0101 fma 0.301 0.380 334 -> 334.114380
ddfma0102 fma 49.2 -4.8 23.3 -> -212.86
ddfma0103 fma 4.22 0.079 -94.6 -> -94.26662
ddfma0104 fma 903 0.797 0.887 -> 720.578
ddfma0105 fma 6.13 -161 65.9 -> -921.03
ddfma0106 fma 28.2 727 5.45 -> 20506.85
ddfma0107 fma 4 605 688 -> 3108
ddfma0108 fma 93.3 0.19 0.226 -> 17.953
ddfma0109 fma 0.169 -341 5.61 -> -52.019
ddfma0110 fma -72.2 30 -51.2 -> -2217.2
ddfma0111 fma -0.409 13 20.4 -> 15.083
ddfma0112 fma 317 77.0 19.0 -> 24428.0
ddfma0113 fma 47 6.58 1.62 -> 310.88
ddfma0114 fma 1.36 0.984 0.493 -> 1.83124
ddfma0115 fma 72.7 274 1.56 -> 19921.36
ddfma0116 fma 335 847 83 -> 283828
ddfma0117 fma 666 0.247 25.4 -> 189.902
ddfma0118 fma -3.87 3.06 78.0 -> 66.1578
ddfma0119 fma 0.742 192 35.6 -> 178.064
ddfma0120 fma -91.6 5.29 0.153 -> -484.411
-- cases where result is different from separate multiply + add; each
-- is preceded by the result of unfused multiply and add
-- [this is about 20% of all similar cases in general]
-- -> 7.123356429257969E+16
ddfma0201 fma 27583489.6645 2582471078.04 2593183.42371 -> 7.123356429257970E+16 Inexact Rounded
-- -> 22813275328.80506
ddfma0208 fma 24280.355566 939577.397653 2032.013252 -> 22813275328.80507 Inexact Rounded
-- -> -2.030397734278062E+16
ddfma0209 fma 7848976432 -2586831.2281 137903.517909 -> -2.030397734278061E+16 Inexact Rounded
-- -> 2040774094814.077
ddfma0217 fma 56890.388731 35872030.4255 339337.123410 -> 2040774094814.078 Inexact Rounded
-- -> 2.714469575205049E+18
ddfma0220 fma 7533543.57445 360317763928 5073392.31638 -> 2.714469575205050E+18 Inexact Rounded
-- -> 1.011676297716716E+19
ddfma0223 fma 739945255.563 13672312784.1 -994381.53572 -> 1.011676297716715E+19 Inexact Rounded
-- -> -2.914135721455315E+23
ddfma0224 fma -413510957218 704729988550 9234162614.0 -> -2.914135721455314E+23 Inexact Rounded
-- -> 2.620119863365786E+17
ddfma0226 fma 437484.00601 598906432790 894450638.442 -> 2.620119863365787E+17 Inexact Rounded
-- -> 1.272647995808178E+19
ddfma0253 fma 73287556929 173651305.784 -358312568.389 -> 1.272647995808177E+19 Inexact Rounded
-- -> -1.753769320861851E+18
ddfma0257 fma 203258304486 -8628278.8066 153127.446727 -> -1.753769320861850E+18 Inexact Rounded
-- -> -1.550737835263346E+17
ddfma0260 fma 42560533.1774 -3643605282.86 178277.96377 -> -1.550737835263347E+17 Inexact Rounded
-- -> 2.897624620576005E+22
ddfma0269 fma 142656587375 203118879670 604576103991 -> 2.897624620576004E+22 Inexact Rounded
-- Cases where multiply would overflow or underflow if separate
fma0300 fma 9e+384 10 0 -> Infinity Overflow Inexact Rounded
fma0301 fma 1e+384 10 0 -> Infinity Overflow Inexact Rounded
fma0302 fma 1e+384 10 -1e+384 -> 9.000000000000000E+384 Clamped
fma0303 fma 1e+384 10 -9e+384 -> 1.000000000000000E+384 Clamped
-- subnormal etc.
fma0305 fma 1e-398 0.1 0 -> 0E-398 Underflow Subnormal Inexact Rounded Clamped
fma0306 fma 1e-398 0.1 1 -> 1.000000000000000 Inexact Rounded
fma0307 fma 1e-398 0.1 1e-398 -> 1E-398 Underflow Subnormal Inexact Rounded
-- Infinite combinations
ddfma0800 fma Inf Inf Inf -> Infinity
ddfma0801 fma Inf Inf -Inf -> NaN Invalid_operation
ddfma0802 fma Inf -Inf Inf -> NaN Invalid_operation
ddfma0803 fma Inf -Inf -Inf -> -Infinity
ddfma0804 fma -Inf Inf Inf -> NaN Invalid_operation
ddfma0805 fma -Inf Inf -Inf -> -Infinity
ddfma0806 fma -Inf -Inf Inf -> Infinity
ddfma0807 fma -Inf -Inf -Inf -> NaN Invalid_operation
-- Triple NaN propagation
ddfma0900 fma NaN2 NaN3 NaN5 -> NaN2
ddfma0901 fma 0 NaN3 NaN5 -> NaN3
ddfma0902 fma 0 0 NaN5 -> NaN5
-- first sNaN wins (consider qNaN from earlier sNaN being
-- overridden by an sNaN in third operand)
ddfma0903 fma sNaN1 sNaN2 sNaN3 -> NaN1 Invalid_operation
ddfma0904 fma 0 sNaN2 sNaN3 -> NaN2 Invalid_operation
ddfma0905 fma 0 0 sNaN3 -> NaN3 Invalid_operation
ddfma0906 fma sNaN1 sNaN2 sNaN3 -> NaN1 Invalid_operation
ddfma0907 fma NaN7 sNaN2 sNaN3 -> NaN2 Invalid_operation
ddfma0908 fma NaN7 NaN5 sNaN3 -> NaN3 Invalid_operation
-- MULTIPLICATION TESTS ------------------------------------------------
-- sanity checks
ddfma2000 fma 2 2 0e+384 -> 4
ddfma2001 fma 2 3 0e+384 -> 6
ddfma2002 fma 5 1 0e+384 -> 5
ddfma2003 fma 5 2 0e+384 -> 10
ddfma2004 fma 1.20 2 0e+384 -> 2.40
ddfma2005 fma 1.20 0 0e+384 -> 0.00
ddfma2006 fma 1.20 -2 0e+384 -> -2.40
ddfma2007 fma -1.20 2 0e+384 -> -2.40
ddfma2008 fma -1.20 0 0e+384 -> 0.00
ddfma2009 fma -1.20 -2 0e+384 -> 2.40
ddfma2010 fma 5.09 7.1 0e+384 -> 36.139
ddfma2011 fma 2.5 4 0e+384 -> 10.0
ddfma2012 fma 2.50 4 0e+384 -> 10.00
ddfma2013 fma 1.23456789 1.00000000 0e+384 -> 1.234567890000000 Rounded
ddfma2015 fma 2.50 4 0e+384 -> 10.00
ddfma2016 fma 9.999999999 9.999999999 0e+384 -> 99.99999998000000 Inexact Rounded
ddfma2017 fma 9.999999999 -9.999999999 0e+384 -> -99.99999998000000 Inexact Rounded
ddfma2018 fma -9.999999999 9.999999999 0e+384 -> -99.99999998000000 Inexact Rounded
ddfma2019 fma -9.999999999 -9.999999999 0e+384 -> 99.99999998000000 Inexact Rounded
-- zeros, etc.
ddfma2021 fma 0 0 0e+384 -> 0
ddfma2022 fma 0 -0 0e+384 -> 0
ddfma2023 fma -0 0 0e+384 -> 0
ddfma2024 fma -0 -0 0e+384 -> 0
ddfma2025 fma -0.0 -0.0 0e+384 -> 0.00
ddfma2026 fma -0.0 -0.0 0e+384 -> 0.00
ddfma2027 fma -0.0 -0.0 0e+384 -> 0.00
ddfma2028 fma -0.0 -0.0 0e+384 -> 0.00
ddfma2030 fma 5.00 1E-3 0e+384 -> 0.00500
ddfma2031 fma 00.00 0.000 0e+384 -> 0.00000
ddfma2032 fma 00.00 0E-3 0e+384 -> 0.00000 -- rhs is 0
ddfma2033 fma 0E-3 00.00 0e+384 -> 0.00000 -- lhs is 0
ddfma2034 fma -5.00 1E-3 0e+384 -> -0.00500
ddfma2035 fma -00.00 0.000 0e+384 -> 0.00000
ddfma2036 fma -00.00 0E-3 0e+384 -> 0.00000 -- rhs is 0
ddfma2037 fma -0E-3 00.00 0e+384 -> 0.00000 -- lhs is 0
ddfma2038 fma 5.00 -1E-3 0e+384 -> -0.00500
ddfma2039 fma 00.00 -0.000 0e+384 -> 0.00000
ddfma2040 fma 00.00 -0E-3 0e+384 -> 0.00000 -- rhs is 0
ddfma2041 fma 0E-3 -00.00 0e+384 -> 0.00000 -- lhs is 0
ddfma2042 fma -5.00 -1E-3 0e+384 -> 0.00500
ddfma2043 fma -00.00 -0.000 0e+384 -> 0.00000
ddfma2044 fma -00.00 -0E-3 0e+384 -> 0.00000 -- rhs is 0
ddfma2045 fma -0E-3 -00.00 -0e+384 -> 0.00000 -- lhs is 0
ddfma2046 fma -0E-3 00.00 -0e+384 -> -0.00000
ddfma2047 fma 0E-3 -00.00 -0e+384 -> -0.00000
ddfma2048 fma 0E-3 00.00 -0e+384 -> 0.00000
-- examples from decarith
ddfma2050 fma 1.20 3 0e+384 -> 3.60
ddfma2051 fma 7 3 0e+384 -> 21
ddfma2052 fma 0.9 0.8 0e+384 -> 0.72
ddfma2053 fma 0.9 -0 0e+384 -> 0.0
ddfma2054 fma 654321 654321 0e+384 -> 428135971041
ddfma2060 fma 123.45 1e7 0e+384 -> 1.2345E+9
ddfma2061 fma 123.45 1e8 0e+384 -> 1.2345E+10
ddfma2062 fma 123.45 1e+9 0e+384 -> 1.2345E+11
ddfma2063 fma 123.45 1e10 0e+384 -> 1.2345E+12
ddfma2064 fma 123.45 1e11 0e+384 -> 1.2345E+13
ddfma2065 fma 123.45 1e12 0e+384 -> 1.2345E+14
ddfma2066 fma 123.45 1e13 0e+384 -> 1.2345E+15
-- test some intermediate lengths
-- 1234567890123456
ddfma2080 fma 0.1 1230123456456789 0e+384 -> 123012345645678.9
ddfma2084 fma 0.1 1230123456456789 0e+384 -> 123012345645678.9
ddfma2090 fma 1230123456456789 0.1 0e+384 -> 123012345645678.9
ddfma2094 fma 1230123456456789 0.1 0e+384 -> 123012345645678.9
-- test some more edge cases and carries
ddfma2101 fma 9 9 0e+384 -> 81
ddfma2102 fma 9 90 0e+384 -> 810
ddfma2103 fma 9 900 0e+384 -> 8100
ddfma2104 fma 9 9000 0e+384 -> 81000
ddfma2105 fma 9 90000 0e+384 -> 810000
ddfma2106 fma 9 900000 0e+384 -> 8100000
ddfma2107 fma 9 9000000 0e+384 -> 81000000
ddfma2108 fma 9 90000000 0e+384 -> 810000000
ddfma2109 fma 9 900000000 0e+384 -> 8100000000
ddfma2110 fma 9 9000000000 0e+384 -> 81000000000
ddfma2111 fma 9 90000000000 0e+384 -> 810000000000
ddfma2112 fma 9 900000000000 0e+384 -> 8100000000000
ddfma2113 fma 9 9000000000000 0e+384 -> 81000000000000
ddfma2114 fma 9 90000000000000 0e+384 -> 810000000000000
ddfma2115 fma 9 900000000000000 0e+384 -> 8100000000000000
--ddfma2116 fma 9 9000000000000000 0e+384 -> 81000000000000000
--ddfma2117 fma 9 90000000000000000 0e+384 -> 810000000000000000
--ddfma2118 fma 9 900000000000000000 0e+384 -> 8100000000000000000
--ddfma2119 fma 9 9000000000000000000 0e+384 -> 81000000000000000000
--ddfma2120 fma 9 90000000000000000000 0e+384 -> 810000000000000000000
--ddfma2121 fma 9 900000000000000000000 0e+384 -> 8100000000000000000000
--ddfma2122 fma 9 9000000000000000000000 0e+384 -> 81000000000000000000000
--ddfma2123 fma 9 90000000000000000000000 0e+384 -> 810000000000000000000000
-- test some more edge cases without carries
ddfma2131 fma 3 3 0e+384 -> 9
ddfma2132 fma 3 30 0e+384 -> 90
ddfma2133 fma 3 300 0e+384 -> 900
ddfma2134 fma 3 3000 0e+384 -> 9000
ddfma2135 fma 3 30000 0e+384 -> 90000
ddfma2136 fma 3 300000 0e+384 -> 900000
ddfma2137 fma 3 3000000 0e+384 -> 9000000
ddfma2138 fma 3 30000000 0e+384 -> 90000000
ddfma2139 fma 3 300000000 0e+384 -> 900000000
ddfma2140 fma 3 3000000000 0e+384 -> 9000000000
ddfma2141 fma 3 30000000000 0e+384 -> 90000000000
ddfma2142 fma 3 300000000000 0e+384 -> 900000000000
ddfma2143 fma 3 3000000000000 0e+384 -> 9000000000000
ddfma2144 fma 3 30000000000000 0e+384 -> 90000000000000
ddfma2145 fma 3 300000000000000 0e+384 -> 900000000000000
-- test some edge cases with exact rounding
ddfma2301 fma 9 9 0e+384 -> 81
ddfma2302 fma 9 90 0e+384 -> 810
ddfma2303 fma 9 900 0e+384 -> 8100
ddfma2304 fma 9 9000 0e+384 -> 81000
ddfma2305 fma 9 90000 0e+384 -> 810000
ddfma2306 fma 9 900000 0e+384 -> 8100000
ddfma2307 fma 9 9000000 0e+384 -> 81000000
ddfma2308 fma 9 90000000 0e+384 -> 810000000
ddfma2309 fma 9 900000000 0e+384 -> 8100000000
ddfma2310 fma 9 9000000000 0e+384 -> 81000000000
ddfma2311 fma 9 90000000000 0e+384 -> 810000000000
ddfma2312 fma 9 900000000000 0e+384 -> 8100000000000
ddfma2313 fma 9 9000000000000 0e+384 -> 81000000000000
ddfma2314 fma 9 90000000000000 0e+384 -> 810000000000000
ddfma2315 fma 9 900000000000000 0e+384 -> 8100000000000000
ddfma2316 fma 9 9000000000000000 0e+384 -> 8.100000000000000E+16 Rounded
ddfma2317 fma 90 9000000000000000 0e+384 -> 8.100000000000000E+17 Rounded
ddfma2318 fma 900 9000000000000000 0e+384 -> 8.100000000000000E+18 Rounded
ddfma2319 fma 9000 9000000000000000 0e+384 -> 8.100000000000000E+19 Rounded
ddfma2320 fma 90000 9000000000000000 0e+384 -> 8.100000000000000E+20 Rounded
ddfma2321 fma 900000 9000000000000000 0e+384 -> 8.100000000000000E+21 Rounded
ddfma2322 fma 9000000 9000000000000000 0e+384 -> 8.100000000000000E+22 Rounded
ddfma2323 fma 90000000 9000000000000000 0e+384 -> 8.100000000000000E+23 Rounded
-- tryzeros cases
ddfma2504 fma 0E-260 1000E-260 0e+384 -> 0E-398 Clamped
ddfma2505 fma 100E+260 0E+260 0e+384 -> 0E+369 Clamped
-- mixed with zeros
ddfma2541 fma 0 -1 0e+384 -> 0
ddfma2542 fma -0 -1 0e+384 -> 0
ddfma2543 fma 0 1 0e+384 -> 0
ddfma2544 fma -0 1 0e+384 -> 0
ddfma2545 fma -1 0 0e+384 -> 0
ddfma2546 fma -1 -0 0e+384 -> 0
ddfma2547 fma 1 0 0e+384 -> 0
ddfma2548 fma 1 -0 0e+384 -> 0
ddfma2551 fma 0.0 -1 0e+384 -> 0.0
ddfma2552 fma -0.0 -1 0e+384 -> 0.0
ddfma2553 fma 0.0 1 0e+384 -> 0.0
ddfma2554 fma -0.0 1 0e+384 -> 0.0
ddfma2555 fma -1.0 0 0e+384 -> 0.0
ddfma2556 fma -1.0 -0 0e+384 -> 0.0
ddfma2557 fma 1.0 0 0e+384 -> 0.0
ddfma2558 fma 1.0 -0 0e+384 -> 0.0
ddfma2561 fma 0 -1.0 0e+384 -> 0.0
ddfma2562 fma -0 -1.0 0e+384 -> 0.0
ddfma2563 fma 0 1.0 0e+384 -> 0.0
ddfma2564 fma -0 1.0 0e+384 -> 0.0
ddfma2565 fma -1 0.0 0e+384 -> 0.0
ddfma2566 fma -1 -0.0 0e+384 -> 0.0
ddfma2567 fma 1 0.0 0e+384 -> 0.0
ddfma2568 fma 1 -0.0 0e+384 -> 0.0
ddfma2571 fma 0.0 -1.0 0e+384 -> 0.00
ddfma2572 fma -0.0 -1.0 0e+384 -> 0.00
ddfma2573 fma 0.0 1.0 0e+384 -> 0.00
ddfma2574 fma -0.0 1.0 0e+384 -> 0.00
ddfma2575 fma -1.0 0.0 0e+384 -> 0.00
ddfma2576 fma -1.0 -0.0 0e+384 -> 0.00
ddfma2577 fma 1.0 0.0 0e+384 -> 0.00
ddfma2578 fma 1.0 -0.0 0e+384 -> 0.00
-- Specials
ddfma2580 fma Inf -Inf 0e+384 -> -Infinity
ddfma2581 fma Inf -1000 0e+384 -> -Infinity
ddfma2582 fma Inf -1 0e+384 -> -Infinity
ddfma2583 fma Inf -0 0e+384 -> NaN Invalid_operation
ddfma2584 fma Inf 0 0e+384 -> NaN Invalid_operation
ddfma2585 fma Inf 1 0e+384 -> Infinity
ddfma2586 fma Inf 1000 0e+384 -> Infinity
ddfma2587 fma Inf Inf 0e+384 -> Infinity
ddfma2588 fma -1000 Inf 0e+384 -> -Infinity
ddfma2589 fma -Inf Inf 0e+384 -> -Infinity
ddfma2590 fma -1 Inf 0e+384 -> -Infinity
ddfma2591 fma -0 Inf 0e+384 -> NaN Invalid_operation
ddfma2592 fma 0 Inf 0e+384 -> NaN Invalid_operation
ddfma2593 fma 1 Inf 0e+384 -> Infinity
ddfma2594 fma 1000 Inf 0e+384 -> Infinity
ddfma2595 fma Inf Inf 0e+384 -> Infinity
ddfma2600 fma -Inf -Inf 0e+384 -> Infinity
ddfma2601 fma -Inf -1000 0e+384 -> Infinity
ddfma2602 fma -Inf -1 0e+384 -> Infinity
ddfma2603 fma -Inf -0 0e+384 -> NaN Invalid_operation
ddfma2604 fma -Inf 0 0e+384 -> NaN Invalid_operation
ddfma2605 fma -Inf 1 0e+384 -> -Infinity
Loading ...