1 /* GCC Quad-Precision Math Library
2 Copyright (C) 2012 Free Software Foundation, Inc.
4 This file is part of the libquadmath library.
5 Libquadmath is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
10 Libquadmath 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 libquadmath; see the file COPYING.LIB. If
17 not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
18 Boston, MA 02110-1301, USA. */
21 #ifndef QUADMATH_ROUNDING_MODE_H
22 #define QUADMATH_ROUNDING_MODE_H
27 #if defined(HAVE_FENV_H)
29 #endif /* HAVE_FENV_H */
32 get_rounding_mode (void)
34 #if defined(HAVE_FENV_H) && (defined(FE_DOWNWARD) || defined(FE_TONEAREST) \
35 || defined(FE_TOWARDZERO) || defined(FE_UPWARD))
43 round_away (bool negative
, bool last_digit_odd
, bool half_bit
, bool more_bits
,
50 return negative
&& (half_bit
|| more_bits
);
55 return half_bit
&& (last_digit_odd
|| more_bits
);
66 return !negative
&& (half_bit
|| more_bits
);
74 #endif /* QUADMATH_ROUNDING_MODE_H */