Skip to content

Commit

Permalink
release 1.4
Browse files Browse the repository at this point in the history
add F>S word to the full version with floating point; improve LOGS.FTH and MATH.FTH
  • Loading branch information
Robert-van-Engelen committed May 21, 2023
1 parent 7ab1537 commit 69237a3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
7 changes: 3 additions & 4 deletions examples/LOGS.FTH
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ DECIMAL
THEN
2DUP 2DUP FTRUNC F= IF
2DUP ['] F>D CATCH 0= IF
2SWAP 2DROP
2DUP DABS 17. DU< IF
DROP
DUP 0< >R
ABS >R
2DROP
1E0
BEGIN
R@ 1 AND IF 2OVER F* THEN
Expand All @@ -91,11 +91,10 @@ DECIMAL
THEN
OVER 1 AND IF
2OVER F0< IF
D>F 2SWAP FABS 2SWAP F^ FNEGATE EXIT
2DROP 2SWAP FABS 2SWAP F^ FNEGATE EXIT
THEN
THEN
D>F
2SWAP FABS 2SWAP
2DROP 2SWAP FABS 2SWAP
ELSE
2DROP
THEN
Expand Down
7 changes: 3 additions & 4 deletions examples/MATH.FTH
Original file line number Diff line number Diff line change
Expand Up @@ -344,11 +344,11 @@ DECIMAL
\ exponentiation by squaring r1^n when n is a small integer |n|<=16
2DUP 2DUP FTRUNC F= IF \ r2 has no fractional part
2DUP ['] F>D CATCH 0= IF \ r2 is convertable to a double n
2SWAP 2DROP \ drop old r2
2DUP DABS 17. DU< IF \ |n| <= 16
DROP \ drop high order of n
DUP 0< >R \ save sign of n
ABS >R \ save |n|
2DROP \ drop old r2
1E0 \ -- r1 1.0
BEGIN
R@ 1 AND IF 2OVER F* THEN
Expand All @@ -363,11 +363,10 @@ DECIMAL
THEN
OVER 1 AND IF \ n is odd
2OVER F0< IF \ r1 is negative
D>F 2SWAP FABS 2SWAP F^ FNEGATE EXIT \ return -(|r1|^n)
2DROP 2SWAP FABS 2SWAP F^ FNEGATE EXIT \ return -(|r1|^n)
THEN
THEN
D>F \ convert even integer n back to r2
2SWAP FABS 2SWAP \ we want to return |r1|^r2
2DROP 2SWAP FABS 2SWAP \ we want to return |r1|^r2
ELSE
2DROP \ drop copy of r2
THEN
Expand Down

0 comments on commit 69237a3

Please sign in to comment.