Skip to content

Commit

Permalink
Don't allow mixing rational and floating point syntax.
Browse files Browse the repository at this point in the history
Closes #1014.
  • Loading branch information
ashinn committed Jan 3, 2025
1 parent 1368a74 commit a844854
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion sexp.c
Original file line number Diff line number Diff line change
Expand Up @@ -3019,7 +3019,8 @@ sexp sexp_read_number (sexp ctx, sexp in, int base, int exactp) {
} else if (c=='/') {
sexp_gc_preserve2(ctx, res, den);
den = sexp_read_number(ctx, in, base, exactp);
if (! (sexp_fixnump(den) || sexp_bignump(den) || sexp_complexp(den)))
if (! (sexp_fixnump(den) || sexp_bignump(den) ||
(sexp_complexp(den) && sexp_exactp(sexp_complex_real(den)) && sexp_exactp(sexp_complex_imag(den)))))
res = (sexp_exceptionp(den)
? den : sexp_read_error(ctx, "invalid rational syntax", den, in));
else {
Expand Down

0 comments on commit a844854

Please sign in to comment.