]>
Commit | Line | Data |
---|---|---|
6d4752d8 | 1 | /* Test exception in current environment. |
7210de33 | 2 | Copyright (C) 1997 Free Software Foundation, Inc. |
6d4752d8 | 3 | This file is part of the GNU C Library. |
6d4752d8 UD |
4 | |
5 | The GNU C Library is free software; you can redistribute it and/or | |
6 | modify it under the terms of the GNU Library General Public License as | |
7 | published by the Free Software Foundation; either version 2 of the | |
8 | License, or (at your option) any later version. | |
9 | ||
10 | The GNU C Library is distributed in the hope that it will be useful, | |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | Library General Public License for more details. | |
14 | ||
15 | You should have received a copy of the GNU Library General Public | |
16 | License along with the GNU C Library; see the file COPYING.LIB. If not, | |
17 | write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
18 | Boston, MA 02111-1307, USA. */ | |
19 | ||
7210de33 | 20 | #include <fenv_libc.h> |
6d4752d8 UD |
21 | |
22 | int | |
23 | fetestexcept (int excepts) | |
24 | { | |
7210de33 | 25 | fenv_union_t u; |
6d4752d8 | 26 | |
7210de33 UD |
27 | /* Get the current state. */ |
28 | u.fenv = fegetenv_register (); | |
6d4752d8 | 29 | |
7210de33 UD |
30 | /* The FE_INVALID bit is dealt with correctly by the hardware, so we can |
31 | just: */ | |
32 | return u.l[1] & excepts; | |
6d4752d8 | 33 | } |