Skip to content

the fround word push its result to data stack. #69

Closed
@edakawa

Description

@edakawa

Dear Mr. Phil Burk,

I'm a user of pForth and very happy to use it. By the way, I have a question
about the following parts,

$ pforth -q
7.7e fround . 8

7.7e fround f. 0.0000000 Stack<10> 8
THROW code = -45
Float Stack underflow!
bye
$

Is this the correct behavior? I expected the following behavior,

$ pforth -q
7.7e fround f. 8.000000
bye
$

I would like to think the fround word should push its result to floating point
stack. If this question was a known issue, I did very rudely, so I'm very sorry.

Finally, I modified csrc/pfinnrfp.h to get my expected behavior,

$ diff -C 2 pfinnrfp.h.orig pfinnrfp.h
*** pfinnrfp.h.orig     Mon Oct 28 15:50:40 2019
--- pfinnrfp.h  Mon Oct 28 15:30:43 2019
***************
*** 207,213 ****

      case ID_FP_FROUND:
!         PUSH_TOS;
!         TOS = (cell_t)fp_round(FP_TOS);
!         M_FP_DROP;
          break;

--- 207,211 ----

      case ID_FP_FROUND:
!         FP_TOS = (PF_FLOAT) fp_round(FP_TOS);
          break;
$

Sincerely,
Hajime Edakawa

Metadata

Metadata

Assignees

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions