1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
|
<HTML>
<HEAD>
<TITLE>testfloat_ver</TITLE>
</HEAD>
<BODY>
<H1>Berkeley TestFloat Release 3e: <CODE>testfloat_ver</CODE></H1>
<P>
John R. Hauser<BR>
2018 January 20<BR>
</P>
<H2>Overview</H2>
<P>
The <CODE>testfloat_ver</CODE> program accepts test-case results obtained from
exercising an implementation of floating-point arithmetic and verifies that
those results conform to the IEEE Standard for Binary Floating-Point
Arithmetic.
<CODE>testfloat_ver</CODE> is part of the Berkeley TestFloat package, a small
collection of programs for performing such tests.
For general information about TestFloat, see file
<A HREF="TestFloat-general.html"><NOBR><CODE>TestFloat-general.html</CODE></NOBR></A>.
</P>
<P>
A single execution of <CODE>testfloat_ver</CODE> verifies results for only a
single floating-point operation and associated options.
The <CODE>testfloat_ver</CODE> program must be repeatedly executed to verify
results for each operation to be tested.
</P>
<P>
The test cases to be verified are read by <CODE>testfloat_ver</CODE> from
standard input.
This input will typically be piped from another program that, for each test
case, invokes the floating-point operation and writes out the results.
The format of <CODE>testfloat_ver</CODE>’s input is raw hexadecimal text,
described in the section below titled <I>Input Format</I>.
</P>
<P>
For each test case given to it, <CODE>testfloat_ver</CODE> examines the
computed results and reports any unexpected results as likely errors.
For more about the operation of <CODE>testfloat_ver</CODE> and how to interpret
its output, refer to
<A HREF="TestFloat-general.html"><NOBR><CODE>TestFloat-general.html</CODE></NOBR></A>.
</P>
<H2>Command Syntax</H2>
<P>
The <CODE>testfloat_ver</CODE> program is executed as a command with this
syntax:
<BLOCKQUOTE>
<PRE>
testfloat_ver [<<I>option</I>>...] <<I>function</I>>
</PRE>
</BLOCKQUOTE>
Square brackets (<CODE>[ ]</CODE>) denote optional arguments,
<CODE><<I>option</I>></CODE> is a supported option, and
<CODE><<I>function</I>></CODE> is the name of a testable operation.
The available options are documented below.
The testable operation names are listed in
<A HREF="TestFloat-general.html"><NOBR><CODE>TestFloat-general.html</CODE></NOBR></A>.
If <CODE>testfloat_ver</CODE> is executed without any arguments, a summary of
usage is written.
</P>
<H2>Options</H2>
<P>
The <CODE>testfloat_ver</CODE> program accepts several command options.
If mutually contradictory options are given, the last one has priority.
</P>
<H3><CODE>-help</CODE></H3>
<P>
The <CODE>-help</CODE> option causes a summary of program usage to be written,
after which the program exits.
</P>
<H3><CODE>-errors <<I>num</I>></CODE></H3>
<P>
The <CODE>-errors</CODE> option instructs <CODE>testfloat_ver</CODE> to report
no more than the specified number of errors.
The argument to <CODE>-errors</CODE> must be a nonnegative decimal integer.
Once the specified number of error reports has been generated, the program
exits.
The default is <NOBR><CODE>-errors</CODE> <CODE>20</CODE></NOBR>.
</P>
<P>
Against intuition, <NOBR><CODE>-errors</CODE> <CODE>0</CODE></NOBR> causes
<CODE>testfloat_ver</CODE> to continue for any number of errors.
</P>
<H3><CODE>-checkNaNs</CODE></H3>
<P>
The <CODE>-checkNaNs</CODE> option causes <CODE>testfloat_ver</CODE> to verify
the bitwise correctness of NaN results.
In order for this option to be sensible, <CODE>testfloat_ver</CODE> must have
been compiled so that its internal reference implementation of floating-point
(Berkeley SoftFloat) generates the proper NaN results for the system being
tested.
</P>
<H3><CODE>-checkInvInts</CODE></H3>
<P>
The <CODE>-checkInvInts</CODE> option causes <CODE>testfloat_ver</CODE> to
verify the bitwise correctness of integer results of invalid operations.
In order for this option to be sensible, <CODE>testfloat_ver</CODE> must have
been compiled so that its internal reference implementation of floating-point
(Berkeley SoftFloat) generates the proper integer results for the system being
tested.
</P>
<H3><CODE>-checkAll</CODE></H3>
<P>
Enables both <CODE>-checkNaNs</CODE> and <CODE>-checkInvInts</CODE>.
</P>
<H3><CODE>-precision32, -precision64, -precision80</CODE></H3>
<P>
When <CODE><<I>function</I>></CODE> is an <NOBR>80-bit</NOBR>
double-extended-precision operation affected by rounding precision control, the
<CODE>-precision32</CODE> option indicates that the rounding precision should
be <NOBR>32 bits</NOBR>, equivalent to <NOBR>32-bit</NOBR> single-precision.
Likewise, <CODE>-precision64</CODE> indicates that the rounding precision
should be <NOBR>64 bits</NOBR>, equivalent to <NOBR>64-bit</NOBR>
double-precision, and <CODE>-precision80</CODE> indicates that the rounding
precision should be the full <NOBR>80 bits</NOBR> of the
double-extended-precision format.
All these options are ignored for operations not affected by rounding precision
control.
When rounding precision is applicable but not specified, the default assumption
is the full <NOBR>80 bits</NOBR>, same as <CODE>-precision80</CODE>.
</P>
<H3><CODE>-rnear_even, -rnear_maxMag, -rminMag, -rmin, -rmax, -rodd</CODE></H3>
<P>
When <CODE><<I>function</I>></CODE> is an operation that requires
rounding, the <CODE>-rnear_even</CODE> option indicates that rounding should be
to nearest/even, <CODE>-rnear_maxMag</CODE> indicates rounding to
nearest/maximum magnitude (nearest-away), <CODE>-rminMag</CODE> indicates
rounding to minimum magnitude (toward zero), <CODE>-rmin</CODE> indicates
rounding to minimum (down, toward negative infinity), <CODE>-rmax</CODE>
indicates rounding to maximum (up, toward positive infinity), and
<CODE>-rodd</CODE>, if supported, indicates rounding to odd.
These options are ignored for operations that are exact and thus do not round.
When rounding mode is relevant but not specified, the default assumption is
rounding to nearest/even, same as <CODE>-rnear_even</CODE>.
</P>
<H3><CODE>-tininessbefore, -tininessafter</CODE></H3>
<P>
When <CODE><<I>function</I>></CODE> is an operation that requires
rounding, the <CODE>-tininessbefore</CODE> option indicates that tininess on
underflow should be detected before rounding, while <CODE>-tininessafter</CODE>
indicates that tininess on underflow should be detected after rounding.
These options are ignored for operations that are exact and thus do not round.
When the method of tininess detection matters but is not specified, the default
assumption is that tininess should be detected after rounding, same as
<CODE>-tininessafter</CODE>.
</P>
<H3><CODE>-notexact, -exact</CODE></H3>
<P>
When <CODE><<I>function</I>></CODE> is an operation that rounds to an
integer (either conversion to an integer type or a <CODE>roundToInt</CODE>
operation), the <CODE>-notexact</CODE> option indicates that the <I>inexact</I>
exception flag should never be raised, while <CODE>-exact</CODE> indicates that
the <I>inexact</I> exception flag should be raised when the result is inexact.
For other operations, these options are ignored.
If neither option is specified, the default assumption is that the
<I>inexact</I> exception flag should not be raised when rounding to an integer,
same as <CODE>-notexact</CODE>.
</P>
<H2>Input Format</H2>
<P>
For a given <CODE><<I>function</I>></CODE> argument, the input format
expected by <CODE>testfloat_ver</CODE> is the same as the output generated by
program
<A HREF="testfloat_gen.html"><NOBR><CODE>testfloat_gen</CODE></NOBR></A> for
the same argument.
</P>
<P>
Input to <CODE>testfloat_ver</CODE> is expected to be text, with each line
containing the data for one test case.
The number of input lines thus equals the number of test cases.
A single test case is organized as follows: first are the operands for the
operation, next is the result value obtained, and last is a number indicating
the exception flags that were raised.
These values are all expected to be provided as raw hexadecimal numbers
separated on the line by spaces.
For example, for the command
<BLOCKQUOTE>
<PRE>
testfloat_ver f64_add
</PRE>
</BLOCKQUOTE>
valid input could include these lines:
<BLOCKQUOTE>
<PRE>
3F90EB5825D6851E C3E0080080000000 C3E0080080000000 01
41E3C00000000000 C182024F8AE474A8 41E377F6C1D46E2D 01
7FD80FFFFFFFFFFF 7FEFFFFFFFFFFF80 7FF0000000000000 05
3FFFED6A25C534BE 3CA1000000020000 3FFFED6A25C534BF 01
...
</PRE>
</BLOCKQUOTE>
On each line above, the first two hexadecimal numbers represent the
<NOBR>64-bit</NOBR> floating-point operands, the third hexadecimal number is
the <NOBR>64-bit</NOBR> floating-point result of the operation (the sum), and
the last hexadecimal number gives the exception flags that were raised by the
operation.
</P>
<P>
Note that, for floating-point values, the sign and exponent are at the
most-significant end of the number.
Thus, for the first number on the first line above, the leading hexadecimal
digits <CODE>3F9</CODE> are the sign and encoded exponent of the
<NOBR>64-bit</NOBR> floating-point value, and the remaining digits are the
encoded significand.
</P>
<P>
Exception flags are encoded with one bit per flag as follows:
<BLOCKQUOTE>
<TABLE CELLSPACING=0 CELLPADDING=0>
<TR>
<TD>bit 0<CODE> </CODE></TD>
<TD><I>inexact</I> exception</TD>
</TR>
<TR><TD>bit 1</TD><TD><I>underflow</I> exception</TD></TR>
<TR><TD>bit 2</TD><TD><I>overflow</I> exception</TD></TR>
<TR>
<TD>bit 3</TD>
<TD><I>infinite</I> exception (“divide by zero”)</TD>
</TR>
<TR><TD>bit 4</TD><TD><I>invalid</I> exception</TD></TR>
</TABLE>
</BLOCKQUOTE>
</P>
</BODY>
|