1 /* Raise given exceptions.
2 Copyright (C) 1997, 1999 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
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.
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.
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. */
24 __feraiseexcept (int excepts)
26 static volatile double sink;
28 double zero, one, max, min, sixteen, pi;
30 0.0, 1.0, DBL_MAX, DBL_MIN, 16.0, M_PI
33 /* Raise exceptions represented by EXPECTS. But we must raise only
34 one signal at a time. It is important the if the overflow/underflow
35 exception and the inexact exception are given at the same time,
36 the overflow/underflow exception follows the inexact exception. */
38 /* First: invalid exception. */
39 if ((FE_INVALID & excepts) != 0)
40 /* One example of a invalid operation is 0/0. */
41 sink = c.zero / c.zero;
43 /* Next: division by zero. */
44 if ((FE_DIVBYZERO & excepts) != 0)
45 sink = c.one / c.zero;
48 if ((FE_OVERFLOW & excepts) != 0)
51 /* Next: underflow. */
52 if ((FE_UNDERFLOW & excepts) != 0)
53 sink = c.min / c.sixteen;
56 if ((FE_INEXACT & excepts) != 0)
62 strong_alias (__feraiseexcept, __old_feraiseexcept)
63 symbol_version (__old_feraiseexcept, feraiseexcept, GLIBC_2.1);
64 default_symbol_version (__feraiseexcept, feraiseexcept, GLIBC_2.1.3);