Back to index

glibc  2.9
fenv.h
Go to the documentation of this file.
00001 /* Copyright (C) 1997, 1998, 1999 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 /* Define bits representing exceptions in the FPU status word.  */
00024 enum
00025   {
00026     FE_INVALID = 1,
00027 #define FE_INVALID FE_INVALID
00028     FE_DIVBYZERO = 2,
00029 #define FE_DIVBYZERO FE_DIVBYZERO
00030     FE_OVERFLOW = 4,
00031 #define FE_OVERFLOW FE_OVERFLOW
00032     FE_UNDERFLOW = 8,
00033 #define FE_UNDERFLOW FE_UNDERFLOW
00034   };
00035 
00036 /* Amount to shift by to convert an exception to a mask bit.  */
00037 #define FE_EXCEPT_SHIFT     16
00038 
00039 /* All supported exceptions.  */
00040 #define FE_ALL_EXCEPT       \
00041        (FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW)
00042 
00043 /* The ARM FPU basically only supports round-to-nearest.  Other rounding
00044    modes exist, but you have to encode them in the actual instruction.  */
00045 #define FE_TONEAREST 0
00046 
00047 /* Type representing exception flags. */
00048 typedef unsigned long int fexcept_t;
00049 
00050 /* Type representing floating-point environment.  */
00051 typedef struct
00052   {
00053     unsigned long int __cw;
00054   }
00055 fenv_t;
00056 
00057 /* If the default argument is used we use this value.  */
00058 #define FE_DFL_ENV   ((fenv_t *) -1l)