| 1 | /* Declarations for SVID math error handling compatibility. | 
|---|
| 2 | Copyright (C) 1991-2020 Free Software Foundation, Inc. | 
|---|
| 3 | This file is part of the GNU C Library. | 
|---|
| 4 |  | 
|---|
| 5 | The GNU C Library is free software; you can redistribute it and/or | 
|---|
| 6 | modify it under the terms of the GNU Lesser General Public | 
|---|
| 7 | License as published by the Free Software Foundation; either | 
|---|
| 8 | version 2.1 of the License, or (at your option) any later version. | 
|---|
| 9 |  | 
|---|
| 10 | The GNU C Library 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 the GNU | 
|---|
| 13 | Lesser General Public License for more details. | 
|---|
| 14 |  | 
|---|
| 15 | You should have received a copy of the GNU Lesser General Public | 
|---|
| 16 | License along with the GNU C Library; if not, see | 
|---|
| 17 | <https://www.gnu.org/licenses/>.  */ | 
|---|
| 18 |  | 
|---|
| 19 | #ifndef	_MATH_SVID_COMPAT_H | 
|---|
| 20 | #define	_MATH_SVID_COMPAT_H	1 | 
|---|
| 21 |  | 
|---|
| 22 | /* Support for various different standard error handling behaviors.  */ | 
|---|
| 23 | typedef enum | 
|---|
| 24 | { | 
|---|
| 25 | _IEEE_ = -1,	/* According to IEEE 754/IEEE 854.  */ | 
|---|
| 26 | _SVID_,	/* According to System V, release 4.  */ | 
|---|
| 27 | _XOPEN_,	/* Nowadays also Unix98.  */ | 
|---|
| 28 | _POSIX_, | 
|---|
| 29 | _ISOC_	/* Actually this is ISO C99.  */ | 
|---|
| 30 | } _LIB_VERSION_TYPE; | 
|---|
| 31 |  | 
|---|
| 32 | /* This variable can be changed at run-time to any of the values above to | 
|---|
| 33 | affect floating point error handling behavior (it may also be necessary | 
|---|
| 34 | to change the hardware FPU exception settings).  */ | 
|---|
| 35 | extern _LIB_VERSION_TYPE _LIB_VERSION; | 
|---|
| 36 |  | 
|---|
| 37 | /* In SVID error handling, `matherr' is called with this description | 
|---|
| 38 | of the exceptional condition.  */ | 
|---|
| 39 | struct exception | 
|---|
| 40 | { | 
|---|
| 41 | int type; | 
|---|
| 42 | char *name; | 
|---|
| 43 | double arg1; | 
|---|
| 44 | double arg2; | 
|---|
| 45 | double retval; | 
|---|
| 46 | }; | 
|---|
| 47 |  | 
|---|
| 48 | extern int matherr (struct exception *__exc); | 
|---|
| 49 | extern int __matherr (struct exception *__exc); | 
|---|
| 50 |  | 
|---|
| 51 | #define X_TLOSS	1.41484755040568800000e+16 | 
|---|
| 52 |  | 
|---|
| 53 | /* Types of exceptions in the `type' field.  */ | 
|---|
| 54 | #define DOMAIN		1 | 
|---|
| 55 | #define SING		2 | 
|---|
| 56 | #define OVERFLOW	3 | 
|---|
| 57 | #define UNDERFLOW	4 | 
|---|
| 58 | #define TLOSS		5 | 
|---|
| 59 | #define PLOSS		6 | 
|---|
| 60 |  | 
|---|
| 61 | /* SVID mode specifies returning this large value instead of infinity.  */ | 
|---|
| 62 | #define HUGE		3.40282347e+38F | 
|---|
| 63 |  | 
|---|
| 64 | /* The above definitions may be used in testcases.  The following code | 
|---|
| 65 | is only used in the implementation.  */ | 
|---|
| 66 |  | 
|---|
| 67 | #ifdef _LIBC | 
|---|
| 68 | /* fdlibm kernel function */ | 
|---|
| 69 | extern double __kernel_standard (double, double, int); | 
|---|
| 70 | extern float __kernel_standard_f (float, float, int); | 
|---|
| 71 | extern long double __kernel_standard_l (long double, long double, int); | 
|---|
| 72 |  | 
|---|
| 73 | # include <shlib-compat.h> | 
|---|
| 74 | # define LIBM_SVID_COMPAT SHLIB_COMPAT (libm, GLIBC_2_0, GLIBC_2_27) | 
|---|
| 75 | # if LIBM_SVID_COMPAT | 
|---|
| 76 | compat_symbol_reference (libm, matherr, matherr, GLIBC_2_0); | 
|---|
| 77 | compat_symbol_reference (libm, _LIB_VERSION, _LIB_VERSION, GLIBC_2_0); | 
|---|
| 78 | # else | 
|---|
| 79 | /* Except when building compat code, optimize out references to | 
|---|
| 80 | _LIB_VERSION and matherr.  */ | 
|---|
| 81 | #  define _LIB_VERSION _POSIX_ | 
|---|
| 82 | #  define matherr(EXC) ((void) (EXC), 0) | 
|---|
| 83 | # endif | 
|---|
| 84 | #endif | 
|---|
| 85 |  | 
|---|
| 86 | #endif /* math-svid-compat.h.  */ | 
|---|
| 87 |  | 
|---|