mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-19 13:49:17 +02:00
better round-off reading floating point numbers with large exponents
This commit is contained in:
parent
6d3ae7a28e
commit
b61c1b7077
1 changed files with 2 additions and 1 deletions
3
sexp.c
3
sexp.c
|
@ -2474,7 +2474,8 @@ sexp sexp_read_float_tail (sexp ctx, sexp in, double whole, int negp) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
if (e != 0.0) val *= pow(10, e);
|
if (e != 0.0)
|
||||||
|
val = abs(e) > 300 ? exp(log(val) + e*M_LN10) : val * pow(10, e);
|
||||||
#if SEXP_USE_FLONUMS
|
#if SEXP_USE_FLONUMS
|
||||||
res = sexp_make_flonum(ctx, val);
|
res = sexp_make_flonum(ctx, val);
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Add table
Reference in a new issue