2 ##########################################################################
7 # IeeeCC754 or IEEE 754 Compliance Checker is a precision and range #
8 # independent tool to test whether an implementation of #
9 # floating-point arithmetic (in hardware or software) is compliant #
10 # with the principles of the IEEE 754-854 floating-point standards. #
11 # You can find out more about the testing tool IeeeCC754 at #
13 # http://win-www.uia.ac.be/u/cant/ieeecc754.html #
15 # This tool is in parts based on and greatly benefited from the #
16 # the program FPTEST developed by Jerome Coonen. For a full #
17 # description of the extensions to FPTEST and a reference to #
18 # the original Coonen program, please refer to the URL given above. #
19 # For the options available with the program IeeeCC754 and its #
20 # compatibility with David Hough's hexadecimal UCB format, we #
21 # also refer to the file readme.usage. #
23 # Usage: see readme.usage #
25 # Responsible authors: #
30 # Johan Bogo (1998-1999) #
31 # Tim Gevers (10-12/2000) #
32 # Debby Ooms (1996-1997) #
33 # Geert Vermuyten (1996-1997) #
34 # Dennis Verschaeren (09/1996-06/2000) #
36 # Copyright (C) 2000 University of Antwerp #
38 # This program can be obtained from the authors, free, but WITHOUT ANY #
39 # WARRANTY; without even the implied warranty of MERCHANTABILITY or #
40 # FITNESS FOR A PARTICULAR PURPOSE. #
43 # Brigitte.Verdonk@uia.ua.ac.be #
44 # Department of Mathematics and Computer Science #
45 # University of Antwerp (UIA) #
46 # Universiteitsplein 1 #
47 # B2610 Antwerp, BELGIUM #
49 ##########################################################################
60 /* MORE INFORMATION ON THE FUNCTIONS IN THIS HEADER FILE CAN BE FOUND */
62 /* http://win-www.uia.ac.be/u/cant/ieeecc754.html */
63 /* ``Adapt IeeeCC754 to test your floating-point implementation'' */
70 #include <Bitstring.h>
73 /* Includes and Defines specificly for testing MpIeee */
80 /* Includes and Defines specificly for testing FMLib */
87 /* CLASS DEFINITION : DriverFloatRepr */
91 class DriverFloatRepr: public FP
96 /* call the appropriate functions to set the rounding mode */
97 /* on the target platform - see item (a) on webpage */
99 void SetLibEnvironment( );
100 /* call the appropriate functions to clear all floating-point */
101 /* exceptions on the target platform - see item (b) on webpage */
103 void GetLibExceptions( );
104 /* call the appropriate functions to read out exceptions generated */
105 /* by the target platform - see item (b) on webpage */
110 /* For testing FMLib we use other definitions */
112 DriverFloatRepr::DriverFloatRepr( ) :FP( )
115 DriverFloatRepr::DriverFloatRepr( int m,int e,int h ) :FP( m,e,h )
118 DriverFloatRepr::DriverFloatRepr( Bitstring &fp,int m,int e,int h ) :FP( fp,m,e,h )
123 /* If your target implementation is implemented in hardware, */
124 /* provide an implementation of the functions listed below for */
125 /* conversion between your hardware data types and DriverFloatRepr */
126 /* see item (c) on webpage and */
127 /* ftp://win-ftp.uia.ac.be/pub/cant/IeeeCC754/converting.pdf */
129 DriverFloatRepr( float f );
130 DriverFloatRepr( double d );
131 DriverFloatRepr( long double l );
134 long double tolongdouble( );
137 /* If your target implementation is implemented in software, */
138 /* provide an implementation of the functions listed below for */
139 /* conversion between your floating-point datatype and */
140 // DriverFloatRepr (don't forget to replace MyDatatype by the
141 /* appropriate identifier in this declaration) - see item (c) on */
143 /* ftp://win-ftp.uia.ac.be/pub/cant/IeeeCC754/converting.pdf */
145 DriverFloatRepr (void *val);
151 /* Here is an example to test the multiprecision floating-point */
152 /* implementation MpIeee: */
155 /* Functions that Convert MpIeee to DriverFloatRepr and vice-versa */
158 DriverFloatRepr ( const MpIeee &M );
164 /* Functions specifically for Testing FMLib */
167 DriverFloatRepr::DriverFloatRepr( );
168 DriverFloatRepr::DriverFloatRepr( int m,int e,int h );
169 DriverFloatRepr::DriverFloatRepr( Bitstring &fp,int m,int e,int h );
170 DriverFloatRepr::DriverFloatRepr( DriverFloatRepr& );
171 void DriverFloatRepr::fromDriverFloatRepr( Bitstring& m,Bitstring& e,int h );
172 void DriverFloatRepr::toDriverFloatRepr( Bitstring m,Bitstring e,int h, int signf );
175 char* byteToStr( long );
176 void Reverse( Bitstring& );
177 void SetOperations( );
181 /* provide implementaton of the functions listed below in the file */
182 /* BasicOperations/$PLATFORM/BasicOperationstest.cc */
183 /* see item (d) on webpage */
186 DriverFloatRepr operator + ( DriverFloatRepr &T );
187 DriverFloatRepr operator - ( DriverFloatRepr &T );
188 DriverFloatRepr operator * ( DriverFloatRepr &T );
189 DriverFloatRepr operator / ( DriverFloatRepr &T );
190 DriverFloatRepr operator % ( DriverFloatRepr &T );
191 DriverFloatRepr sqrt( );
193 /* provide implementation of the functions listed below in the file */
194 /* Conversions/$PLATFORM/Conversionstest.cc */
195 /* see item (d) on webpage */
198 DriverFloatRepr roundto ( int, int, int );
199 DriverFloatRepr copyto ( int, int, int );
200 DriverFloatRepr rint ( );
201 DriverFloatRepr ri ( ) ;
202 DriverFloatRepr ru ( ) ;
203 DriverFloatRepr rI ( ) ;
204 DriverFloatRepr rU ( ) ;
205 DriverFloatRepr ci ( int, int, int );
206 DriverFloatRepr cu ( int, int, int );
207 DriverFloatRepr cI ( int, int, int );
208 DriverFloatRepr cU ( int, int, int );
209 DriverFloatRepr b2d ( int );
210 DriverFloatRepr d2b ( );
212 /* conversions between DriverFloatRepr and hardware integer */
213 /* data types; implementation is provided in the files */
214 /* BasicOperations/$PLATFORM/fpenv_$PLATFORM.cc */
216 /* Conversions/$PLATFORM/fpenv_$PLATFORM.cc */
217 /* and should not be modified */
220 DriverFloatRepr( long i );
221 DriverFloatRepr( unsigned long i );
222 DriverFloatRepr( long long int i );
223 DriverFloatRepr( unsigned long long int i );
225 unsigned int touint( );
226 long long int tolonglong( );
227 unsigned long long int toulonglong( );