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