]> www.ginac.de Git - ginac.git/blob - check/numeric_output.cpp
- files which are generated by perl scripts are made before compilation
[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 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 using namespace GiNaC;
25
26 unsigned numeric_output(void)
27 {
28     unsigned result = 0;
29     
30     cout << "checking output of numeric types..." << flush;
31     clog << "---------output of numeric types:" << endl;
32     
33     unsigned long Digits_before = Digits;
34     Digits = 200;
35     clog << "Using " << Digits << " digits" << endl;
36     clog << Pi << " evalfs to: " << Pi.evalf() << endl;
37     clog << Catalan << " evalfs to: " << Catalan.evalf() << endl;
38     clog << EulerGamma << " evalfs to: " << EulerGamma.evalf() << endl;
39     clog << "Complex integers: ";
40     clog << "{(0,0)=" << ex(0 + 0*I) << "} ";
41     clog << "{(1,0)=" << ex(1 + 0*I) << "} ";
42     clog << "{(1,1)=" << ex(1 + 1*I) << "} ";
43     clog << "{(0,1)=" << ex(0 + 1*I) << "} ";
44     clog << "{(-1,1)=" << ex(-1 + 1*I) << "} ";
45     clog << "{(-1,0)=" << ex(-1 + 0*I) << "} ";
46     clog << "{(-1,-1)=" << ex(-1 - 1*I) << "} ";
47     clog << "{(0,-1)=" << ex(0 - 1*I) << "} ";
48     clog << "{(1,-1)=" << ex(1 - 1*I) << "} " << endl;
49     Digits = Digits_before;
50     
51     if (! result) {
52         cout << " passed ";
53     } else {
54         cout << " failed ";
55     }
56     
57     return result;
58 }