1// Copyright (C) 2010-2015 Free Software Foundation, Inc.
2//
3// This file is part of the GNU ISO C++ Library.  This library is free
4// software; you can redistribute it and/or modify it under the
5// terms of the GNU General Public License as published by the
6// Free Software Foundation; either version 3, or (at your option)
7// any later version.
8
9// This library is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12// GNU General Public License for more details.
13
14// You should have received a copy of the GNU General Public License along
15// with this library; see the file COPYING3.  If not see
16// <http://www.gnu.org/licenses/>.
17
18// { dg-options "-std=gnu++11" }
19// { dg-do compile { xfail uclibc } }
20// { dg-excess-errors "" { target uclibc } }
21
22#include <cmath>
23
24void fpclassify() { }
25
26void isfinite() { }
27
28void isinf() { }
29
30void isnan() { }
31
32void isnormal() { }
33
34void signbit() { }
35
36void isgreater() { }
37
38void isgreaterequal() { }
39
40void isless() { }
41
42void islessequal() { }
43
44void islessgreater() { }
45
46void isunordered() { }
47
48#if _GLIBCXX_USE_C99_MATH
49template <typename _Tp, typename _Up = _Tp>
50  void test_c99_classify()
51  {
52    bool test __attribute__((unused)) = true;
53
54    typedef _Tp fp_type_one;
55    typedef _Up fp_type_two;
56    fp_type_one f1 = 1.0;
57    fp_type_two f2 = 3.0;
58    int resi;
59    bool res;
60
61    resi = std::fpclassify(f1);
62    res = std::isfinite(f2);
63    res = std::isinf(f1);
64    res = std::isnan(f2);
65    res = std::isnormal(f1);
66    res = std::signbit(f2);
67    res = std::isgreater(f1, f2);
68    res = std::isgreaterequal(f1, f2);
69    res = std::isless(f1, f2);
70    res = std::islessequal(f1,f2);
71    res = std::islessgreater(f1, f2);
72    res = std::isunordered(f1, f2);
73    resi = resi; // Suppress unused warning.
74    res = res;
75  }
76#endif
77
78int main()
79{
80#if _GLIBCXX_USE_C99_MATH
81  test_c99_classify<float>();
82  test_c99_classify<double>();
83  test_c99_classify<long double>();
84  test_c99_classify<float, double>();
85  test_c99_classify<float, long double>();
86  test_c99_classify<double, float>();
87  test_c99_classify<double, long double>();
88  test_c99_classify<long double, float>();
89  test_c99_classify<long double, double>();
90#endif
91  return 0;
92}
93