VirtualBox

source: vbox/trunk/src/libs/softfloat-3e/testfloat/doc/testfloat.html

Last change on this file was 94551, checked in by vboxsync, 3 years ago

libs/softfloat: Copied TestFloat-3e from vendor branch and to testfloat subdir. bugref:9898

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/html
File size: 10.3 KB
Line 
1
2<HTML>
3
4<HEAD>
5<TITLE>testfloat</TITLE>
6</HEAD>
7
8<BODY>
9
10<H1>Berkeley TestFloat Release 3e: <CODE>testfloat</CODE></H1>
11
12<P>
13John R. Hauser<BR>
142018 January 20<BR>
15</P>
16
17
18<H2>Overview</H2>
19
20<P>
21The <CODE>testfloat</CODE> program tests an implementation of floating-point
22arithmetic for conformity to the IEEE Standard for Binary Floating-Point
23Arithmetic.
24<CODE>testfloat</CODE> is part of the Berkeley TestFloat package, a small
25collection of programs for performing such tests.
26For general information about TestFloat, see file
27<A HREF="TestFloat-general.html"><NOBR><CODE>TestFloat-general.html</CODE></NOBR></A>.
28</P>
29
30<P>
31The <CODE>testfloat</CODE> program is an all-in-one tool for testing
32floating-point arithmetic.
33It generates test operand values, invokes a floating-point operation with the
34generated operands, and examines the corresponding computed results, reporting
35unexpected results as likely errors.
36While the processes of generating inputs and examining results are generic, a
37particular build of <CODE>testfloat</CODE> is limited to testing only the one
38implementation of floating-point it has been compiled to invoke.
39For example, while one instance of <CODE>testfloat</CODE> might be compiled to
40execute a computer&rsquo;s hardware instruction for floating-point addition, a
41different version might be compiled to call a subroutine called
42<CODE>myAddFloat</CODE> that is linked into the <CODE>testfloat</CODE> program.
43To test a new implementation of floating-point (a new set of machine
44instructions or a new set of subroutines), a new <CODE>testfloat</CODE> must be
45compiled containing the code needed to invoke the new floating-point.
46</P>
47
48<P>
49The default build of <CODE>testfloat</CODE> assumes that C types
50<CODE>float</CODE> and <CODE>double</CODE> are <NOBR>32-bit</NOBR> and
51<NOBR>64-bit</NOBR> binary floating-point types conforming to the IEEE
52Standard, and tests the C operations of <CODE>+</CODE>, <CODE>-</CODE>,
53<CODE>*</CODE>, <CODE>/</CODE>, type conversions, etc.
54This tests the floating-point arithmetic seen by C programs.
55Depending on the compiler and the options selected during compilation, this may
56or may not be the same as the computer&rsquo;s floating-point hardware, if any.
57</P>
58
59<P>
60The <CODE>testfloat</CODE> program will ordinarily test an operation for all
61five rounding modes defined by the IEEE Floating-Point Standard, one after the
62other, plus possibly a sixth mode, <I>round to odd</I> (depending on the
63options selected when <CODE>testfloat</CODE> was compiled).
64If the rounding mode is not supposed to have any affect on the
65results&mdash;for instance, some operations do not require rounding&mdash;only
66the nearest/even rounding mode is checked.
67For double-extended-precision operations affected by rounding precision
68control, <CODE>testfloat</CODE> also tests all three rounding precision modes,
69one after the other.
70Testing can be limited to a single rounding mode and/or rounding precision with
71appropriate command-line options.
72</P>
73
74<P>
75For more about the operation of <CODE>testfloat</CODE> and how to interpret its
76output, refer to
77<A HREF="TestFloat-general.html"><NOBR><CODE>TestFloat-general.html</CODE></NOBR></A>.
78</P>
79
80
81<H2>Command Syntax</H2>
82
83<P>
84The <CODE>testfloat</CODE> program is executed as a command with this syntax:
85<BLOCKQUOTE>
86<PRE>
87testfloat [&lt;<I>option</I>&gt;...] &lt;<I>function</I>&gt;
88</PRE>
89</BLOCKQUOTE>
90Square brackets (<CODE>[ ]</CODE>) denote optional arguments,
91<CODE>&lt;<I>option</I>&gt;</CODE> is a supported option, and
92<CODE>&lt;<I>function</I>&gt;</CODE> is the name of either a testable operation
93or a function set.
94The available options and function sets are documented below.
95The <CODE>-list</CODE> option can be used to obtain a list of all testable
96operations for a given build of <CODE>testfloat</CODE>.
97If <CODE>testfloat</CODE> is executed without any arguments, a summary of usage
98is written.
99</P>
100
101
102<H2>Options</H2>
103
104<P>
105The <CODE>testfloat</CODE> program accepts several command options.
106If mutually contradictory options are given, the last one has priority.
107</P>
108
109<H3><CODE>-help</CODE></H3>
110
111<P>
112The <CODE>-help</CODE> option causes a summary of program usage to be written,
113after which the program exits.
114</P>
115
116<H3><CODE>-list</CODE></H3>
117
118<P>
119The <CODE>-list</CODE> option causes a list of testable operations to be
120written, after which the program exits.
121An operation is testable by <CODE>testfloat</CODE> if the program knows some
122way to invoke the operation.
123</P>
124
125<H3><CODE>-seed &lt;<I>num</I>&gt;</CODE></H3>
126
127<P>
128The <CODE>-seed</CODE> option sets the seed for the pseudo-random number
129generator used for generating test cases.
130The argument to <CODE>-seed</CODE> is a nonnegative integer.
131Executing the same compiled <CODE>testfloat</CODE> program with the same
132arguments (including the same pseudo-random number seed) should always perform
133the same sequence of tests, whereas changing the pseudo-random number seed
134should result in a different sequence of tests.
135The default seed number <NOBR>is 1</NOBR>.
136</P>
137
138<H3><CODE>-level &lt;<I>num</I>&gt;</CODE></H3>
139
140<P>
141The <CODE>-level</CODE> option sets the level of testing.
142The argument to <CODE>-level</CODE> can be either 1 <NOBR>or 2</NOBR>.
143The default is <NOBR>level 1</NOBR>.
144Level 2 performs many more tests than <NOBR>level 1</NOBR> and thus can reveal
145bugs not found by <NOBR>level 1</NOBR>.
146</P>
147
148<H3><CODE>-errors &lt;<I>num</I>&gt;</CODE></H3>
149
150<P>
151The <CODE>-errors</CODE> option instructs <CODE>testfloat</CODE> to report no
152more than the specified number of errors for any combination of operation,
153rounding mode, etc.
154The argument to <CODE>-errors</CODE> must be a nonnegative decimal integer.
155Once the specified number of error reports has been generated,
156<CODE>testfloat</CODE> ends the current test and begins the next one, if any.
157The default is <NOBR><CODE>-errors</CODE> <CODE>20</CODE></NOBR>.
158</P>
159
160<P>
161Against intuition, <NOBR><CODE>-errors</CODE> <CODE>0</CODE></NOBR> causes
162<CODE>testfloat</CODE> to report every error it finds.
163</P>
164
165<H3><CODE>-errorstop</CODE></H3>
166
167<P>
168The <CODE>-errorstop</CODE> option causes the program to exit after the first
169operation for which any errors are reported.
170</P>
171
172<H3><CODE>-forever</CODE></H3>
173
174<P>
175The <CODE>-forever</CODE> option causes a single operation to be repeatedly
176tested.
177Only one rounding mode and/or rounding precision can be tested in a single
178execution.
179If not specified, the rounding mode defaults to nearest/even.
180For <NOBR>80-bit</NOBR> double-extended-precision operations, the rounding
181precision defaults to full double-extended precision.
182The testing level is set to 2 by this option.
183</P>
184
185<H3><CODE>-checkNaNs</CODE></H3>
186
187<P>
188The <CODE>-checkNaNs</CODE> option causes <CODE>testfloat</CODE> to verify the
189bitwise correctness of NaN results.
190In order for this option to be sensible, <CODE>testfloat</CODE> must have been
191compiled so that its internal reference implementation of floating-point
192(Berkeley SoftFloat) generates the proper NaN results for the system being
193tested.
194</P>
195
196<H3><CODE>-checkInvInts</CODE></H3>
197
198<P>
199The <CODE>-checkInvInts</CODE> option causes <CODE>testfloat</CODE> to verify
200the bitwise correctness of integer results of invalid operations.
201In order for this option to be sensible, <CODE>testfloat</CODE> must have been
202compiled so that its internal reference implementation of floating-point
203(Berkeley SoftFloat) generates the proper integer results for the system being
204tested.
205</P>
206
207<H3><CODE>-checkAll</CODE></H3>
208
209<P>
210Enables both <CODE>-checkNaNs</CODE> and <CODE>-checkInvInts</CODE>.
211</P>
212
213<H3><CODE>-precision32, -precision64, -precision80</CODE></H3>
214
215<P>
216For <NOBR>80-bit</NOBR> double-extended-precision operations affected by
217rounding precision control, the <CODE>-precision32</CODE> option restricts
218testing to only the cases in which the rounding precision is
219<NOBR>32 bits</NOBR>, equivalent to <NOBR>32-bit</NOBR> single-precision.
220The other rounding precision choices are not tested.
221Likewise, <CODE>-precision64</CODE> fixes the rounding precision to
222<NOBR>64 bits</NOBR>, equivalent to <NOBR>64-bit</NOBR> double-precision, and
223<CODE>-precision80</CODE> fixes the rounding precision to the full
224<NOBR>80 bits</NOBR> of the double-extended-precision format.
225All these options are ignored for operations not affected by rounding precision
226control.
227</P>
228
229<P>
230The precision-control options may not be supported at all if no
231double-extended-precision operations are testable.
232</P>
233
234<H3><CODE>-rnear_even, -rnear_maxMag, -rminMag, -rmin, -rmax, -rodd</CODE></H3>
235
236<P>
237The <CODE>-rnear_even</CODE> option restricts testing to only the cases in
238which the rounding mode is nearest/even.
239The other rounding mode choices are not tested.
240Likewise, <CODE>-rnear_maxMag</CODE> forces rounding to nearest/maximum
241magnitude (nearest-away), <CODE>-rminMag</CODE> forces rounding to minimum
242magnitude (toward zero), <CODE>-rmin</CODE> forces rounding to minimum (down,
243toward negative infinity), <CODE>-rmax</CODE> forces rounding to maximum (up,
244toward positive infinity), and <CODE>-rodd</CODE>, if supported, forces
245rounding to odd.
246These options are ignored for operations that are exact and thus do not round,
247or that have the rounding mode included in the function name (such as
248<CODE>f32_to_i32_r_near_maxMag</CODE>).
249</P>
250
251<H3><CODE>-tininessbefore, -tininessafter</CODE></H3>
252
253<P>
254The <CODE>-tininessbefore</CODE> option indicates that the floating-point
255implementation being tested detects tininess on underflow before rounding.
256The <CODE>-tininessafter</CODE> option indicates that tininess is detected
257after rounding.
258The <CODE>testfloat</CODE> program alters its expectations accordingly.
259These options override the default selected when <CODE>testfloat</CODE> was
260compiled.
261Choosing the wrong one of these two options should cause error reports for some
262(but not all) operations.
263</P>
264
265
266<H2>Function Sets</H2>
267
268<P>
269Just as <CODE>testfloat</CODE> can test an operation for all five or six
270rounding modes in sequence, multiple operations can be tested with a single
271execution of <CODE>testfloat</CODE>.
272Two sets are recognized: <CODE>-all1</CODE> and <CODE>-all2</CODE>.
273The set <CODE>-all1</CODE> is all one-operand operations, while
274<CODE>-all2</CODE> is all two-operand operations.
275A function set is used in place of an operation name in the
276<CODE>testfloat</CODE> command line, such as
277<BLOCKQUOTE>
278<PRE>
279testfloat [&lt;<I>option</I>&gt;...] -all1
280</PRE>
281</BLOCKQUOTE>
282</P>
283
284
285</BODY>
286
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette