read will truncate floating point numbers if SEXP_USE_FLONUMS is false

This commit is contained in:
Alex Shinn 2011-02-12 15:57:52 +09:00
parent c17e9b64b0
commit 22deffb46e

4
sexp.c
View file

@ -1570,9 +1570,13 @@ sexp sexp_read_float_tail (sexp ctx, sexp in, double whole, int negp) {
} else { } else {
sexp_push_char(ctx, c, in); sexp_push_char(ctx, c, in);
} }
#if SEXP_USE_FLONUMS
res = (whole + res) * pow(10, e); res = (whole + res) * pow(10, e);
if (negp) res *= -1; if (negp) res *= -1;
return sexp_make_flonum(ctx, res); return sexp_make_flonum(ctx, res);
#else
return sexp_make_fixnum((sexp_uint_t)whole);
#endif
} }
sexp sexp_read_number (sexp ctx, sexp in, int base) { sexp sexp_read_number (sexp ctx, sexp in, int base) {