1 /*
2  * Copyright (C) Bull S.A. 2001
3  * Copyright (c) International Business Machines  Corp., 2001
4  *
5  *   This program is free software;  you can redistribute it and/or modify
6  *   it under the terms of the GNU General Public License as published by
7  *   the Free Software Foundation; either version 2 of the License, or
8  *   (at your option) any later version.
9  *
10  *   This program is distributed in the hope that it will be useful,
11  *   but WITHOUT ANY WARRANTY;  without even the implied warranty of
12  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
13  *   the GNU General Public License for more details.
14  *
15  *   You should have received a copy of the GNU General Public License
16  *   along with this program;  if not, write to the Free Software
17  *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 
20 #ifndef _TFLOAT_H
21 #define _TFLOAT_H
22 #define TRUE    (1)
23 
24 #include <pthread.h> /* pthread.h header file must be the first included file */
25 #include <stdio.h>
26 #include <sys/stat.h>
27 #include <stdlib.h>
28 #include <fcntl.h>
29 #include <sys/signal.h>
30 #include <unistd.h>
31 #include <limits.h>
32 #include <errno.h>
33 #include <string.h>
34 #include <sys/wait.h>
35 /*extern char *sys_errlist[ ];*/
36 
37 #ifdef __MATH__
38 /* this is to force use of math libraries (generates a warning with xlC 3.1.1)*/
39 #undef __MATH__
40 #endif
41 #include <math.h>
42 
43 #define DETAIL_DATA_SIZE        256
44 #define FNAME_SIZE              64
45 
46 #define FUNC_NORMAL            0
47 #define FUNC_ATAN2             1
48 #define FUNC_HYPOT             2
49 #define FUNC_MODF              3
50 #define FUNC_FMOD              4
51 #define FUNC_POW               5
52 #define FUNC_FREXP             6
53 #define FUNC_LDEXP             7
54 #define FUNC_GAM               8
55 
56 extern void * thread_code(void *);
57 
58 /* global variables, constants or initialized by main() */
59 extern const double EPS; /* 0.1e-300 */
60 extern int true, num_threads;
61 
62 /*
63  * TH_DATA structures
64  * the main thread allocates and initializes one of these structures for
65  * each launched thread. Its address is given to the thread.
66  *
67  *      th_num          thread # (range: 0 ... num_threads-1)
68  * these 3 fields are used to get thread results. init. value = 0.
69  *      th_result       result (0 = GOOD)
70  *      th_nerror	number of errors found
71  *      th_nloop	number of loops completed
72  *      detail_data	when th_result!=0, contains error message
73  *
74  * the TH_FUNC structure contains all the data needed to execute the tests.
75  *         code_funct	function type
76  *         precision	int. value used to distinguish between rounding
77  *      		errors and real ones (relative difference between
78  *      		expected and read value should be less than
79  *      		2 ** precision)
80  *         funct        function pointer
81  *         fident       function id. (string) for error messages
82  *         din_fname    data file name (input data)
83  *         dex_fname    data file name (expected data)
84  *         dex2_fname   data file name (input or expected, optionnel)
85  */
86 typedef struct {
87         int code_funct;
88 	int precision;
89         double (*funct)();
90         char fident[16];
91         char din_fname[FNAME_SIZE];
92         char dex_fname[FNAME_SIZE];
93         char dex2_fname[FNAME_SIZE];
94 } TH_FUNC;
95 
96 typedef struct {
97         int th_num;
98         int th_result;
99         int th_nerror;
100         int th_nloop;
101         char detail_data[DETAIL_DATA_SIZE];
102 	TH_FUNC th_func;
103 } TH_DATA;
104 
105 extern const TH_FUNC th_func[];
106 
107 #endif /* ifndef _TFLOAT_H */
108