mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-07-07 13:16:36 +02:00
adding reader support for infinities
This commit is contained in:
parent
386a1cdb0a
commit
34a9b15645
1 changed files with 8 additions and 0 deletions
8
sexp.c
8
sexp.c
|
@ -1328,6 +1328,14 @@ sexp sexp_read_raw (sexp ctx, sexp in) {
|
||||||
} else {
|
} else {
|
||||||
sexp_push_char(ctx, c2, in);
|
sexp_push_char(ctx, c2, in);
|
||||||
res = sexp_read_symbol(ctx, in, c1, 1);
|
res = sexp_read_symbol(ctx, in, c1, 1);
|
||||||
|
#if USE_FLONUMS
|
||||||
|
if (res == sexp_intern(ctx, "+inf.0"))
|
||||||
|
res = sexp_make_flonum(ctx, 1.0/0.0);
|
||||||
|
else if (res == sexp_intern(ctx, "-inf.0"))
|
||||||
|
res = sexp_make_flonum(ctx, -1.0/0.0);
|
||||||
|
else if (res == sexp_intern(ctx, "+nan.0"))
|
||||||
|
res = sexp_make_flonum(ctx, 0.0/0.0);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case '0': case '1': case '2': case '3': case '4':
|
case '0': case '1': case '2': case '3': case '4':
|
||||||
|
|
Loading…
Add table
Reference in a new issue