Skip to content

Commit

Permalink
pforth: fix FROUND
Browse files Browse the repository at this point in the history
It used to push the result to the integer data stack.
That was wrong. It should go to the float stack.

Fixes #69
  • Loading branch information
philburk committed Oct 31, 2021
1 parent 268cc11 commit f3596ac
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions csrc/pfinnrfp.h
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,11 @@
break;

case ID_FP_FROUND:
PUSH_TOS;
TOS = (cell_t)fp_round(FP_TOS);
M_FP_DROP;
/* This was broken before and used to push its result to the
* integer data stack! Now it conforms to the ANSI standard.
* https://github.com/philburk/pforth/issues/69
*/
FP_TOS = (PF_FLOAT)fp_round(FP_TOS);
break;

case ID_FP_FSWAP: /* ( -- ) ( F: r1 r2 -- r2 r1 ) */
Expand Down

0 comments on commit f3596ac

Please sign in to comment.