]> www.ginac.de Git - ginac.git/blob - check/numeric_output.cpp
d138a74f3b221d967cdbc88d5b1cdf659831c201
[ginac.git] / check / numeric_output.cpp
1 /** @file numeric_output.cpp
2  *
3  *  Test output of numeric types.
4  *
5  *  GiNaC Copyright (C) 1999 Johannes Gutenberg University Mainz, Germany
6  *
7  *  This program is free software; you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License as published by
9  *  the Free Software Foundation; either version 2 of the License, or
10  *  (at your option) any later version.
11  *
12  *  This program 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
18  *  along with this program; if not, write to the Free Software
19  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20  */
21
22 #include <ginac/ginac.h>
23
24 unsigned numeric_output(void)
25 {
26     unsigned result = 0;
27     
28     cout << "checking output of numeric types..." << flush;
29     clog << "---------output of numeric types:" << endl;
30     
31     unsigned long Digits_before = Digits;
32     Digits = 200;
33     clog << "Using " << Digits << " digits" << endl;
34     clog << Pi << " evalfs to: " << Pi.evalf() << endl;
35     clog << Catalan << " evalfs to: " << Catalan.evalf() << endl;
36     clog << EulerGamma << " evalfs to: " << EulerGamma.evalf() << endl;
37     clog << "Complex integers: ";
38     clog << "{(0,0)=" << ex(0 + 0*I) << "} ";
39     clog << "{(1,0)=" << ex(1 + 0*I) << "} ";
40     clog << "{(1,1)=" << ex(1 + 1*I) << "} ";
41     clog << "{(0,1)=" << ex(0 + 1*I) << "} ";
42     clog << "{(-1,1)=" << ex(-1 + 1*I) << "} ";
43     clog << "{(-1,0)=" << ex(-1 + 0*I) << "} ";
44     clog << "{(-1,-1)=" << ex(-1 - 1*I) << "} ";
45     clog << "{(0,-1)=" << ex(0 - 1*I) << "} ";
46     clog << "{(1,-1)=" << ex(1 - 1*I) << "} " << endl;
47     Digits = Digits_before;
48     
49     if (! result) {
50         cout << " passed ";
51     } else {
52         cout << " failed ";
53     }
54     
55     return result;
56 }