Repository URL to install this package:
------------------------------------------------------------------------
-- fma.decTest -- decimal 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
extended: 1
precision: 9
rounding: half_up
maxExponent: 384
minexponent: -383
-- 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
fmax0001 fma 1 1 1 -> 2
fmax0002 fma 1 1 2 -> 3
fmax0003 fma 2 2 3 -> 7
fmax0004 fma 9 9 9 -> 90
fmax0005 fma -1 1 1 -> 0
fmax0006 fma -1 1 2 -> 1
fmax0007 fma -2 2 3 -> -1
fmax0008 fma -9 9 9 -> -72
fmax0011 fma 1 -1 1 -> 0
fmax0012 fma 1 -1 2 -> 1
fmax0013 fma 2 -2 3 -> -1
fmax0014 fma 9 -9 9 -> -72
fmax0015 fma 1 1 -1 -> 0
fmax0016 fma 1 1 -2 -> -1
fmax0017 fma 2 2 -3 -> 1
fmax0018 fma 9 9 -9 -> 72
fmax0019 fma 3 5 7 -> 22
fmax0029 fma 3 -5 7 -> -8
-- non-integer exacts
fma0100 fma 25.2 63.6 -438 -> 1164.72
fma0101 fma 0.301 0.380 334 -> 334.114380
fma0102 fma 49.2 -4.8 23.3 -> -212.86
fma0103 fma 4.22 0.079 -94.6 -> -94.26662
fma0104 fma 903 0.797 0.887 -> 720.578
fma0105 fma 6.13 -161 65.9 -> -921.03
fma0106 fma 28.2 727 5.45 -> 20506.85
fma0107 fma 4 605 688 -> 3108
fma0108 fma 93.3 0.19 0.226 -> 17.953
fma0109 fma 0.169 -341 5.61 -> -52.019
fma0110 fma -72.2 30 -51.2 -> -2217.2
fma0111 fma -0.409 13 20.4 -> 15.083
fma0112 fma 317 77.0 19.0 -> 24428.0
fma0113 fma 47 6.58 1.62 -> 310.88
fma0114 fma 1.36 0.984 0.493 -> 1.83124
fma0115 fma 72.7 274 1.56 -> 19921.36
fma0116 fma 335 847 83 -> 283828
fma0117 fma 666 0.247 25.4 -> 189.902
fma0118 fma -3.87 3.06 78.0 -> 66.1578
fma0119 fma 0.742 192 35.6 -> 178.064
fma0120 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]
-- 888565290 1557.96930 -86087.7578 -> 1.38435735E+12
fma0201 fma 888565290 1557.96930 -86087.7578 -> 1.38435736E+12 Inexact Rounded
-- -85519342.9 735155419 42010431 -> -6.28700084E+16
fma0205 fma -85519342.9 735155419 42010431 -> -6.28700083E+16 Inexact Rounded
-- -98025.5 -294603.472 10414348.2 -> 2.88890669E+10
fma0208 fma -98025.5 -294603.472 10414348.2 -> 2.88890670E+10 Inexact Rounded
-- 5967627.39 83526540.6 498494.810 -> 4.98455271E+14
fma0211 fma 5967627.39 83526540.6 498494.810 -> 4.98455272E+14 Inexact Rounded
-- 3456.9433 874.39518 197866.615 -> 3220601.18
fma0216 fma 3456.9433 874.39518 197866.615 -> 3220601.17 Inexact Rounded
-- 62769.8287 2096.98927 48.420317 -> 131627705
fma0218 fma 62769.8287 2096.98927 48.420317 -> 131627706 Inexact Rounded
-- -68.81500 59961113.9 -8988862 -> -4.13521291E+9
fma0219 fma -68.81500 59961113.9 -8988862 -> -4.13521292E+9 Inexact Rounded
-- 2126341.02 63491.5152 302427455 -> 1.35307040E+11
fma0226 fma 2126341.02 63491.5152 302427455 -> 1.35307041E+11 Inexact Rounded
-- Infinite combinations
fmax0800 fma Inf Inf Inf -> Infinity
fmax0801 fma Inf Inf -Inf -> NaN Invalid_operation
fmax0802 fma Inf -Inf Inf -> NaN Invalid_operation
fmax0803 fma Inf -Inf -Inf -> -Infinity
fmax0804 fma -Inf Inf Inf -> NaN Invalid_operation
fmax0805 fma -Inf Inf -Inf -> -Infinity
fmax0806 fma -Inf -Inf Inf -> Infinity
fmax0807 fma -Inf -Inf -Inf -> NaN Invalid_operation
fmax0808 fma -Inf 0 1 -> NaN Invalid_operation
fmax0809 fma -Inf 0 NaN -> NaN Invalid_operation
-- Triple NaN propagation
fmax0900 fma NaN2 NaN3 NaN5 -> NaN2
fmax0901 fma 0 NaN3 NaN5 -> NaN3
fmax0902 fma 0 0 NaN5 -> NaN5
-- first sNaN wins (consider qNaN from earlier sNaN being
-- overridden by an sNaN in third operand)
fmax0903 fma sNaN1 sNaN2 sNaN3 -> NaN1 Invalid_operation
fmax0904 fma 0 sNaN2 sNaN3 -> NaN2 Invalid_operation
fmax0905 fma 0 0 sNaN3 -> NaN3 Invalid_operation
fmax0906 fma sNaN1 sNaN2 sNaN3 -> NaN1 Invalid_operation
fmax0907 fma NaN7 sNaN2 sNaN3 -> NaN2 Invalid_operation
fmax0908 fma NaN7 NaN5 sNaN3 -> NaN3 Invalid_operation
-- MULTIPLICATION TESTS ------------------------------------------------
-- sanity checks (as base, above)
fmax2000 fma 2 2 0E+999999 -> 4
fmax2001 fma 2 3 0E+999999 -> 6
fmax2002 fma 5 1 0E+999999 -> 5
fmax2003 fma 5 2 0E+999999 -> 10
fmax2004 fma 1.20 2 0E+999999 -> 2.40
fmax2005 fma 1.20 0 0E+999999 -> 0.00
fmax2006 fma 1.20 -2 0E+999999 -> -2.40
fmax2007 fma -1.20 2 0E+999999 -> -2.40
fmax2008 fma -1.20 0 0E+999999 -> 0.00
fmax2009 fma -1.20 -2 0E+999999 -> 2.40
fmax2010 fma 5.09 7.1 0E+999999 -> 36.139
fmax2011 fma 2.5 4 0E+999999 -> 10.0
fmax2012 fma 2.50 4 0E+999999 -> 10.00
fmax2013 fma 1.23456789 1.00000000 0E+999999 -> 1.23456789 Rounded
fmax2014 fma 9.999999999 9.999999999 0E+999999 -> 100.000000 Inexact Rounded
fmax2015 fma 2.50 4 0E+999999 -> 10.00
precision: 6
fmax2016 fma 2.50 4 0E+999999 -> 10.00
fmax2017 fma 9.999999 9.999999 0E+999999 -> 100.000 Inexact Rounded
fmax2018 fma 9.999999 -9.999999 0E+999999 -> -100.000 Inexact Rounded
fmax2019 fma -9.999999 9.999999 0E+999999 -> -100.000 Inexact Rounded
fmax2020 fma -9.999999 -9.999999 0E+999999 -> 100.000 Inexact Rounded
-- 1999.12.21: next one is an edge case if intermediate longs are used
precision: 15
fmax2059 fma 999999999999 9765625 0E+999999 -> 9.76562499999023E+18 Inexact Rounded
precision: 30
fmax2160 fma 999999999999 9765625 0E+999999 -> 9765624999990234375
precision: 9
-----
-- zeros, etc.
fmax2021 fma 0 0 0E+999999 -> 0
fmax2022 fma 0 -0 0E+999999 -> 0
fmax2023 fma -0 0 0E+999999 -> 0
fmax2024 fma -0 -0 0E+999999 -> 0
fmax2025 fma -0.0 -0.0 0E+999999 -> 0.00
fmax2026 fma -0.0 -0.0 0E+999999 -> 0.00
fmax2027 fma -0.0 -0.0 0E+999999 -> 0.00
fmax2028 fma -0.0 -0.0 0E+999999 -> 0.00
fmax2030 fma 5.00 1E-3 0E+999999 -> 0.00500
fmax2031 fma 00.00 0.000 0E+999999 -> 0.00000
fmax2032 fma 00.00 0E-3 0E+999999 -> 0.00000 -- rhs is 0
fmax2033 fma 0E-3 00.00 0E+999999 -> 0.00000 -- lhs is 0
fmax2034 fma -5.00 1E-3 0E+999999 -> -0.00500
fmax2035 fma -00.00 0.000 0E+999999 -> 0.00000
fmax2036 fma -00.00 0E-3 0E+999999 -> 0.00000 -- rhs is 0
fmax2037 fma -0E-3 00.00 0E+999999 -> 0.00000 -- lhs is 0
fmax2038 fma 5.00 -1E-3 0E+999999 -> -0.00500
fmax2039 fma 00.00 -0.000 0E+999999 -> 0.00000
fmax2040 fma 00.00 -0E-3 0E+999999 -> 0.00000 -- rhs is 0
fmax2041 fma 0E-3 -00.00 0E+999999 -> 0.00000 -- lhs is 0
fmax2042 fma -5.00 -1E-3 0E+999999 -> 0.00500
fmax2043 fma -00.00 -0.000 0E+999999 -> 0.00000
fmax2044 fma -00.00 -0E-3 0E+999999 -> 0.00000 -- rhs is 0
fmax2045 fma -0E-3 -00.00 0E+999999 -> 0.00000 -- lhs is 0
-- examples from decarith multiply
fmax2050 fma 1.20 3 0E+999999 -> 3.60
fmax2051 fma 7 3 0E+999999 -> 21
fmax2052 fma 0.9 0.8 0E+999999 -> 0.72
fmax2053 fma 0.9 -0 0E+999999 -> 0.0
fmax2054 fma 654321 654321 0E+999999 -> 4.28135971E+11 Inexact Rounded
fmax2060 fma 123.45 1e7 0E+999999 -> 1.2345E+9
fmax2061 fma 123.45 1e8 0E+999999 -> 1.2345E+10
fmax2062 fma 123.45 1e+9 0E+999999 -> 1.2345E+11
fmax2063 fma 123.45 1e10 0E+999999 -> 1.2345E+12
fmax2064 fma 123.45 1e11 0E+999999 -> 1.2345E+13
fmax2065 fma 123.45 1e12 0E+999999 -> 1.2345E+14
fmax2066 fma 123.45 1e13 0E+999999 -> 1.2345E+15
-- test some intermediate lengths
precision: 9
fmax2080 fma 0.1 123456789 0E+999999 -> 12345678.9
fmax2081 fma 0.1 1234567891 0E+999999 -> 123456789 Inexact Rounded
fmax2082 fma 0.1 12345678912 0E+999999 -> 1.23456789E+9 Inexact Rounded
fmax2083 fma 0.1 12345678912345 0E+999999 -> 1.23456789E+12 Inexact Rounded
fmax2084 fma 0.1 123456789 0E+999999 -> 12345678.9
precision: 8
fmax2085 fma 0.1 12345678912 0E+999999 -> 1.2345679E+9 Inexact Rounded
fmax2086 fma 0.1 12345678912345 0E+999999 -> 1.2345679E+12 Inexact Rounded
precision: 7
fmax2087 fma 0.1 12345678912 0E+999999 -> 1.234568E+9 Inexact Rounded
fmax2088 fma 0.1 12345678912345 0E+999999 -> 1.234568E+12 Inexact Rounded
precision: 9
fmax2090 fma 123456789 0.1 0E+999999 -> 12345678.9
fmax2091 fma 1234567891 0.1 0E+999999 -> 123456789 Inexact Rounded
fmax2092 fma 12345678912 0.1 0E+999999 -> 1.23456789E+9 Inexact Rounded
fmax2093 fma 12345678912345 0.1 0E+999999 -> 1.23456789E+12 Inexact Rounded
fmax2094 fma 123456789 0.1 0E+999999 -> 12345678.9
precision: 8
fmax2095 fma 12345678912 0.1 0E+999999 -> 1.2345679E+9 Inexact Rounded
fmax2096 fma 12345678912345 0.1 0E+999999 -> 1.2345679E+12 Inexact Rounded
precision: 7
fmax2097 fma 12345678912 0.1 0E+999999 -> 1.234568E+9 Inexact Rounded
fmax2098 fma 12345678912345 0.1 0E+999999 -> 1.234568E+12 Inexact Rounded
-- test some more edge cases and carries
maxexponent: 9999
minexponent: -9999
precision: 33
fmax2101 fma 9 9 0E+999999 -> 81
fmax2102 fma 9 90 0E+999999 -> 810
fmax2103 fma 9 900 0E+999999 -> 8100
fmax2104 fma 9 9000 0E+999999 -> 81000
fmax2105 fma 9 90000 0E+999999 -> 810000
fmax2106 fma 9 900000 0E+999999 -> 8100000
fmax2107 fma 9 9000000 0E+999999 -> 81000000
fmax2108 fma 9 90000000 0E+999999 -> 810000000
fmax2109 fma 9 900000000 0E+999999 -> 8100000000
fmax2110 fma 9 9000000000 0E+999999 -> 81000000000
fmax2111 fma 9 90000000000 0E+999999 -> 810000000000
fmax2112 fma 9 900000000000 0E+999999 -> 8100000000000
fmax2113 fma 9 9000000000000 0E+999999 -> 81000000000000
fmax2114 fma 9 90000000000000 0E+999999 -> 810000000000000
fmax2115 fma 9 900000000000000 0E+999999 -> 8100000000000000
fmax2116 fma 9 9000000000000000 0E+999999 -> 81000000000000000
fmax2117 fma 9 90000000000000000 0E+999999 -> 810000000000000000
fmax2118 fma 9 900000000000000000 0E+999999 -> 8100000000000000000
fmax2119 fma 9 9000000000000000000 0E+999999 -> 81000000000000000000
fmax2120 fma 9 90000000000000000000 0E+999999 -> 810000000000000000000
fmax2121 fma 9 900000000000000000000 0E+999999 -> 8100000000000000000000
fmax2122 fma 9 9000000000000000000000 0E+999999 -> 81000000000000000000000
fmax2123 fma 9 90000000000000000000000 0E+999999 -> 810000000000000000000000
-- test some more edge cases without carries
fmax2131 fma 3 3 0E+999999 -> 9
fmax2132 fma 3 30 0E+999999 -> 90
fmax2133 fma 3 300 0E+999999 -> 900
fmax2134 fma 3 3000 0E+999999 -> 9000
fmax2135 fma 3 30000 0E+999999 -> 90000
fmax2136 fma 3 300000 0E+999999 -> 900000
fmax2137 fma 3 3000000 0E+999999 -> 9000000
fmax2138 fma 3 30000000 0E+999999 -> 90000000
fmax2139 fma 3 300000000 0E+999999 -> 900000000
fmax2140 fma 3 3000000000 0E+999999 -> 9000000000
fmax2141 fma 3 30000000000 0E+999999 -> 90000000000
fmax2142 fma 3 300000000000 0E+999999 -> 900000000000
fmax2143 fma 3 3000000000000 0E+999999 -> 9000000000000
fmax2144 fma 3 30000000000000 0E+999999 -> 90000000000000
fmax2145 fma 3 300000000000000 0E+999999 -> 900000000000000
fmax2146 fma 3 3000000000000000 0E+999999 -> 9000000000000000
fmax2147 fma 3 30000000000000000 0E+999999 -> 90000000000000000
fmax2148 fma 3 300000000000000000 0E+999999 -> 900000000000000000
fmax2149 fma 3 3000000000000000000 0E+999999 -> 9000000000000000000
fmax2150 fma 3 30000000000000000000 0E+999999 -> 90000000000000000000
fmax2151 fma 3 300000000000000000000 0E+999999 -> 900000000000000000000
fmax2152 fma 3 3000000000000000000000 0E+999999 -> 9000000000000000000000
fmax2153 fma 3 30000000000000000000000 0E+999999 -> 90000000000000000000000
maxexponent: 999999
minexponent: -999999
precision: 9
-- test some cases that are close to exponent overflow/underflow
fmax2170 fma 1 9e999999 0E+999999 -> 9E+999999
fmax2171 fma 1 9.9e999999 0E+999999 -> 9.9E+999999
fmax2172 fma 1 9.99e999999 0E+999999 -> 9.99E+999999
fmax2173 fma 9e999999 1 0E+999999 -> 9E+999999
fmax2174 fma 9.9e999999 1 0E+999999 -> 9.9E+999999
fmax2176 fma 9.99e999999 1 0E+999999 -> 9.99E+999999
fmax2177 fma 1 9.99999e999999 0E+999999 -> 9.99999E+999999
fmax2178 fma 9.99999e999999 1 0E+999999 -> 9.99999E+999999
fmax2180 fma 0.1 9e-999998 0E+999999 -> 9E-999999
fmax2181 fma 0.1 99e-999998 0E+999999 -> 9.9E-999998
fmax2182 fma 0.1 999e-999998 0E+999999 -> 9.99E-999997
fmax2183 fma 0.1 9e-999998 0E+999999 -> 9E-999999
fmax2184 fma 0.1 99e-999998 0E+999999 -> 9.9E-999998
fmax2185 fma 0.1 999e-999998 0E+999999 -> 9.99E-999997
fmax2186 fma 0.1 999e-999997 0E+999999 -> 9.99E-999996
fmax2187 fma 0.1 9999e-999997 0E+999999 -> 9.999E-999995
fmax2188 fma 0.1 99999e-999997 0E+999999 -> 9.9999E-999994
fmax2190 fma 1 9e-999998 0E+999999 -> 9E-999998
fmax2191 fma 1 99e-999998 0E+999999 -> 9.9E-999997
fmax2192 fma 1 999e-999998 0E+999999 -> 9.99E-999996
fmax2193 fma 9e-999998 1 0E+999999 -> 9E-999998
fmax2194 fma 99e-999998 1 0E+999999 -> 9.9E-999997
fmax2195 fma 999e-999998 1 0E+999999 -> 9.99E-999996
-- long operand triangle
precision: 33
fmax2246 fma 30269.587755640502150977251770554 4.8046009735990873395936309640543 0E+999999 -> 145433.290801193369671916511992830 Inexact Rounded
precision: 32
fmax2247 fma 30269.587755640502150977251770554 4.8046009735990873395936309640543 0E+999999 -> 145433.29080119336967191651199283 Inexact Rounded
precision: 31
fmax2248 fma 30269.587755640502150977251770554 4.8046009735990873395936309640543 0E+999999 -> 145433.2908011933696719165119928 Inexact Rounded
precision: 30
fmax2249 fma 30269.587755640502150977251770554 4.8046009735990873395936309640543 0E+999999 -> 145433.290801193369671916511993 Inexact Rounded
precision: 29
fmax2250 fma 30269.587755640502150977251770554 4.8046009735990873395936309640543 0E+999999 -> 145433.29080119336967191651199 Inexact Rounded
precision: 28
fmax2251 fma 30269.587755640502150977251770554 4.8046009735990873395936309640543 0E+999999 -> 145433.2908011933696719165120 Inexact Rounded
precision: 27
fmax2252 fma 30269.587755640502150977251770554 4.8046009735990873395936309640543 0E+999999 -> 145433.290801193369671916512 Inexact Rounded
precision: 26
fmax2253 fma 30269.587755640502150977251770554 4.8046009735990873395936309640543 0E+999999 -> 145433.29080119336967191651 Inexact Rounded
precision: 25
fmax2254 fma 30269.587755640502150977251770554 4.8046009735990873395936309640543 0E+999999 -> 145433.2908011933696719165 Inexact Rounded
precision: 24
fmax2255 fma 30269.587755640502150977251770554 4.8046009735990873395936309640543 0E+999999 -> 145433.290801193369671917 Inexact Rounded
precision: 23
fmax2256 fma 30269.587755640502150977251770554 4.8046009735990873395936309640543 0E+999999 -> 145433.29080119336967192 Inexact Rounded
precision: 22
fmax2257 fma 30269.587755640502150977251770554 4.8046009735990873395936309640543 0E+999999 -> 145433.2908011933696719 Inexact Rounded
precision: 21
fmax2258 fma 30269.587755640502150977251770554 4.8046009735990873395936309640543 0E+999999 -> 145433.290801193369672 Inexact Rounded
precision: 20
fmax2259 fma 30269.587755640502150977251770554 4.8046009735990873395936309640543 0E+999999 -> 145433.29080119336967 Inexact Rounded
precision: 19
fmax2260 fma 30269.587755640502150977251770554 4.8046009735990873395936309640543 0E+999999 -> 145433.2908011933697 Inexact Rounded
precision: 18
fmax2261 fma 30269.587755640502150977251770554 4.8046009735990873395936309640543 0E+999999 -> 145433.290801193370 Inexact Rounded
precision: 17
fmax2262 fma 30269.587755640502150977251770554 4.8046009735990873395936309640543 0E+999999 -> 145433.29080119337 Inexact Rounded
Loading ...