-- miscellaneous useful extra words for FLOATING-EXT
Copyright (C) Tektronix, Inc. 1998 - 2003. All rights reserved.
description: Compatiblity with former standards, miscellaneous useful words. ... for FLOATING-EXT
FORTH
FLIT
( .. )(
)
;
as:"flit";
ordinary primitive FLIT
an executable word (no special usage info)
or wrapper call around p4_f_literal_execution
FORTH
F0
( .. )(
)
;
as:"f-zero";
threadstate variable F0
f0 (no special usage info)
FORTH
FLOAT-INPUT
( .. )( | ) ; |
; |
threadstate variable FLOAT-INPUT
float_input (no special usage info)
FORTH
FP@
( -- addr )(
)
;
p4:"f-p-fetch";
returns the floating point stack pointer
FORTH
FP!
( addr -- )(
)
;
p4:"f-p-store";
sets the floating point stack pointer - this is the inverse of FP@
FORTH
F=
( .. )(
)
;
as:"f-equal";
ordinary primitive F=
an executable word (no special usage info)
or wrapper call around p4_f_equal
FORTH
F<>
( f: a b -- s: a!=b )( | ) ; |
; |
FORTH
F>
( .. )(
)
;
as:"f-back";
ordinary primitive F>
an executable word (no special usage info)
or wrapper call around p4_f_greater_than
FORTH
F<=
( .. )(
)
;
as:"f-from-equal";
ordinary primitive F<=
an executable word (no special usage info)
or wrapper call around p4_f_less_than_or_equal
FORTH
F>=
( .. )(
)
;
as:"f-back-equal";
ordinary primitive F>=
an executable word (no special usage info)
or wrapper call around p4_f_greater_than_or_equal
FORTH
S>F
( n -- f: x )(
)
;
p4:"s-to-f";
it's inverse is F>S - convert a cell parameter to floating-point.
FORTH
FTRUNC>S
(f: x -- s: n )( | ) ; |
; |
The word F>S was sometimes defined with a different behavior than FTRUNC>S which is the type-cast behaviour of C according to C99 section 6.3.1.4 - truncation would also match the ANS-Forth specification for F>D.
Some systems used F>S defined to FROUND>S instead. The pfe provides explicit words for both conversions, the word FROUND>S and FTRUNC>S which return single-cell parameters for a floating point number with the conversion method of FTRUNC or FROUND.
In PFE, F>S is a synonym pointing to FTRUNC>S in analogy of the behavior of F>D where no explicit word exists. The inverse of F>S is the cast conversion of S>F.
FORTH
FROUND>S
(f: x -- s: n)( | ) ; |
; |
complements FTRUNC>S for applications that expect F>S to be defined with a rounding behavior like
: FROUND>S FROUND FTRUNC>S ;
FORTH
F>S
( .. )(
)
;
as:"f-back-s";
forthword synonym F>S
is doing the same as FTRUNC>S
this word is provided only for compatibility with common forth usage in programs. Thegiven synonym should be preferred however.
FORTH
FTRUNC
(f: x -- x' )(
)
;
p4:"f-trunc";
truncate towards zero, discard a fractional part. See also FTRUNC>S conversion and the FROUND and FLOOR adaptors.
: FTRUNC FDUP F0< IF FCEIL ELSE FLOOR THEN ;
(When available, uses a single call to C99 trunc() internally)
FORTH
-FROT
(f: x1 x2 x3 -- x3 x1 x2 )( | ) ; |
; |
F-stack equivalent of -ROT
note, some systems call this work F-ROT, here it is the inverse of FROT
FORTH
F-ROT
( .. )(
)
;
as:"f-minus-rot";
forthword synonym F-ROT
is doing the same as -FROT
this word is provided only for compatibility with common forth usage in programs. Thegiven synonym should be preferred however.
FORTH
FNIP
(f: x1 x2 -- x2 )(
)
;
p4:"f-nip";
F-stack equivalent of NIP
FORTH
FTUCK
(f: x1 x2 -- x2 x1 x2 )( | ) ; |
; |
F-stack equivalent of TUCK
FORTH
1/F
(f: x -- 1/x )(
)
;
p4:"one-over-f";
FORTH
F^2
(f: x -- x^2 )(
)
;
p4:"f-square";
FORTH
F^N
( u f: x -- x^u )(
)
;
p4:"f-power-n";
For large exponents, use F** instead. Of course u=-1 is large.
FORTH
F2/
(f: x -- x/2 )(
)
;
p4:"f-two-slash";
FORTH
F2*
(f: x -- x*2 )(
)
;
p4:"f-two-star";
FORTH
F0>
(f: x -- s: flag )( | ) ; |
; |
FORTH
F0<>
(f: x -- s: flag )( | ) ; |
; |