2002-03-17 06:57:03 +00:00
|
|
|
/*
|
|
|
|
|
|
|
|
EXP equation evaluation routines
|
|
|
|
Copyright (C) 2000, 2001 Brian Koropoff
|
|
|
|
|
|
|
|
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 the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
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, US
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <math.h>
|
|
|
|
|
2002-11-05 19:12:51 +00:00
|
|
|
double
|
|
|
|
OP_Not (double op1, double op2)
|
2002-04-24 22:33:04 +00:00
|
|
|
{
|
|
|
|
return !op1;
|
|
|
|
}
|
|
|
|
|
2002-11-05 19:12:51 +00:00
|
|
|
double
|
|
|
|
OP_Negate (double op1, double op2)
|
2002-08-23 21:18:00 +00:00
|
|
|
{
|
|
|
|
return -op1;
|
|
|
|
}
|
|
|
|
|
2002-11-05 19:12:51 +00:00
|
|
|
double
|
|
|
|
OP_Add (double op1, double op2)
|
2002-03-17 06:57:03 +00:00
|
|
|
{
|
|
|
|
return op1 + op2;
|
|
|
|
}
|
|
|
|
|
2002-11-05 19:12:51 +00:00
|
|
|
double
|
|
|
|
OP_Sub (double op1, double op2)
|
2002-03-17 06:57:03 +00:00
|
|
|
{
|
|
|
|
return op1 - op2;
|
|
|
|
}
|
|
|
|
|
2002-11-05 19:12:51 +00:00
|
|
|
double
|
|
|
|
OP_Mult (double op1, double op2)
|
2002-03-17 06:57:03 +00:00
|
|
|
{
|
|
|
|
return op1 * op2;
|
|
|
|
}
|
|
|
|
|
2002-11-05 19:12:51 +00:00
|
|
|
double
|
|
|
|
OP_Div (double op1, double op2)
|
2002-03-17 06:57:03 +00:00
|
|
|
{
|
|
|
|
return op1 / op2;
|
|
|
|
}
|
|
|
|
|
2002-11-05 19:12:51 +00:00
|
|
|
double
|
|
|
|
OP_Exp (double op1, double op2)
|
2002-03-17 06:57:03 +00:00
|
|
|
{
|
|
|
|
return pow(op1, op2);
|
|
|
|
}
|
|
|
|
|
2002-11-05 19:12:51 +00:00
|
|
|
double
|
|
|
|
OP_Eq (double op1, double op2)
|
2002-03-17 06:57:03 +00:00
|
|
|
{
|
|
|
|
return op1 == op2;
|
|
|
|
}
|
|
|
|
|
2002-11-05 19:12:51 +00:00
|
|
|
double
|
|
|
|
OP_Neq (double op1, double op2)
|
2002-03-22 00:22:03 +00:00
|
|
|
{
|
|
|
|
return op1 != op2;
|
|
|
|
}
|
|
|
|
|
2002-11-05 19:12:51 +00:00
|
|
|
double
|
|
|
|
OP_Or (double op1, double op2)
|
2002-03-17 06:57:03 +00:00
|
|
|
{
|
|
|
|
return op1 || op2;
|
|
|
|
}
|
|
|
|
|
2002-11-05 19:12:51 +00:00
|
|
|
double
|
|
|
|
OP_And (double op1, double op2)
|
2002-03-17 06:57:03 +00:00
|
|
|
{
|
|
|
|
return op1 && op2;
|
|
|
|
}
|
2002-11-05 19:12:51 +00:00
|
|
|
|
|
|
|
double
|
|
|
|
OP_GreaterThan (double op1, double op2)
|
2002-03-17 06:57:03 +00:00
|
|
|
{
|
|
|
|
return op1 > op2;
|
|
|
|
}
|
|
|
|
|
2002-11-05 19:12:51 +00:00
|
|
|
double
|
|
|
|
OP_LessThan (double op1, double op2)
|
2002-03-17 06:57:03 +00:00
|
|
|
{
|
|
|
|
return op1 < op2;
|
|
|
|
}
|
2002-11-05 19:12:51 +00:00
|
|
|
|
|
|
|
double
|
|
|
|
OP_GreaterThanEqual (double op1, double op2)
|
2002-03-17 06:57:03 +00:00
|
|
|
{
|
|
|
|
return op1 >= op2;
|
|
|
|
}
|
2002-11-05 19:12:51 +00:00
|
|
|
|
|
|
|
double
|
|
|
|
OP_LessThanEqual (double op1, double op2)
|
2002-03-17 06:57:03 +00:00
|
|
|
{
|
2002-03-18 04:12:09 +00:00
|
|
|
return op1 <= op2;
|
2002-03-17 06:57:03 +00:00
|
|
|
}
|
2002-04-28 08:30:54 +00:00
|
|
|
|
|
|
|
|
2002-11-05 19:12:51 +00:00
|
|
|
double
|
|
|
|
Func_Sin (double *oplist, unsigned int numops)
|
2002-04-28 08:30:54 +00:00
|
|
|
{
|
|
|
|
return sin (oplist[0]);
|
|
|
|
}
|
|
|
|
|
2002-11-05 19:12:51 +00:00
|
|
|
double
|
|
|
|
Func_Cos (double *oplist, unsigned int numops)
|
2002-04-28 08:30:54 +00:00
|
|
|
{
|
|
|
|
return cos (oplist[0]);
|
|
|
|
}
|
|
|
|
|
2002-11-05 19:12:51 +00:00
|
|
|
double
|
|
|
|
Func_Tan (double *oplist, unsigned int numops)
|
2002-04-28 08:30:54 +00:00
|
|
|
{
|
|
|
|
return tan (oplist[0]);
|
|
|
|
}
|
|
|
|
|
2002-11-05 19:12:51 +00:00
|
|
|
double
|
|
|
|
Func_Asin (double *oplist, unsigned int numops)
|
2002-04-28 08:30:54 +00:00
|
|
|
{
|
|
|
|
return asin (oplist[0]);
|
|
|
|
}
|
|
|
|
|
2002-11-05 19:12:51 +00:00
|
|
|
double
|
|
|
|
Func_Acos (double *oplist, unsigned int numops)
|
2002-04-28 08:30:54 +00:00
|
|
|
{
|
|
|
|
return acos (oplist[0]);
|
|
|
|
}
|
|
|
|
|
2002-11-05 19:12:51 +00:00
|
|
|
double
|
|
|
|
Func_Atan (double *oplist, unsigned int numops)
|
2002-04-28 08:30:54 +00:00
|
|
|
{
|
|
|
|
return atan (oplist[0]);
|
|
|
|
}
|
2002-12-08 20:55:40 +00:00
|
|
|
|
|
|
|
double
|
|
|
|
Func_Sqrt (double *oplist, unsigned int numops)
|
|
|
|
{
|
|
|
|
return sqrt (oplist[0]);
|
|
|
|
}
|
|
|
|
|
|
|
|
double
|
|
|
|
Func_Abs (double *oplist, unsigned int numops)
|
|
|
|
{
|
|
|
|
return fabs (oplist[0]);
|
|
|
|
}
|