2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / libstdc++-v3 / testsuite / 26_numerics / c_math.cc
blob60cb5d05a01b37a92f69d4e4519563d832cab526
1 // 1999-06-05
2 // Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
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.
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.
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
19 // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
20 // USA.
22 #include <cmath>
23 #include <testsuite_hooks.h>
25 // test compilation.
26 int
27 test01()
29 float a = 1.f;
30 float b;
31 std::modf(a, &b);
32 return 0;
35 // need more extravagant checks than this, of course, but this used to core...
36 int
37 test02()
39 std::sin(static_cast<float>(0));
40 return 0;
43 // as did this.
44 int
45 test03()
47 double powtest __attribute__((unused)) = std::pow(2., 0);
48 return 0;
51 // this used to abort.
52 int
53 test04()
55 bool test __attribute__((unused)) = true;
56 float x[2] = {1, 2};
57 float y = 3.4;
58 std::modf(y, &x[0]);
59 VERIFY(x[1] == 2);
60 return 0;
63 int
64 main()
66 test01();
67 test02();
68 test03();
69 test04();
70 return 0;