Back to index

glibc  2.9
fenv.h
Go to the documentation of this file.
00001 /* Copyright (C) 1998, 1999, 2000, 2004 Free Software Foundation, Inc.
00002    This file is part of the GNU C Library.
00003    Contributed by Alexandre Oliva <aoliva@redhat.com>
00004    based on the corresponding file in the mips port.
00005 
00006    The GNU C Library is free software; you can redistribute it and/or
00007    modify it under the terms of the GNU Lesser General Public
00008    License as published by the Free Software Foundation; either
00009    version 2.1 of the License, or (at your option) any later version.
00010 
00011    The GNU C Library is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014    Lesser General Public License for more details.
00015 
00016    You should have received a copy of the GNU Lesser General Public
00017    License along with the GNU C Library; if not, write to the Free
00018    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00019    02111-1307 USA.  */
00020 
00021 #ifndef _FENV_H
00022 # error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
00023 #endif
00024 
00025 
00026 /* Define bits representing the exception.  We use the EF bit
00027    positions of the appropriate bits in the FPCR register.  */
00028 enum
00029   {
00030     FE_INEXACT = 0x01,
00031 #define FE_INEXACT   FE_INEXACT
00032     FE_UNDERFLOW = 0x02,
00033 #define FE_UNDERFLOW FE_UNDERFLOW
00034     FE_OVERFLOW = 0x04,
00035 #define FE_OVERFLOW  FE_OVERFLOW
00036     FE_DIVBYZERO = 0x08,
00037 #define FE_DIVBYZERO FE_DIVBYZERO
00038     FE_INVALID = 0x10,
00039 #define FE_INVALID   FE_INVALID
00040   };
00041 
00042 #define FE_ALL_EXCEPT \
00043        (FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID)
00044 
00045 /* The AM33/2.0 FPU supports only Round to nearest.  Bits 3<<16 are
00046    reserved to represent other rounding modes.  */
00047 enum
00048   {
00049     FE_TONEAREST = 0x00000,
00050 #define FE_TONEAREST FE_TONEAREST
00051   };
00052 
00053 
00054 /* Type representing exception flags.  */
00055 typedef unsigned int fexcept_t;
00056 
00057 
00058 /* Type representing floating-point environment.  */
00059 typedef unsigned int fenv_t;
00060 
00061 /* If the default argument is used we use this value.  */
00062 #define FE_DFL_ENV   ((__const fenv_t *) -1)
00063 
00064 #ifdef __USE_GNU
00065 /* Floating-point environment where none of the exception is masked.  */
00066 # define FE_NOMASK_ENV  ((__const fenv_t *) -2)
00067 #endif