1*53ee8cc1Swenshuai.xi /* Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc. 2*53ee8cc1Swenshuai.xi This file is part of the GNU C Library. 3*53ee8cc1Swenshuai.xi 4*53ee8cc1Swenshuai.xi The GNU C Library is free software; you can redistribute it and/or 5*53ee8cc1Swenshuai.xi modify it under the terms of the GNU Lesser General Public 6*53ee8cc1Swenshuai.xi License as published by the Free Software Foundation; either 7*53ee8cc1Swenshuai.xi version 2.1 of the License, or (at your option) any later version. 8*53ee8cc1Swenshuai.xi 9*53ee8cc1Swenshuai.xi The GNU C Library is distributed in the hope that it will be useful, 10*53ee8cc1Swenshuai.xi but WITHOUT ANY WARRANTY; without even the implied warranty of 11*53ee8cc1Swenshuai.xi MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12*53ee8cc1Swenshuai.xi Lesser General Public License for more details. 13*53ee8cc1Swenshuai.xi 14*53ee8cc1Swenshuai.xi You should have received a copy of the GNU Lesser General Public 15*53ee8cc1Swenshuai.xi License along with the GNU C Library; if not, write to the Free 16*53ee8cc1Swenshuai.xi Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 17*53ee8cc1Swenshuai.xi 02111-1307 USA. */ 18*53ee8cc1Swenshuai.xi 19*53ee8cc1Swenshuai.xi #ifndef _FENV_H 20*53ee8cc1Swenshuai.xi # error "Never use <bits/fenv.h> directly; include <fenv.h> instead." 21*53ee8cc1Swenshuai.xi #endif 22*53ee8cc1Swenshuai.xi 23*53ee8cc1Swenshuai.xi 24*53ee8cc1Swenshuai.xi /* Define bits representing the exception. We use the bit positions 25*53ee8cc1Swenshuai.xi of the appropriate bits in the FPU control word. */ 26*53ee8cc1Swenshuai.xi enum 27*53ee8cc1Swenshuai.xi { 28*53ee8cc1Swenshuai.xi FE_INEXACT = 0x04, 29*53ee8cc1Swenshuai.xi #define FE_INEXACT FE_INEXACT 30*53ee8cc1Swenshuai.xi FE_UNDERFLOW = 0x08, 31*53ee8cc1Swenshuai.xi #define FE_UNDERFLOW FE_UNDERFLOW 32*53ee8cc1Swenshuai.xi FE_OVERFLOW = 0x10, 33*53ee8cc1Swenshuai.xi #define FE_OVERFLOW FE_OVERFLOW 34*53ee8cc1Swenshuai.xi FE_DIVBYZERO = 0x20, 35*53ee8cc1Swenshuai.xi #define FE_DIVBYZERO FE_DIVBYZERO 36*53ee8cc1Swenshuai.xi FE_INVALID = 0x40, 37*53ee8cc1Swenshuai.xi #define FE_INVALID FE_INVALID 38*53ee8cc1Swenshuai.xi }; 39*53ee8cc1Swenshuai.xi 40*53ee8cc1Swenshuai.xi #define FE_ALL_EXCEPT \ 41*53ee8cc1Swenshuai.xi (FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID) 42*53ee8cc1Swenshuai.xi 43*53ee8cc1Swenshuai.xi /* The MIPS FPU supports all of the four defined rounding modes. We 44*53ee8cc1Swenshuai.xi use again the bit positions in the FPU control word as the values 45*53ee8cc1Swenshuai.xi for the appropriate macros. */ 46*53ee8cc1Swenshuai.xi enum 47*53ee8cc1Swenshuai.xi { 48*53ee8cc1Swenshuai.xi FE_TONEAREST = 0x0, 49*53ee8cc1Swenshuai.xi #define FE_TONEAREST FE_TONEAREST 50*53ee8cc1Swenshuai.xi FE_TOWARDZERO = 0x1, 51*53ee8cc1Swenshuai.xi #define FE_TOWARDZERO FE_TOWARDZERO 52*53ee8cc1Swenshuai.xi FE_UPWARD = 0x2, 53*53ee8cc1Swenshuai.xi #define FE_UPWARD FE_UPWARD 54*53ee8cc1Swenshuai.xi FE_DOWNWARD = 0x3 55*53ee8cc1Swenshuai.xi #define FE_DOWNWARD FE_DOWNWARD 56*53ee8cc1Swenshuai.xi }; 57*53ee8cc1Swenshuai.xi 58*53ee8cc1Swenshuai.xi 59*53ee8cc1Swenshuai.xi /* Type representing exception flags. */ 60*53ee8cc1Swenshuai.xi typedef unsigned short int fexcept_t; 61*53ee8cc1Swenshuai.xi 62*53ee8cc1Swenshuai.xi 63*53ee8cc1Swenshuai.xi /* Type representing floating-point environment. This function corresponds 64*53ee8cc1Swenshuai.xi to the layout of the block written by the `fstenv'. */ 65*53ee8cc1Swenshuai.xi typedef struct 66*53ee8cc1Swenshuai.xi { 67*53ee8cc1Swenshuai.xi unsigned int __fp_control_register; 68*53ee8cc1Swenshuai.xi } 69*53ee8cc1Swenshuai.xi fenv_t; 70*53ee8cc1Swenshuai.xi 71*53ee8cc1Swenshuai.xi /* If the default argument is used we use this value. */ 72*53ee8cc1Swenshuai.xi #define FE_DFL_ENV ((__const fenv_t *) -1) 73*53ee8cc1Swenshuai.xi 74*53ee8cc1Swenshuai.xi #ifdef __USE_GNU 75*53ee8cc1Swenshuai.xi /* Floating-point environment where none of the exception is masked. */ 76*53ee8cc1Swenshuai.xi # define FE_NOMASK_ENV ((__const fenv_t *) -2) 77*53ee8cc1Swenshuai.xi #endif 78