]> www.ginac.de Git - ginac.git/blob - check/numeric_output.cpp
- changed dates in copyright notices
[ginac.git] / check / numeric_output.cpp
1 /** @file numeric_output.cpp
2  *
3  *  Test output of numeric types. */
4
5 /*
6  *  GiNaC Copyright (C) 1999-2000 Johannes Gutenberg University Mainz, Germany
7  *
8  *  This program is free software; you can redistribute it and/or modify
9  *  it under the terms of the GNU General Public License as published by
10  *  the Free Software Foundation; either version 2 of the License, or
11  *  (at your option) any later version.
12  *
13  *  This program is distributed in the hope that it will be useful,
14  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  *  GNU General Public License for more details.
17  *
18  *  You should have received a copy of the GNU General Public License
19  *  along with this program; if not, write to the Free Software
20  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21  */
22
23 #include <ginac/ginac.h>
24
25 #ifndef NO_GINAC_NAMESPACE
26 using namespace GiNaC;
27 #endif // ndef NO_GINAC_NAMESPACE
28
29 unsigned numeric_output(void)
30 {
31     unsigned result = 0;
32     
33     cout << "checking output of numeric types..." << flush;
34     clog << "---------output of numeric types:" << endl;
35     
36     unsigned long Digits_before = Digits;
37     Digits = 222;
38     clog << "Using " << Digits << " digits" << endl;
39     clog << Pi << " evalfs to: " << Pi.evalf() << endl;
40     clog << Catalan << " evalfs to: " << Catalan.evalf() << endl;
41     clog << EulerGamma << " evalfs to: " << EulerGamma.evalf() << endl;
42     clog << "Complex integers: ";
43     clog << "{(0,0)=" << ex(0 + 0*I) << "} ";
44     clog << "{(1,0)=" << ex(1 + 0*I) << "} ";
45     clog << "{(1,1)=" << ex(1 + 1*I) << "} ";
46     clog << "{(0,1)=" << ex(0 + 1*I) << "} ";
47     clog << "{(-1,1)=" << ex(-1 + 1*I) << "} ";
48     clog << "{(-1,0)=" << ex(-1 + 0*I) << "} ";
49     clog << "{(-1,-1)=" << ex(-1 - 1*I) << "} ";
50     clog << "{(0,-1)=" << ex(0 - 1*I) << "} ";
51     clog << "{(1,-1)=" << ex(1 - 1*I) << "} " << endl;
52     Digits = Digits_before;
53     
54     if (! result) {
55         cout << " passed ";
56     } else {
57         cout << " failed ";
58     }
59     
60     return result;
61 }