From f3596ac3f0ed1db7921894380b3fb94f2625091e Mon Sep 17 00:00:00 2001 From: Phil Burk Date: Sun, 31 Oct 2021 16:49:27 -0700 Subject: [PATCH] pforth: fix FROUND It used to push the result to the integer data stack. That was wrong. It should go to the float stack. Fixes #69 --- csrc/pfinnrfp.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/csrc/pfinnrfp.h b/csrc/pfinnrfp.h index 21d3484..4a3095b 100644 --- a/csrc/pfinnrfp.h +++ b/csrc/pfinnrfp.h @@ -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 ) */