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