Skip to content

Commit

Permalink
GH-37 Fix compiling of float literals.
Browse files Browse the repository at this point in the history
  • Loading branch information
SirWumpus committed Sep 12, 2024
1 parent 0bbb896 commit 68731a8
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/post4.c
Original file line number Diff line number Diff line change
Expand Up @@ -1599,14 +1599,23 @@ _inter_loop: while (ctx->input->offset < ctx->input->length) {
/* Not a word, not a number. */
THROW(P4_THROW_UNDEFINED);
}
if (ctx->state == P4_STATE_COMPILE) {
p4WordAppend(ctx, (P4_Cell) &w_lit);
p4WordAppend(ctx, x);
#ifdef HAVE_MATH_H
} else if (is_float) {
P4_PUSH(ctx->P4_FLOAT_STACK, x);
if (is_float) {
if (ctx->state == P4_STATE_COMPILE) {
if ((word = p4FindName(ctx, "flit", STRLEN("flit"))) == NULL) {
THROW(P4_THROW_UNDEFINED);
}
p4WordAppend(ctx, (P4_Cell) word);
p4WordAppend(ctx, x);
} else {
P4_PUSH(ctx->P4_FLOAT_STACK, x);
}
p4StackGuards(ctx);
} else
#endif
if (ctx->state == P4_STATE_COMPILE) {
p4WordAppend(ctx, (P4_Cell) &w_lit);
p4WordAppend(ctx, x);
} else {
P4_PUSH(ctx->ds, x);
p4StackGuards(ctx);
Expand Down

0 comments on commit 68731a8

Please sign in to comment.