Back to index

glibc  2.9
fenv.h
Go to the documentation of this file.
00001 /* Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
00002    This file is part of the GNU C Library.
00003 
00004    The GNU C Library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Lesser General Public
00006    License as published by the Free Software Foundation; either
00007    version 2.1 of the License, or (at your option) any later version.
00008 
00009    The GNU C Library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Lesser General Public License for more details.
00013 
00014    You should have received a copy of the GNU Lesser General Public
00015    License along with the GNU C Library; if not, write to the Free
00016    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00017    02111-1307 USA.  */
00018 
00019 #ifndef _FENV_H
00020 # error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
00021 #endif
00022 
00023 
00024 /* Define bits representing the exception.  We use the bit positions
00025    of the appropriate bits in the FPU control word.  */
00026 enum
00027   {
00028     FE_INEXACT = 0x04,
00029 #define FE_INEXACT   FE_INEXACT
00030     FE_UNDERFLOW = 0x08,
00031 #define FE_UNDERFLOW FE_UNDERFLOW
00032     FE_OVERFLOW = 0x10,
00033 #define FE_OVERFLOW  FE_OVERFLOW
00034     FE_DIVBYZERO = 0x20,
00035 #define FE_DIVBYZERO FE_DIVBYZERO
00036     FE_INVALID = 0x40,
00037 #define FE_INVALID   FE_INVALID
00038   };
00039 
00040 #define FE_ALL_EXCEPT \
00041        (FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID)
00042 
00043 /* The MIPS FPU supports all of the four defined rounding modes.  We
00044    use again the bit positions in the FPU control word as the values
00045    for the appropriate macros.  */
00046 enum
00047   {
00048     FE_TONEAREST = 0x0,
00049 #define FE_TONEAREST FE_TONEAREST
00050     FE_TOWARDZERO = 0x1,
00051 #define FE_TOWARDZERO       FE_TOWARDZERO
00052     FE_UPWARD = 0x2,
00053 #define FE_UPWARD    FE_UPWARD
00054     FE_DOWNWARD = 0x3
00055 #define FE_DOWNWARD  FE_DOWNWARD
00056   };
00057 
00058 
00059 /* Type representing exception flags.  */
00060 typedef unsigned short int fexcept_t;
00061 
00062 
00063 /* Type representing floating-point environment.  This function corresponds
00064    to the layout of the block written by the `fstenv'.  */
00065 typedef struct
00066   {
00067     unsigned int __fp_control_register;
00068   }
00069 fenv_t;
00070 
00071 /* If the default argument is used we use this value.  */
00072 #define FE_DFL_ENV   ((__const fenv_t *) -1)
00073 
00074 #ifdef __USE_GNU
00075 /* Floating-point environment where none of the exception is masked.  */
00076 # define FE_NOMASK_ENV  ((__const fenv_t *) -2)
00077 #endif