From 34a9b1564565a88675bc232b740844fd25d5db2b Mon Sep 17 00:00:00 2001 From: Alex Shinn Date: Mon, 24 Aug 2009 22:48:33 +0900 Subject: [PATCH] adding reader support for infinities --- sexp.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sexp.c b/sexp.c index e27c42aa..ca8db254 100644 --- a/sexp.c +++ b/sexp.c @@ -1328,6 +1328,14 @@ sexp sexp_read_raw (sexp ctx, sexp in) { } else { sexp_push_char(ctx, c2, in); 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; case '0': case '1': case '2': case '3': case '4':