]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/26_numerics/headers/cmath/c_math.cc
re PR testsuite/39696 (gcc.dg/tree-ssa/ssa-ccp-25.c scan-tree-dump doesn't work on...
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 26_numerics / headers / cmath / c_math.cc
CommitLineData
b2dad0e3
BK
1// 1999-06-05
2// Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
3
4// Copyright (C) 2000, 1999 Free Software Foundation, Inc.
5//
6// This file is part of the GNU ISO C++ Library. This library is free
7// software; you can redistribute it and/or modify it under the
8// terms of the GNU General Public License as published by the
9// Free Software Foundation; either version 2, or (at your option)
10// any later version.
11
12// This library is distributed in the hope that it will be useful,
13// but WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15// GNU General Public License for more details.
16
17// You should have received a copy of the GNU General Public License along
18// with this library; see the file COPYING. If not, write to the Free
83f51799 19// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
b2dad0e3
BK
20// USA.
21
22#include <cmath>
fe413112 23#include <testsuite_hooks.h>
b2dad0e3
BK
24
25// test compilation.
aa1b2f7d
BV
26int
27test01()
b2dad0e3 28{
aa1b2f7d
BV
29 float a = 1.f;
30 float b;
31 std::modf(a, &b);
32 return 0;
b2dad0e3
BK
33}
34
35// need more extravagant checks than this, of course, but this used to core...
aa1b2f7d
BV
36int
37test02()
b2dad0e3 38{
4bc95009 39 std::sin(static_cast<float>(0));
aa1b2f7d 40 return 0;
b2dad0e3
BK
41}
42
43// as did this.
aa1b2f7d
BV
44int
45test03()
b2dad0e3 46{
11f10e6b 47 double powtest __attribute__((unused)) = std::pow(2., 0);
aa1b2f7d 48 return 0;
b2dad0e3
BK
49}
50
51// this used to abort.
aa1b2f7d
BV
52int
53test04()
b2dad0e3 54{
11f10e6b 55 bool test __attribute__((unused)) = true;
b2dad0e3
BK
56 float x[2] = {1, 2};
57 float y = 3.4;
58 std::modf(y, &x[0]);
aa1b2f7d
BV
59 VERIFY(x[1] == 2);
60 return 0;
b2dad0e3
BK
61}
62
aa1b2f7d
BV
63int
64main()
b2dad0e3
BK
65{
66 test01();
67 test02();
68 test03();
69 test04();
70 return 0;
71}