df19b02e65b4ea31c515fcf7c528276b365f0349
[gcc.git] / libstdc++-v3 / testsuite / 26_numerics / c_math.cc
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
19 // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
20 // USA.
21
22 #include <cmath>
23 #include <debug_assert.h>
24
25 // test compilation.
26 int
27 test01()
28 {
29 float a = 1.f;
30 float b;
31 std::modf(a, &b);
32 return 0;
33 }
34
35 // need more extravagant checks than this, of course, but this used to core...
36 int
37 test02()
38 {
39 std::sin(static_cast<float>(0));
40 return 0;
41 }
42
43 // as did this.
44 int
45 test03()
46 {
47 double powtest = std::pow(2., 0);
48 return 0;
49 }
50
51 // this used to abort.
52 int
53 test04()
54 {
55 bool test = 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;
61 }
62
63 int
64 main()
65 {
66 test01();
67 test02();
68 test03();
69 test04();
70 return 0;
71 }