Back to index

glibc  2.9
fenv.h
Go to the documentation of this file.
00001 /* Copyright (C) 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 of
00025    the appropriate bits in the FPSR...  (Tahoe EAS 2.4 5-4)*/
00026 
00027 enum
00028   {
00029     FE_INEXACT =     1UL << 5,
00030 #define FE_INEXACT   FE_INEXACT
00031 
00032     FE_UNDERFLOW =   1UL << 4,
00033 #define FE_UNDERFLOW FE_UNDERFLOW
00034 
00035     FE_OVERFLOW =    1UL << 3,
00036 #define FE_OVERFLOW  FE_OVERFLOW
00037 
00038     FE_DIVBYZERO =   1UL << 2,
00039 #define FE_DIVBYZERO FE_DIVBYZERO
00040 
00041     FE_UNNORMAL =    1UL << 1,
00042 #define FE_UNNORMAL  FE_UNNORMAL
00043 
00044     FE_INVALID =     1UL << 0,
00045 #define FE_INVALID   FE_INVALID
00046 
00047     FE_ALL_EXCEPT =
00048        (FE_INEXACT | FE_UNDERFLOW | FE_OVERFLOW | FE_DIVBYZERO | FE_UNNORMAL | FE_INVALID)
00049 #define FE_ALL_EXCEPT       FE_ALL_EXCEPT
00050   };
00051 
00052 
00053 enum
00054   {
00055     FE_TOWARDZERO =  3,
00056 #define FE_TOWARDZERO       FE_TOWARDZERO
00057 
00058     FE_UPWARD =             2,
00059 #define FE_UPWARD    FE_UPWARD
00060 
00061     FE_DOWNWARD =    1,
00062 #define FE_DOWNWARD  FE_DOWNWARD
00063 
00064     FE_TONEAREST =   0,
00065 #define FE_TONEAREST FE_TONEAREST
00066   };
00067 
00068 
00069 /* Type representing exception flags.  */
00070 typedef unsigned long int fexcept_t;
00071 
00072 /* Type representing floating-point environment.  */
00073 typedef unsigned long int fenv_t;
00074 
00075 /* If the default argument is used we use this value.  */
00076 #define FE_DFL_ENV   ((__const fenv_t *) 0xc009804c0270033fUL)
00077 
00078 #ifdef __USE_GNU
00079 /* Floating-point environment where only FE_UNNORMAL is masked since this
00080    exception is not generally supported by glibc.  */
00081 # define FE_NOMASK_ENV      ((__const fenv_t *) 0xc009804c02700302UL)
00082 
00083 /* Floating-point environment with (processor-dependent) non-IEEE
00084    floating point.  In this case, turning on flush-to-zero mode for
00085    s0, s2, and s3.  */
00086 # define FE_NONIEEE_ENV ((__const fenv_t *) 0xc009a04d0270037fUL)
00087 #endif