1 |
|
---|
2 | <HTML>
|
---|
3 |
|
---|
4 | <HEAD>
|
---|
5 | <TITLE>testsoftfloat</TITLE>
|
---|
6 | </HEAD>
|
---|
7 |
|
---|
8 | <BODY>
|
---|
9 |
|
---|
10 | <H1>Berkeley TestFloat Release 3e: <CODE>testsoftfloat</CODE></H1>
|
---|
11 |
|
---|
12 | <P>
|
---|
13 | John R. Hauser<BR>
|
---|
14 | 2018 January 20<BR>
|
---|
15 | </P>
|
---|
16 |
|
---|
17 |
|
---|
18 | <H2>Overview</H2>
|
---|
19 |
|
---|
20 | <P>
|
---|
21 | The <CODE>testsoftfloat</CODE> program tests that a build of the Berkeley
|
---|
22 | SoftFloat library conforms to the IEEE Standard for Binary Floating-Point
|
---|
23 | Arithmetic as expected.
|
---|
24 | Program <CODE>testsoftfloat</CODE> is part of the Berkeley TestFloat package, a
|
---|
25 | small collection of programs for performing such tests.
|
---|
26 | For general information about TestFloat, as well as for basics about the
|
---|
27 | operation of <CODE>testsoftfloat</CODE> and how to interpret its output, see
|
---|
28 | file
|
---|
29 | <A HREF="TestFloat-general.html"><NOBR><CODE>TestFloat-general.html</CODE></NOBR></A>.
|
---|
30 | </P>
|
---|
31 |
|
---|
32 | <P>
|
---|
33 | Note that, even if there are no bugs in the source code for SoftFloat (not
|
---|
34 | guaranteed), a build of SoftFloat might still fail due to an issue with the
|
---|
35 | build process, such as an incompatible compiler option or a compiler bug.
|
---|
36 | </P>
|
---|
37 |
|
---|
38 | <P>
|
---|
39 | The <CODE>testsoftfloat</CODE> program will ordinarily test a function for all
|
---|
40 | five rounding modes defined by the IEEE Floating-Point Standard, one after the
|
---|
41 | other, plus possibly a sixth mode, <I>round to odd</I> (depending on the
|
---|
42 | options selected when <CODE>testsoftfloat</CODE> was compiled).
|
---|
43 | If an operation is not supposed to require rounding, it will by default be
|
---|
44 | tested only with the rounding mode set to <CODE>near_even</CODE>
|
---|
45 | (nearest/even).
|
---|
46 | In the same way, if an operation is affected by the way in which underflow
|
---|
47 | tininess is detected, <CODE>testsoftfloat</CODE> tests the function with
|
---|
48 | tininess detected both before rounding and after rounding.
|
---|
49 | For <NOBR>80-bit</NOBR> double-extended-precision operations affected by
|
---|
50 | rounding precision control, <CODE>testsoftfloat</CODE> also tests the function
|
---|
51 | for all three rounding precision modes, one after the other.
|
---|
52 | Testing can be limited to a single rounding mode, a single tininess mode,
|
---|
53 | and/or a single rounding precision with appropriate command-line options.
|
---|
54 | </P>
|
---|
55 |
|
---|
56 |
|
---|
57 | <H2>Command Syntax</H2>
|
---|
58 |
|
---|
59 | <P>
|
---|
60 | The <CODE>testsoftfloat</CODE> program is executed as a command with this
|
---|
61 | syntax:
|
---|
62 | <BLOCKQUOTE>
|
---|
63 | <PRE>
|
---|
64 | testsoftfloat [<<I>option</I>>...] <<I>function</I>>
|
---|
65 | </PRE>
|
---|
66 | </BLOCKQUOTE>
|
---|
67 | Square brackets (<CODE>[ ]</CODE>) denote optional arguments,
|
---|
68 | <CODE><<I>option</I>></CODE> is a supported option, and
|
---|
69 | <CODE><<I>function</I>></CODE> is the name of either a testable function
|
---|
70 | or a function set.
|
---|
71 | The available options and function sets are documented below.
|
---|
72 | If <CODE>testsoftfloat</CODE> is executed without any arguments, a summary of
|
---|
73 | usage is written.
|
---|
74 | </P>
|
---|
75 |
|
---|
76 |
|
---|
77 | <H2>Options</H2>
|
---|
78 |
|
---|
79 | <P>
|
---|
80 | The <CODE>testsoftfloat</CODE> program accepts several command options.
|
---|
81 | If mutually contradictory options are given, the last one has priority.
|
---|
82 | </P>
|
---|
83 |
|
---|
84 | <H3><CODE>-help</CODE></H3>
|
---|
85 |
|
---|
86 | <P>
|
---|
87 | The <CODE>-help</CODE> option causes a summary of program usage to be written,
|
---|
88 | after which the program exits.
|
---|
89 | </P>
|
---|
90 |
|
---|
91 | <H3><CODE>-seed <<I>num</I>></CODE></H3>
|
---|
92 |
|
---|
93 | <P>
|
---|
94 | The <CODE>-seed</CODE> option sets the seed for the pseudo-random number
|
---|
95 | generator used for generating test cases.
|
---|
96 | The argument to <CODE>-seed</CODE> is a nonnegative integer.
|
---|
97 | Executing the same <CODE>testsoftfloat</CODE> program with the same arguments
|
---|
98 | (including the same pseudo-random number seed) should always perform the same
|
---|
99 | sequence of tests, whereas changing the pseudo-random number seed should result
|
---|
100 | in a different sequence of tests.
|
---|
101 | The default seed number <NOBR>is 1</NOBR>.
|
---|
102 | </P>
|
---|
103 |
|
---|
104 | <H3><CODE>-level <<I>num</I>></CODE></H3>
|
---|
105 |
|
---|
106 | <P>
|
---|
107 | The <CODE>-level</CODE> option sets the level of testing.
|
---|
108 | The argument to <CODE>-level</CODE> can be either 1 <NOBR>or 2</NOBR>.
|
---|
109 | The default is <NOBR>level 1</NOBR>.
|
---|
110 | Level 2 performs many more tests than <NOBR>level 1</NOBR> and thus can reveal
|
---|
111 | bugs not found by <NOBR>level 1</NOBR>.
|
---|
112 | </P>
|
---|
113 |
|
---|
114 | <H3><CODE>-errors <<I>num</I>></CODE></H3>
|
---|
115 |
|
---|
116 | <P>
|
---|
117 | The <CODE>-errors</CODE> option instructs <CODE>testsoftfloat</CODE> to report
|
---|
118 | no more than the specified number of errors for any combination of function,
|
---|
119 | rounding mode, etc.
|
---|
120 | The argument to <CODE>-errors</CODE> must be a nonnegative decimal integer.
|
---|
121 | Once the specified number of error reports has been generated,
|
---|
122 | <CODE>testsoftfloat</CODE> ends the current test and begins the next one, if
|
---|
123 | any.
|
---|
124 | The default is <NOBR><CODE>-errors</CODE> <CODE>20</CODE></NOBR>.
|
---|
125 | </P>
|
---|
126 |
|
---|
127 | <P>
|
---|
128 | Against intuition, <NOBR><CODE>-errors</CODE> <CODE>0</CODE></NOBR> causes
|
---|
129 | <CODE>testsoftfloat</CODE> to report every error it finds.
|
---|
130 | </P>
|
---|
131 |
|
---|
132 | <H3><CODE>-errorstop</CODE></H3>
|
---|
133 |
|
---|
134 | <P>
|
---|
135 | The <CODE>-errorstop</CODE> option causes the program to exit after the first
|
---|
136 | function for which any errors are reported.
|
---|
137 | </P>
|
---|
138 |
|
---|
139 | <H3><CODE>-forever</CODE></H3>
|
---|
140 |
|
---|
141 | <P>
|
---|
142 | The <CODE>-forever</CODE> option causes a single function to be repeatedly
|
---|
143 | tested.
|
---|
144 | Only one rounding mode and/or rounding precision can be tested in a single
|
---|
145 | execution.
|
---|
146 | If not specified, the rounding mode defaults to nearest/even.
|
---|
147 | For <NOBR>80-bit</NOBR> double-extended-precision functions, the rounding
|
---|
148 | precision defaults to full double-extended precision.
|
---|
149 | The testing level is set to 2 by this option.
|
---|
150 | </P>
|
---|
151 |
|
---|
152 | <H3><CODE>-precision32, -precision64, -precision80</CODE></H3>
|
---|
153 |
|
---|
154 | <P>
|
---|
155 | For <NOBR>80-bit</NOBR> double-extended-precision funcions affected by
|
---|
156 | rounding precision control, the <CODE>-precision32</CODE> option restricts
|
---|
157 | testing to only the cases in which the rounding precision is
|
---|
158 | <NOBR>32 bits</NOBR>, equivalent to <NOBR>32-bit</NOBR> single-precision.
|
---|
159 | The other rounding precision choices are not tested.
|
---|
160 | Likewise, <CODE>-precision64</CODE> fixes the rounding precision to
|
---|
161 | <NOBR>64 bits</NOBR>, equivalent to <NOBR>64-bit</NOBR> double-precision;
|
---|
162 | and <CODE>-precision80</CODE> fixes the rounding precision to the full
|
---|
163 | <NOBR>80 bits</NOBR> of the double-extended-precision format.
|
---|
164 | All these options are ignored for operations not affected by rounding precision
|
---|
165 | control.
|
---|
166 | </P>
|
---|
167 |
|
---|
168 | <H3><CODE>-rnear_even, -rnear_maxMag, -rminMag, -rmin, -rmax, -rodd</CODE></H3>
|
---|
169 |
|
---|
170 | <P>
|
---|
171 | The <CODE>-rnear_even</CODE> option restricts testing to only the cases in
|
---|
172 | which the rounding mode is nearest/even.
|
---|
173 | The other rounding mode choices are not tested.
|
---|
174 | Likewise, <CODE>-rnear_maxMag</CODE> forces rounding to nearest/maximum
|
---|
175 | magnitude (nearest-away), <CODE>-rminMag</CODE> forces rounding to minimum
|
---|
176 | magnitude (toward zero), <CODE>-rmin</CODE> forces rounding to minimum (down,
|
---|
177 | toward negative infinity), <CODE>-rmax</CODE> forces rounding to maximum (up,
|
---|
178 | toward positive infinity), and <CODE>-rodd</CODE>, if supported, forces
|
---|
179 | rounding to odd.
|
---|
180 | These options are ignored for operations that are exact and thus do not round.
|
---|
181 | </P>
|
---|
182 |
|
---|
183 | <H3><CODE>-tininessbefore, -tininessafter</CODE></H3>
|
---|
184 |
|
---|
185 | <P>
|
---|
186 | The <CODE>-tininessbefore</CODE> option restricts testing to only the cases in
|
---|
187 | which tininess on underflow is detected before rounding.
|
---|
188 | Likewise, <CODE>-tininessafter</CODE> restricts testing to only the cases in
|
---|
189 | which tininess on underflow is detected after rounding.
|
---|
190 | </P>
|
---|
191 |
|
---|
192 | <H3><CODE>-notexact, -exact</CODE></H3>
|
---|
193 |
|
---|
194 | <P>
|
---|
195 | For functions that round to an integer (conversions to integer types and the
|
---|
196 | <CODE>roundToInt</CODE> functions), the <CODE>-notexact</CODE> option restricts
|
---|
197 | testing to only the cases for which the <CODE><I>exact</I></CODE> operand
|
---|
198 | (specifying whether the <I>inexact</I> exception flag may be raised) is
|
---|
199 | <CODE>false</CODE>.
|
---|
200 | Likewise, the <CODE>-exact</CODE> option restricts testing to only the cases
|
---|
201 | for which the <CODE><I>exact</I></CODE> operand is <CODE>true</CODE>.
|
---|
202 | </P>
|
---|
203 |
|
---|
204 |
|
---|
205 | <H2>Function Sets</H2>
|
---|
206 |
|
---|
207 | <P>
|
---|
208 | Just as <CODE>testsoftfloat</CODE> can test a function for all five or six
|
---|
209 | rounding modes in sequence, multiple functions can be tested with a single
|
---|
210 | execution of <CODE>testsoftfloat</CODE>.
|
---|
211 | Two sets are recognized: <CODE>-all1</CODE> and <CODE>-all2</CODE>.
|
---|
212 | The set <CODE>-all1</CODE> is all one-operand operations, while
|
---|
213 | <CODE>-all2</CODE> is all two-operand operations.
|
---|
214 | A function set is used in place of a function name in the
|
---|
215 | <CODE>testsoftfloat</CODE> command line, such as
|
---|
216 | <BLOCKQUOTE>
|
---|
217 | <PRE>
|
---|
218 | testsoftfloat [<<I>option</I>>...] -all1
|
---|
219 | </PRE>
|
---|
220 | </BLOCKQUOTE>
|
---|
221 | </P>
|
---|
222 |
|
---|
223 | <P>
|
---|
224 | For the purpose of deciding the number of operands of an operation, any
|
---|
225 | <CODE><I>roundingMode</I></CODE> and <CODE><I>exact</I></CODE> arguments are
|
---|
226 | ignored.
|
---|
227 | (Such arguments specify the rounding mode and whether the <I>inexact</I>
|
---|
228 | exception flag may be raised, respectively.)
|
---|
229 | Thus, functions that convert to integer type and the <CODE>roundToInt</CODE>
|
---|
230 | functions are included in the set of one-operand operations tested by
|
---|
231 | <CODE>-all1</CODE>.
|
---|
232 | </P>
|
---|
233 |
|
---|
234 |
|
---|
235 | </BODY>
|
---|
236 |
|
---|