Mercurial > audlegacy-plugins
comparison src/paranormal/libcalc/function.c @ 1176:44d28af95a23 trunk
[svn] - i forgot to commit something here
| author | nenolod |
|---|---|
| date | Fri, 08 Jun 2007 10:58:23 -0700 |
| parents | 7ae024f5d91b |
| children | f121f2b1711a |
comparison
equal
deleted
inserted
replaced
| 1175:7ae024f5d91b | 1176:44d28af95a23 |
|---|---|
| 72 int x = (int)pop (stack); | 72 int x = (int)pop (stack); |
| 73 return (y == 0) ? 0 : (x / y); | 73 return (y == 0) ? 0 : (x / y); |
| 74 } | 74 } |
| 75 | 75 |
| 76 static double f_rand (ex_stack *stack) { | 76 static double f_rand (ex_stack *stack) { |
| 77 return rand() % pop (stack); | 77 return rand() % (int) pop(stack); |
| 78 } | 78 } |
| 79 | 79 |
| 80 /* */ | 80 /* */ |
| 81 | 81 |
| 82 static const func_t init[] = { | 82 static const func_t init[] = { |
| 86 { "asin", f_asin }, | 86 { "asin", f_asin }, |
| 87 { "acos", f_acos }, | 87 { "acos", f_acos }, |
| 88 { "atan", f_atan }, | 88 { "atan", f_atan }, |
| 89 { "log", f_log }, | 89 { "log", f_log }, |
| 90 { "if", f_if }, | 90 { "if", f_if }, |
| 91 { "div", f_div } | 91 { "div", f_div }, |
| 92 { "rand", f_rand } | 92 { "rand", f_rand } |
| 93 }; | 93 }; |
| 94 | 94 |
| 95 int function_lookup (const char *name) { | 95 int function_lookup (const char *name) { |
| 96 int i; | 96 int i; |
