VirtualBox

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

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