* functions. */
/*
- * GiNaC Copyright (C) 1999-2000 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2005 Johannes Gutenberg University Mainz, Germany
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "checks.h"
/* Some tests on the sine trigonometric function. */
-static unsigned inifcns_check_sin(void)
+static unsigned inifcns_check_sin()
{
unsigned result = 0;
bool errorflag = false;
if (errorflag) {
// we don't count each of those errors
clog << "sin(n*Pi) with integer n does not always return exact 0"
- << endl;
+ << endl;
++result;
}
errorflag = false;
for (int n=-10; n<=10; ++n) {
if (!sin((n+numeric(1,2))*Pi).eval().info(info_flags::integer) ||
- !(sin((n+numeric(1,2))*Pi).eval() == numeric(1) ||
- sin((n+numeric(1,2))*Pi).eval() == numeric(-1)))
+ !(sin((n+numeric(1,2))*Pi).eval() == numeric(1) ||
+ sin((n+numeric(1,2))*Pi).eval() == numeric(-1)))
errorflag = true;
}
if (errorflag) {
clog << "sin((n+1/2)*Pi) with integer n does not always return exact {+|-}1"
- << endl;
+ << endl;
++result;
}
argument = n*Pi/60;
if (abs(sin(evalf(argument))-evalf(sin(argument)))>epsilon) {
clog << "sin(" << argument << ") returns "
- << sin(argument) << endl;
+ << sin(argument) << endl;
errorflag = true;
}
}
}
/* Simple tests on the cosine trigonometric function. */
-static unsigned inifcns_check_cos(void)
+static unsigned inifcns_check_cos()
{
unsigned result = 0;
bool errorflag;
errorflag = false;
for (int n=-10; n<=10; ++n) {
if (cos((n+numeric(1,2))*Pi).eval() != numeric(0) ||
- !cos((n+numeric(1,2))*Pi).eval().info(info_flags::integer))
+ !cos((n+numeric(1,2))*Pi).eval().info(info_flags::integer))
errorflag = true;
}
if (errorflag) {
clog << "cos((n+1/2)*Pi) with integer n does not always return exact 0"
- << endl;
+ << endl;
++result;
}
errorflag = false;
for (int n=-10; n<=10; ++n) {
if (!cos(n*Pi).eval().info(info_flags::integer) ||
- !(cos(n*Pi).eval() == numeric(1) ||
- cos(n*Pi).eval() == numeric(-1)))
+ !(cos(n*Pi).eval() == numeric(1) ||
+ cos(n*Pi).eval() == numeric(-1)))
errorflag = true;
}
if (errorflag) {
clog << "cos(n*Pi) with integer n does not always return exact {+|-}1"
- << endl;
+ << endl;
++result;
}
argument = n*Pi/60;
if (abs(cos(evalf(argument))-evalf(cos(argument)))>epsilon) {
clog << "cos(" << argument << ") returns "
- << cos(argument) << endl;
+ << cos(argument) << endl;
errorflag = true;
}
}
}
/* Simple tests on the tangent trigonometric function. */
-static unsigned inifcns_check_tan(void)
+static unsigned inifcns_check_tan()
{
unsigned result = 0;
bool errorflag;
argument = n*Pi/60;
if (abs(tan(evalf(argument))-evalf(tan(argument)))>epsilon) {
clog << "tan(" << argument << ") returns "
- << tan(argument) << endl;
+ << tan(argument) << endl;
errorflag = true;
}
}
}
/* Simple tests on the dilogarithm function. */
-static unsigned inifcns_check_Li2(void)
+static unsigned inifcns_check_Li2()
{
// NOTE: this can safely be removed once CLN supports dilogarithms and
// checks them itself.
numeric epsilon(double(1e-16));
for (int n=0; n<200; ++n) {
argument = numeric(20.0*rand()/(RAND_MAX+1.0)-10.0)
- + numeric(20.0*rand()/(RAND_MAX+1.0)-10.0)*I;
+ + numeric(20.0*rand()/(RAND_MAX+1.0)-10.0)*I;
if (abs(Li2(pow(argument,2))-2*Li2(argument)-2*Li2(-argument)) > epsilon) {
- cout << "Li2(z) at z==" << argument
- << " failed to satisfy Li2(z^2)==2*(Li2(z)+Li2(-z))" << endl;
+ clog << "Li2(z) at z==" << argument
+ << " failed to satisfy Li2(z^2)==2*(Li2(z)+Li2(-z))" << endl;
errorflag = true;
}
}
return result;
}
-unsigned check_inifcns(void)
+unsigned check_inifcns()
{
unsigned result = 0;