summaryrefslogtreecommitdiffstats
path: root/arith.c
diff options
context:
space:
mode:
Diffstat (limited to 'arith.c')
-rw-r--r--arith.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/arith.c b/arith.c
index c98d0531..6bb82efd 100644
--- a/arith.c
+++ b/arith.c
@@ -39,6 +39,7 @@
#include <wchar.h>
#include <limits.h>
#include <math.h>
+#include <ctype.h>
#include "config.h"
#include "lib.h"
#include "unwind.h"
@@ -1315,6 +1316,11 @@ val int_flo(val f)
sprintf(text, "%.64g", d);
+ if (!isdigit(text[0]))
+ uw_throwf(error_s,
+ lit("int-flo: cannot convert #<bad-float> to integer"),
+ nao);
+
have_exp = (strchr(text, 'e') != 0);
have_point = (strchr(text, '.') != 0);