Skip to content

Commit

Permalink
Fix error reporting for complex inequality comparisons.
Browse files Browse the repository at this point in the history
Closes #934.
  • Loading branch information
ashinn committed May 29, 2024
1 parent 045bb18 commit 648f6b9
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions bignum.c
Original file line number Diff line number Diff line change
Expand Up @@ -1867,16 +1867,16 @@ sexp sexp_compare (sexp ctx, sexp a, sexp b) {
sexp_gc_preserve1(ctx, tmp);
if (at > bt) {
r = sexp_compare(ctx, b, a);
sexp_negate(r);
if (!sexp_exceptionp(r)) { sexp_negate(r); }
} else {
switch ((at * SEXP_NUM_NUMBER_TYPES) + bt) {
case SEXP_NUM_NOT_NOT: case SEXP_NUM_NOT_FIX:
case SEXP_NUM_NOT_FLO: case SEXP_NUM_NOT_BIG:
#if SEXP_USE_COMPLEX
case SEXP_NUM_CPX_CPX: case SEXP_NUM_CPX_FIX:
case SEXP_NUM_CPX_FLO: case SEXP_NUM_CPX_BIG:
case SEXP_NUM_CPX_CPX: case SEXP_NUM_FIX_CPX:
case SEXP_NUM_FLO_CPX: case SEXP_NUM_BIG_CPX:
#if SEXP_USE_RATIOS
case SEXP_NUM_CPX_RAT:
case SEXP_NUM_RAT_CPX:
#endif
#endif
r = sexp_type_exception(ctx, NULL, SEXP_NUMBER, a);
Expand Down Expand Up @@ -1944,6 +1944,9 @@ sexp sexp_compare (sexp ctx, sexp a, sexp b) {
r = sexp_ratio_compare(ctx, a, b);
break;
#endif
default:
r = sexp_xtype_exception(ctx, NULL, "unknown comparison", a);
break;
}
}
sexp_gc_release1(ctx);
Expand Down

0 comments on commit 648f6b9

Please sign in to comment.