18 static LISP lplus(LISP args)
22 for (sum=0.0,l=args; l !=
NIL; l=
cdr(l))
30 static LISP ltimes(LISP args)
34 for (product=1.0,l=args; l !=
NIL; l=
cdr(l))
43 {
if NFLONUMP(x)
err(
"wrong type of argument(1st) to difference",x);
44 if NFLONUMP(y)
err(
"wrong type of argument(2nd) to difference",y);
47 static LISP quotient(LISP x,LISP y)
48 {
if NFLONUMP(x)
err(
"wrong type of argument(1st) to quotient",x);
49 if NFLONUMP(y)
err(
"wrong type of argument(2nd) to quotient",y);
52 static LISP greaterp(LISP x,LISP y)
53 {
if NFLONUMP(x)
err(
"wrong type of argument(1st) to greaterp",x);
54 if NFLONUMP(y)
err(
"wrong type of argument(2nd) to greaterp",y);
58 static LISP lessp(LISP x,LISP y)
59 {
if NFLONUMP(x)
err(
"wrong type of argument(1st) to lessp",x);
60 if NFLONUMP(y)
err(
"wrong type of argument(2nd) to lessp",y);
64 static LISP l_nint(LISP number)
77 err(
"nint: argument not a number",number);
82 static LISP l_log(LISP n)
87 err(
"log: not a number",n);
94 double r = (double)abs(rand())/(
double)
RAND_MAX;
99 static LISP l_srand(LISP seed)
102 srand((
int)
FLONM(seed));
104 err(
"srand: not a number", seed);
108 static LISP l_exp(LISP n)
113 err(
"exp: not a number",n);
117 static LISP l_sin(LISP n)
122 err(
"sin: not a number",n);
126 static LISP l_cos(LISP n)
131 err(
"cos: not a number",n);
135 static LISP l_tan(LISP n)
140 err(
"tan: not a number",n);
144 static LISP l_asin(LISP n)
149 err(
"asin: not a number",n);
153 static LISP l_acos(LISP n)
158 err(
"acos: not a number",n);
162 static LISP l_atan(LISP n)
167 err(
"atan: not a number",n);
171 static LISP l_sqrt(LISP n)
176 err(
"sqrt: not a number",n);
180 static LISP l_pow(LISP x, LISP y)
190 static LISP l_mod(LISP x, LISP y)
213 Returns t if DATA is a number, nil otherwise.");
215 "(+ NUM1 NUM2 ...)\n\ 216 Returns the sum of NUM1 and NUM2 ... An error is given is any argument\n\ 220 Returns the difference between NUM1 and NUM2. An error is given is any\n\ 221 argument is not a number.");
223 "(* NUM1 NUM2 ...)\n\ 224 Returns the product of NUM1 and NUM2 ... An error is given is any\n\ 225 argument is not a number.");
228 Returns the quotient of NUM1 and NUM2. An error is given is any\n\ 229 argument is not a number.");
232 Returns t if NUM1 is greater than NUM2, nil otherwise. An error is\n\ 233 given is either argument is not a number.");
236 Returns t if NUM1 is less than NUM2, nil otherwise. An error is\n\ 237 given is either argument is not a number.");
240 Returns nearest int to NUMBER.");
243 Return natural log of NUM.");
246 Returns a pseudo random number between 0 and 1 using the libc rand()\n\ 250 Seeds the libc pseudo random number generator with the integer SEED.");
256 Return sine of NUM.");
259 Return cosine of NUM.");
262 Return tangent of NUM.");
265 Return arcsine of NUM.");
268 Return arccosine of NUM.");
271 Return arctangent of NUM.");
274 Return square root of NUM.");
void init_subr_2(const char *name, LISP(*fcn)(LISP, LISP), const char *doc)
void err(const char *message, LISP x) EST_NORETURN
const char * get_c_string(LISP x)
LISP cons(LISP x, LISP y)
void init_subr_1(const char *name, LISP(*fcn)(LISP), const char *doc)
EST_Track difference(EST_Track &a, EST_Track &b)
void init_lsubr(const char *name, LISP(*fcn)(LISP), const char *doc)
void init_subrs_math(void)
void init_subr_0(const char *name, LISP(*fcn)(void), const char *doc)
float sum(const EST_FMatrix &a)
sum of elements