summaryrefslogtreecommitdiffstats
path: root/src/interp.c
diff options
context:
space:
mode:
authorEpicalert <epicalert@protonmail.com>2020-12-02 18:52:25 +0800
committerEpicalert <epicalert@protonmail.com>2020-12-02 18:52:25 +0800
commitf5bc0daa807c128b853656f9d8b2d7789e4ef262 (patch)
tree6ca70729a89dbf193316f926ed8be9ac0f9c7bd8 /src/interp.c
parentb53100eb6c3d22390f917be7cc943658074ca4ac (diff)
use double instead of int in factorial function
Diffstat (limited to 'src/interp.c')
-rw-r--r--src/interp.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/interp.c b/src/interp.c
index 7b81f13..aac4625 100644
--- a/src/interp.c
+++ b/src/interp.c
@@ -1291,11 +1291,11 @@ double eval(register struct ent * ent, register struct enode * e) {
case WHITE: return ((double) COLOR_WHITE);
case FACT:
{
- int total = eval(ent, e->e.o.left);
+ double total = eval(ent, e->e.o.left);
for (int i = eval(ent, e->e.o.left) - 1; i > 0; i--) {
total *= i;
- }
- return total > 0 ? total : 1;
+ }
+ return total > 0 ? total : 1;
}
default: sc_error ("Illegal numeric expression");
exprerr = 1;