Repository URL to install this package:
------------------------------------------------------------------------
-- dqFMA.decTest -- decQuad 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
clamp: 1
precision: 34
maxExponent: 6144
minExponent: -6143
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
dqfma0001 fma 1 1 1 -> 2
dqfma0002 fma 1 1 2 -> 3
dqfma0003 fma 2 2 3 -> 7
dqfma0004 fma 9 9 9 -> 90
dqfma0005 fma -1 1 1 -> 0
dqfma0006 fma -1 1 2 -> 1
dqfma0007 fma -2 2 3 -> -1
dqfma0008 fma -9 9 9 -> -72
dqfma0011 fma 1 -1 1 -> 0
dqfma0012 fma 1 -1 2 -> 1
dqfma0013 fma 2 -2 3 -> -1
dqfma0014 fma 9 -9 9 -> -72
dqfma0015 fma 1 1 -1 -> 0
dqfma0016 fma 1 1 -2 -> -1
dqfma0017 fma 2 2 -3 -> 1
dqfma0018 fma 9 9 -9 -> 72
-- non-integer exacts
dqfma0100 fma 25.2 63.6 -438 -> 1164.72
dqfma0101 fma 0.301 0.380 334 -> 334.114380
dqfma0102 fma 49.2 -4.8 23.3 -> -212.86
dqfma0103 fma 4.22 0.079 -94.6 -> -94.26662
dqfma0104 fma 903 0.797 0.887 -> 720.578
dqfma0105 fma 6.13 -161 65.9 -> -921.03
dqfma0106 fma 28.2 727 5.45 -> 20506.85
dqfma0107 fma 4 605 688 -> 3108
dqfma0108 fma 93.3 0.19 0.226 -> 17.953
dqfma0109 fma 0.169 -341 5.61 -> -52.019
dqfma0110 fma -72.2 30 -51.2 -> -2217.2
dqfma0111 fma -0.409 13 20.4 -> 15.083
dqfma0112 fma 317 77.0 19.0 -> 24428.0
dqfma0113 fma 47 6.58 1.62 -> 310.88
dqfma0114 fma 1.36 0.984 0.493 -> 1.83124
dqfma0115 fma 72.7 274 1.56 -> 19921.36
dqfma0116 fma 335 847 83 -> 283828
dqfma0117 fma 666 0.247 25.4 -> 189.902
dqfma0118 fma -3.87 3.06 78.0 -> 66.1578
dqfma0119 fma 0.742 192 35.6 -> 178.064
dqfma0120 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]
-- -> 4.500119002100000209469729375698778E+38
dqfma0202 fma 68537985861355864457.5694 6565875762972086605.85969 35892634447236753.172812 -> 4.500119002100000209469729375698779E+38 Inexact Rounded
-- -> 5.996248469584594346858881620185514E+41
dqfma0208 fma 89261822344727628571.9 6717595845654131383336.89 5061036497288796076266.11 -> 5.996248469584594346858881620185513E+41 Inexact Rounded
-- -> 1.899242968678256924021594770874070E+34
dqfma0210 fma 320506237232448685.495971 59257597764017967.984448 3205615239077711589912.85 -> 1.899242968678256924021594770874071E+34 Inexact Rounded
-- -> 7.078596978842809537929699954860309E+37
dqfma0215 fma 220247843259112263.17995 321392340287987979002.80 47533279819997167655440 -> 7.078596978842809537929699954860308E+37 Inexact Rounded
-- -> 1.224955667581427559754106862350743E+37
dqfma0226 fma 23880729790368880412.1449 512947333827064719.55407 217117438419590824502.963 -> 1.224955667581427559754106862350744E+37 Inexact Rounded
-- -> -2.530094043253148806272276368579144E+42
dqfma0229 fma 2539892357016099706.4126 -996142232667504817717435 53682082598315949425.937 -> -2.530094043253148806272276368579143E+42 Inexact Rounded
-- -> 1.713387085759711954319391412788454E+37
dqfma0233 fma 4546339491341624464.0804 3768717864169205581 83578980278690395184.620 -> 1.713387085759711954319391412788453E+37 Inexact Rounded
-- -> 4.062275663405823716411579117771547E+35
dqfma0235 fma 409242119433816131.42253 992633815166741501.477249 70179636544416756129546 -> 4.062275663405823716411579117771548E+35 Inexact Rounded
-- -> 6.002604327732568490562249875306823E+47
dqfma0258 fma 817941336593541742159684 733867339769310729266598 78563844650942419311830.8 -> 6.002604327732568490562249875306822E+47 Inexact Rounded
-- -> -2.027022514381452197510103395283874E+39
dqfma0264 fma 387617310169161270.737532 -5229442703414956061216.62 57665666816652967150473.5 -> -2.027022514381452197510103395283873E+39 Inexact Rounded
-- -> -7.856525039803554001144089842730361E+37
dqfma0267 fma -847655845720565274701.210 92685316564117739.83984 22780950041376424429.5686 -> -7.856525039803554001144089842730360E+37 Inexact Rounded
-- -> 1.695515562011520746125607502237559E+38
dqfma0268 fma 21590290365127685.3675 7853139227576541379426.8 -3275859437236180.761544 -> 1.695515562011520746125607502237558E+38 Inexact Rounded
-- -> -8.448422935783289219748115038014710E+38
dqfma0269 fma -974320636272862697.971586 867109103641860247440.756 -9775170775902454762.98 -> -8.448422935783289219748115038014709E+38 Inexact Rounded
-- Cases where multiply would overflow or underflow if separate
dqfma0300 fma 9e+6144 10 0 -> Infinity Overflow Inexact Rounded
dqfma0301 fma 1e+6144 10 0 -> Infinity Overflow Inexact Rounded
dqfma0302 fma 1e+6144 10 -1e+6144 -> 9.000000000000000000000000000000000E+6144 Clamped
dqfma0303 fma 1e+6144 10 -9e+6144 -> 1.000000000000000000000000000000000E+6144 Clamped
-- subnormal etc.
dqfma0305 fma 1e-6176 0.1 0 -> 0E-6176 Underflow Subnormal Inexact Rounded Clamped
dqfma0306 fma 1e-6176 0.1 1 -> 1.000000000000000000000000000000000 Inexact Rounded
dqfma0307 fma 1e-6176 0.1 1e-6176 -> 1E-6176 Underflow Subnormal Inexact Rounded
-- Infinite combinations
dqfma0800 fma Inf Inf Inf -> Infinity
dqfma0801 fma Inf Inf -Inf -> NaN Invalid_operation
dqfma0802 fma Inf -Inf Inf -> NaN Invalid_operation
dqfma0803 fma Inf -Inf -Inf -> -Infinity
dqfma0804 fma -Inf Inf Inf -> NaN Invalid_operation
dqfma0805 fma -Inf Inf -Inf -> -Infinity
dqfma0806 fma -Inf -Inf Inf -> Infinity
dqfma0807 fma -Inf -Inf -Inf -> NaN Invalid_operation
-- Triple NaN propagation
dqfma0900 fma NaN2 NaN3 NaN5 -> NaN2
dqfma0901 fma 0 NaN3 NaN5 -> NaN3
dqfma0902 fma 0 0 NaN5 -> NaN5
-- first sNaN wins (consider qNaN from earlier sNaN being
-- overridden by an sNaN in third operand)
dqfma0903 fma sNaN1 sNaN2 sNaN3 -> NaN1 Invalid_operation
dqfma0904 fma 0 sNaN2 sNaN3 -> NaN2 Invalid_operation
dqfma0905 fma 0 0 sNaN3 -> NaN3 Invalid_operation
dqfma0906 fma sNaN1 sNaN2 sNaN3 -> NaN1 Invalid_operation
dqfma0907 fma NaN7 sNaN2 sNaN3 -> NaN2 Invalid_operation
dqfma0908 fma NaN7 NaN5 sNaN3 -> NaN3 Invalid_operation
-- MULTIPLICATION TESTS ------------------------------------------------
rounding: half_even
-- sanity checks
dqfma2000 fma 2 2 0e+6144 -> 4
dqfma2001 fma 2 3 0e+6144 -> 6
dqfma2002 fma 5 1 0e+6144 -> 5
dqfma2003 fma 5 2 0e+6144 -> 10
dqfma2004 fma 1.20 2 0e+6144 -> 2.40
dqfma2005 fma 1.20 0 0e+6144 -> 0.00
dqfma2006 fma 1.20 -2 0e+6144 -> -2.40
dqfma2007 fma -1.20 2 0e+6144 -> -2.40
dqfma2008 fma -1.20 0 0e+6144 -> 0.00
dqfma2009 fma -1.20 -2 0e+6144 -> 2.40
dqfma2010 fma 5.09 7.1 0e+6144 -> 36.139
dqfma2011 fma 2.5 4 0e+6144 -> 10.0
dqfma2012 fma 2.50 4 0e+6144 -> 10.00
dqfma2013 fma 1.23456789 1.0000000000000000000000000000 0e+6144 -> 1.234567890000000000000000000000000 Rounded
dqfma2015 fma 2.50 4 0e+6144 -> 10.00
dqfma2016 fma 9.99999999999999999 9.99999999999999999 0e+6144 -> 99.99999999999999980000000000000000 Inexact Rounded
dqfma2017 fma 9.99999999999999999 -9.99999999999999999 0e+6144 -> -99.99999999999999980000000000000000 Inexact Rounded
dqfma2018 fma -9.99999999999999999 9.99999999999999999 0e+6144 -> -99.99999999999999980000000000000000 Inexact Rounded
dqfma2019 fma -9.99999999999999999 -9.99999999999999999 0e+6144 -> 99.99999999999999980000000000000000 Inexact Rounded
-- zeros, etc.
dqfma2021 fma 0 0 0e+6144 -> 0
dqfma2022 fma 0 -0 0e+6144 -> 0
dqfma2023 fma -0 0 0e+6144 -> 0
dqfma2024 fma -0 -0 0e+6144 -> 0
dqfma2025 fma -0.0 -0.0 0e+6144 -> 0.00
dqfma2026 fma -0.0 -0.0 0e+6144 -> 0.00
dqfma2027 fma -0.0 -0.0 0e+6144 -> 0.00
dqfma2028 fma -0.0 -0.0 0e+6144 -> 0.00
dqfma2030 fma 5.00 1E-3 0e+6144 -> 0.00500
dqfma2031 fma 00.00 0.000 0e+6144 -> 0.00000
dqfma2032 fma 00.00 0E-3 0e+6144 -> 0.00000 -- rhs is 0
dqfma2033 fma 0E-3 00.00 0e+6144 -> 0.00000 -- lhs is 0
dqfma2034 fma -5.00 1E-3 0e+6144 -> -0.00500
dqfma2035 fma -00.00 0.000 0e+6144 -> 0.00000
dqfma2036 fma -00.00 0E-3 0e+6144 -> 0.00000 -- rhs is 0
dqfma2037 fma -0E-3 00.00 0e+6144 -> 0.00000 -- lhs is 0
dqfma2038 fma 5.00 -1E-3 0e+6144 -> -0.00500
dqfma2039 fma 00.00 -0.000 0e+6144 -> 0.00000
dqfma2040 fma 00.00 -0E-3 0e+6144 -> 0.00000 -- rhs is 0
dqfma2041 fma 0E-3 -00.00 0e+6144 -> 0.00000 -- lhs is 0
dqfma2042 fma -5.00 -1E-3 0e+6144 -> 0.00500
dqfma2043 fma -00.00 -0.000 0e+6144 -> 0.00000
dqfma2044 fma -00.00 -0E-3 0e+6144 -> 0.00000 -- rhs is 0
dqfma2045 fma -0E-3 -00.00 0e+6144 -> 0.00000 -- lhs is 0
-- examples from decarith
dqfma2050 fma 1.20 3 0e+6144 -> 3.60
dqfma2051 fma 7 3 0e+6144 -> 21
dqfma2052 fma 0.9 0.8 0e+6144 -> 0.72
dqfma2053 fma 0.9 -0 0e+6144 -> 0.0
dqfma2054 fma 654321 654321 0e+6144 -> 428135971041
dqfma2060 fma 123.45 1e7 0e+6144 -> 1.2345E+9
dqfma2061 fma 123.45 1e8 0e+6144 -> 1.2345E+10
dqfma2062 fma 123.45 1e+9 0e+6144 -> 1.2345E+11
dqfma2063 fma 123.45 1e10 0e+6144 -> 1.2345E+12
dqfma2064 fma 123.45 1e11 0e+6144 -> 1.2345E+13
dqfma2065 fma 123.45 1e12 0e+6144 -> 1.2345E+14
dqfma2066 fma 123.45 1e13 0e+6144 -> 1.2345E+15
-- test some intermediate lengths
-- 1234567890123456
dqfma2080 fma 0.1 1230123456456789 0e+6144 -> 123012345645678.9
dqfma2084 fma 0.1 1230123456456789 0e+6144 -> 123012345645678.9
dqfma2090 fma 1230123456456789 0.1 0e+6144 -> 123012345645678.9
dqfma2094 fma 1230123456456789 0.1 0e+6144 -> 123012345645678.9
-- test some more edge cases and carries
dqfma2101 fma 9 9 0e+6144 -> 81
dqfma2102 fma 9 90 0e+6144 -> 810
dqfma2103 fma 9 900 0e+6144 -> 8100
dqfma2104 fma 9 9000 0e+6144 -> 81000
dqfma2105 fma 9 90000 0e+6144 -> 810000
dqfma2106 fma 9 900000 0e+6144 -> 8100000
dqfma2107 fma 9 9000000 0e+6144 -> 81000000
dqfma2108 fma 9 90000000 0e+6144 -> 810000000
dqfma2109 fma 9 900000000 0e+6144 -> 8100000000
dqfma2110 fma 9 9000000000 0e+6144 -> 81000000000
dqfma2111 fma 9 90000000000 0e+6144 -> 810000000000
dqfma2112 fma 9 900000000000 0e+6144 -> 8100000000000
dqfma2113 fma 9 9000000000000 0e+6144 -> 81000000000000
dqfma2114 fma 9 90000000000000 0e+6144 -> 810000000000000
dqfma2115 fma 9 900000000000000 0e+6144 -> 8100000000000000
--dqfma2116 fma 9 9000000000000000 0e+6144 -> 81000000000000000
--dqfma2117 fma 9 90000000000000000 0e+6144 -> 810000000000000000
--dqfma2118 fma 9 900000000000000000 0e+6144 -> 8100000000000000000
--dqfma2119 fma 9 9000000000000000000 0e+6144 -> 81000000000000000000
--dqfma2120 fma 9 90000000000000000000 0e+6144 -> 810000000000000000000
--dqfma2121 fma 9 900000000000000000000 0e+6144 -> 8100000000000000000000
--dqfma2122 fma 9 9000000000000000000000 0e+6144 -> 81000000000000000000000
--dqfma2123 fma 9 90000000000000000000000 0e+6144 -> 810000000000000000000000
-- test some more edge cases without carries
dqfma2131 fma 3 3 0e+6144 -> 9
dqfma2132 fma 3 30 0e+6144 -> 90
dqfma2133 fma 3 300 0e+6144 -> 900
dqfma2134 fma 3 3000 0e+6144 -> 9000
dqfma2135 fma 3 30000 0e+6144 -> 90000
dqfma2136 fma 3 300000 0e+6144 -> 900000
dqfma2137 fma 3 3000000 0e+6144 -> 9000000
dqfma2138 fma 3 30000000 0e+6144 -> 90000000
dqfma2139 fma 3 300000000 0e+6144 -> 900000000
dqfma2140 fma 3 3000000000 0e+6144 -> 9000000000
dqfma2141 fma 3 30000000000 0e+6144 -> 90000000000
dqfma2142 fma 3 300000000000 0e+6144 -> 900000000000
dqfma2143 fma 3 3000000000000 0e+6144 -> 9000000000000
dqfma2144 fma 3 30000000000000 0e+6144 -> 90000000000000
dqfma2145 fma 3 300000000000000 0e+6144 -> 900000000000000
dqfma2146 fma 3 3000000000000000 0e+6144 -> 9000000000000000
dqfma2147 fma 3 30000000000000000 0e+6144 -> 90000000000000000
dqfma2148 fma 3 300000000000000000 0e+6144 -> 900000000000000000
dqfma2149 fma 3 3000000000000000000 0e+6144 -> 9000000000000000000
dqfma2150 fma 3 30000000000000000000 0e+6144 -> 90000000000000000000
dqfma2151 fma 3 300000000000000000000 0e+6144 -> 900000000000000000000
dqfma2152 fma 3 3000000000000000000000 0e+6144 -> 9000000000000000000000
dqfma2153 fma 3 30000000000000000000000 0e+6144 -> 90000000000000000000000
dqfma2263 fma 30269.587755640502150977251770554 4.8046009735990873395936309640543 0e+6144 -> 145433.2908011933696719165119928296 Inexact Rounded
-- test some edge cases with exact rounding
dqfma2301 fma 900000000000000000 9 0e+6144 -> 8100000000000000000
dqfma2302 fma 900000000000000000 90 0e+6144 -> 81000000000000000000
dqfma2303 fma 900000000000000000 900 0e+6144 -> 810000000000000000000
dqfma2304 fma 900000000000000000 9000 0e+6144 -> 8100000000000000000000
dqfma2305 fma 900000000000000000 90000 0e+6144 -> 81000000000000000000000
dqfma2306 fma 900000000000000000 900000 0e+6144 -> 810000000000000000000000
dqfma2307 fma 900000000000000000 9000000 0e+6144 -> 8100000000000000000000000
dqfma2308 fma 900000000000000000 90000000 0e+6144 -> 81000000000000000000000000
dqfma2309 fma 900000000000000000 900000000 0e+6144 -> 810000000000000000000000000
dqfma2310 fma 900000000000000000 9000000000 0e+6144 -> 8100000000000000000000000000
dqfma2311 fma 900000000000000000 90000000000 0e+6144 -> 81000000000000000000000000000
dqfma2312 fma 900000000000000000 900000000000 0e+6144 -> 810000000000000000000000000000
dqfma2313 fma 900000000000000000 9000000000000 0e+6144 -> 8100000000000000000000000000000
dqfma2314 fma 900000000000000000 90000000000000 0e+6144 -> 81000000000000000000000000000000
dqfma2315 fma 900000000000000000 900000000000000 0e+6144 -> 810000000000000000000000000000000
dqfma2316 fma 900000000000000000 9000000000000000 0e+6144 -> 8100000000000000000000000000000000
dqfma2317 fma 9000000000000000000 9000000000000000 0e+6144 -> 8.100000000000000000000000000000000E+34 Rounded
dqfma2318 fma 90000000000000000000 9000000000000000 0e+6144 -> 8.100000000000000000000000000000000E+35 Rounded
dqfma2319 fma 900000000000000000000 9000000000000000 0e+6144 -> 8.100000000000000000000000000000000E+36 Rounded
dqfma2320 fma 9000000000000000000000 9000000000000000 0e+6144 -> 8.100000000000000000000000000000000E+37 Rounded
dqfma2321 fma 90000000000000000000000 9000000000000000 0e+6144 -> 8.100000000000000000000000000000000E+38 Rounded
dqfma2322 fma 900000000000000000000000 9000000000000000 0e+6144 -> 8.100000000000000000000000000000000E+39 Rounded
dqfma2323 fma 9000000000000000000000000 9000000000000000 0e+6144 -> 8.100000000000000000000000000000000E+40 Rounded
-- tryzeros cases
dqfma2504 fma 0E-4260 1000E-4260 0e+6144 -> 0E-6176 Clamped
dqfma2505 fma 100E+4260 0E+4260 0e+6144 -> 0E+6111 Clamped
-- mixed with zeros
dqfma2541 fma 0 -1 0e+6144 -> 0
dqfma2542 fma -0 -1 0e+6144 -> 0
dqfma2543 fma 0 1 0e+6144 -> 0
dqfma2544 fma -0 1 0e+6144 -> 0
dqfma2545 fma -1 0 0e+6144 -> 0
dqfma2546 fma -1 -0 0e+6144 -> 0
dqfma2547 fma 1 0 0e+6144 -> 0
dqfma2548 fma 1 -0 0e+6144 -> 0
dqfma2551 fma 0.0 -1 0e+6144 -> 0.0
dqfma2552 fma -0.0 -1 0e+6144 -> 0.0
dqfma2553 fma 0.0 1 0e+6144 -> 0.0
dqfma2554 fma -0.0 1 0e+6144 -> 0.0
dqfma2555 fma -1.0 0 0e+6144 -> 0.0
dqfma2556 fma -1.0 -0 0e+6144 -> 0.0
dqfma2557 fma 1.0 0 0e+6144 -> 0.0
dqfma2558 fma 1.0 -0 0e+6144 -> 0.0
dqfma2561 fma 0 -1.0 0e+6144 -> 0.0
dqfma2562 fma -0 -1.0 0e+6144 -> 0.0
dqfma2563 fma 0 1.0 0e+6144 -> 0.0
dqfma2564 fma -0 1.0 0e+6144 -> 0.0
dqfma2565 fma -1 0.0 0e+6144 -> 0.0
dqfma2566 fma -1 -0.0 0e+6144 -> 0.0
dqfma2567 fma 1 0.0 0e+6144 -> 0.0
dqfma2568 fma 1 -0.0 0e+6144 -> 0.0
dqfma2571 fma 0.0 -1.0 0e+6144 -> 0.00
dqfma2572 fma -0.0 -1.0 0e+6144 -> 0.00
dqfma2573 fma 0.0 1.0 0e+6144 -> 0.00
dqfma2574 fma -0.0 1.0 0e+6144 -> 0.00
dqfma2575 fma -1.0 0.0 0e+6144 -> 0.00
dqfma2576 fma -1.0 -0.0 0e+6144 -> 0.00
dqfma2577 fma 1.0 0.0 0e+6144 -> 0.00
dqfma2578 fma 1.0 -0.0 0e+6144 -> 0.00
dqfma2579 fma 1.0 0.0 0e+6144 -> 0.00
dqfma2530 fma -1.0 -0.0 0e+6144 -> 0.00
dqfma2531 fma -1.0 0.0 0e+6144 -> 0.00
dqfma2532 fma 1.0 -0.0 -0e+6144 -> -0.00
dqfma2533 fma 1.0 0.0 -0e+6144 -> 0.00
dqfma2534 fma -1.0 -0.0 -0e+6144 -> 0.00
dqfma2535 fma -1.0 0.0 -0e+6144 -> -0.00
-- Specials
dqfma2580 fma Inf -Inf 0e+6144 -> -Infinity
dqfma2581 fma Inf -1000 0e+6144 -> -Infinity
dqfma2582 fma Inf -1 0e+6144 -> -Infinity
dqfma2583 fma Inf -0 0e+6144 -> NaN Invalid_operation
dqfma2584 fma Inf 0 0e+6144 -> NaN Invalid_operation
Loading ...