mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-21 06:39:17 +02:00
read will truncate floating point numbers if SEXP_USE_FLONUMS is false
This commit is contained in:
parent
c17e9b64b0
commit
22deffb46e
1 changed files with 4 additions and 0 deletions
4
sexp.c
4
sexp.c
|
@ -1570,9 +1570,13 @@ sexp sexp_read_float_tail (sexp ctx, sexp in, double whole, int negp) {
|
|||
} else {
|
||||
sexp_push_char(ctx, c, in);
|
||||
}
|
||||
#if SEXP_USE_FLONUMS
|
||||
res = (whole + res) * pow(10, e);
|
||||
if (negp) res *= -1;
|
||||
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) {
|
||||
|
|
Loading…
Add table
Reference in a new issue