-- The No-FP-Stack Floating-Point Word Set
Copyright (C) Krishna Myneni and Guido Draheim, 2002
description: The No-FP-Stack Floating-Point Wordset is not usually used on embedded platforms. This Module implements the floating-point words but expects and puts the floating-point values on the forth parameter-stack.
EXTENSIONS
>FLOAT
( .. )(
)
;
as:"back-float";
ordinary primitive >FLOAT
an executable word (no special usage info)
or wrapper call around p4_nofp_to_float
EXTENSIONS
D>F
( .. )(
)
;
as:"d-back-f";
ordinary primitive D>F
an executable word (no special usage info)
or wrapper call around p4_nofp_d_to_f
EXTENSIONS
F!
( .. )(
)
;
as:"f-store";
ordinary primitive F!
an executable word (no special usage info)
or wrapper call around p4_nofp_f_store
dpANS 12.6.1.1400 - standard forth word
EXTENSIONS
F*
( .. )(
)
;
as:"f-star";
ordinary primitive F*
an executable word (no special usage info)
or wrapper call around p4_nofp_f_star
dpANS 12.6.1.1410 - standard forth word
EXTENSIONS
F+
( .. )(
)
;
as:"f-plus";
ordinary primitive F+
an executable word (no special usage info)
or wrapper call around p4_nofp_f_plus
dpANS 12.6.1.1420 - standard forth word
EXTENSIONS
F-
( .. )(
)
;
as:"f-minus";
ordinary primitive F-
an executable word (no special usage info)
or wrapper call around p4_nofp_f_minus
dpANS 12.6.1.1425 - standard forth word
EXTENSIONS
F/
( .. )(
)
;
as:"f-slash";
ordinary primitive F/
an executable word (no special usage info)
or wrapper call around p4_nofp_f_slash
dpANS 12.6.1.1430 - standard forth word
EXTENSIONS
F0<
( .. )(
)
;
as:"f-zero-from";
ordinary primitive F0<
an executable word (no special usage info)
or wrapper call around p4_nofp_f_zero_less
EXTENSIONS
F0=
( .. )(
)
;
as:"f-zero-equal";
ordinary primitive F0=
an executable word (no special usage info)
or wrapper call around p4_nofp_f_zero_equal
dpANS 12.6.1.1450 - standard forth word
EXTENSIONS
F<
( .. )(
)
;
as:"f-from";
ordinary primitive F<
an executable word (no special usage info)
or wrapper call around p4_nofp_f_less_than
EXTENSIONS
F>
( .. )(
)
;
as:"f-back";
ordinary primitive F>
an executable word (no special usage info)
or wrapper call around p4_nofp_f_greater_than
EXTENSIONS
F=
( .. )(
)
;
as:"f-equal";
ordinary primitive F=
an executable word (no special usage info)
or wrapper call around p4_nofp_f_equal
EXTENSIONS
F<>
( f: a b -- s: a!=b )( | ) ; |
; |
EXTENSIONS
F<=
( .. )(
)
;
as:"f-from-equal";
ordinary primitive F<=
an executable word (no special usage info)
or wrapper call around p4_nofp_f_less_than_or_equal
EXTENSIONS
F>=
( .. )(
)
;
as:"f-back-equal";
ordinary primitive F>=
an executable word (no special usage info)
or wrapper call around p4_nofp_f_greater_than_or_equal
EXTENSIONS
F>D
( .. )(
)
;
as:"f-back-d";
ordinary primitive F>D
an executable word (no special usage info)
or wrapper call around p4_nofp_f_to_d
EXTENSIONS
F@
( .. )(
)
;
as:"f-fetch";
ordinary primitive F@
an executable word (no special usage info)
or wrapper call around p4_nofp_f_fetch
dpANS 12.6.1.1472 - standard forth word
EXTENSIONS
FALIGN
( .. )(
)
;
as:"falign";
ordinary primitive FALIGN
an executable word (no special usage info)
or wrapper call around p4_nofp_d_f_align
dpANS 12.6.1.1479 - standard forth word
EXTENSIONS
FALIGNED
( .. )(
)
;
as:"faligned";
ordinary primitive FALIGNED
an executable word (no special usage info)
or wrapper call around p4_nofp_d_f_aligned
dpANS 12.6.1.1483 - standard forth word
EXTENSIONS
FCONSTANT
( .. )(
)
;
as:"fconstant";
definining primitive FCONSTANT
an executable word (no special usage info)
or wrapper call around p4_nofp_f_constant
dpANS 12.6.1.1492 - standard forth word
EXTENSIONS
FDEPTH
( .. )(
)
;
as:"fdepth";
ordinary primitive FDEPTH
an executable word (no special usage info)
or wrapper call around p4_nofp_f_depth
dpANS 12.6.1.1497 - standard forth word
EXTENSIONS
FDROP
( .. )(
)
;
as:"fdrop";
ordinary primitive FDROP
an executable word (no special usage info)
or wrapper call around p4_nofp_f_drop
dpANS 12.6.1.1500 - standard forth word
EXTENSIONS
FDUP
( .. )(
)
;
as:"fdup";
ordinary primitive FDUP
an executable word (no special usage info)
or wrapper call around p4_nofp_f_dup
dpANS 12.6.1.1510 - standard forth word
EXTENSIONS
FLITERAL
( .. )(
)
;
as:"fliteral";
compiling primitive FLITERAL
an executable word (no special usage info)
or wrapper call around p4_nofp_f_literal
dpANS 12.6.1.1552 - standard forth word
EXTENSIONS
FLOAT+
( .. )(
)
;
as:"float-plus";
ordinary primitive FLOAT+
an executable word (no special usage info)
or wrapper call around p4_nofp_d_float_plus
dpANS 12.6.1.1555 - standard forth word
EXTENSIONS
FLOATS
( .. )(
)
;
as:"floats";
ordinary primitive FLOATS
an executable word (no special usage info)
or wrapper call around p4_nofp_d_floats
dpANS 12.6.1.1556 - standard forth word
EXTENSIONS
FLOOR
( .. )(
)
;
as:"floor";
ordinary primitive FLOOR
an executable word (no special usage info)
or wrapper call around p4_nofp_floor
dpANS 12.6.1.1558 - standard forth word
EXTENSIONS
FMAX
( .. )(
)
;
as:"fmax";
ordinary primitive FMAX
an executable word (no special usage info)
or wrapper call around p4_nofp_f_max
dpANS 12.6.1.1562 - standard forth word
EXTENSIONS
FMIN
( .. )(
)
;
as:"fmin";
ordinary primitive FMIN
an executable word (no special usage info)
or wrapper call around p4_nofp_f_min
dpANS 12.6.1.1565 - standard forth word
EXTENSIONS
FNEGATE
( .. )(
)
;
as:"fnegate";
ordinary primitive FNEGATE
an executable word (no special usage info)
or wrapper call around p4_nofp_f_negate
dpANS 12.6.1.1567 - standard forth word
EXTENSIONS
FOVER
( .. )(
)
;
as:"fover";
ordinary primitive FOVER
an executable word (no special usage info)
or wrapper call around p4_nofp_f_over
dpANS 12.6.1.1600 - standard forth word
EXTENSIONS
FROT
( .. )(
)
;
as:"frot";
ordinary primitive FROT
an executable word (no special usage info)
or wrapper call around p4_nofp_f_rot
dpANS 12.6.1.1610 - standard forth word
EXTENSIONS
FROUND
( .. )(
)
;
as:"fround";
ordinary primitive FROUND
an executable word (no special usage info)
or wrapper call around p4_nofp_f_round
dpANS 12.6.1.1612 - standard forth word
EXTENSIONS
FSWAP
( .. )(
)
;
as:"fswap";
ordinary primitive FSWAP
an executable word (no special usage info)
or wrapper call around p4_nofp_f_swap
dpANS 12.6.1.1620 - standard forth word
EXTENSIONS
FVARIABLE
( .. )(
)
;
as:"fvariable";
definining primitive FVARIABLE
an executable word (no special usage info)
or wrapper call around p4_nofp_f_variable
dpANS 12.6.1.1630 - standard forth word
EXTENSIONS
REPRESENT
( .. )(
)
;
as:"represent";
ordinary primitive REPRESENT
an executable word (no special usage info)
or wrapper call around p4_nofp_represent
dpANS 12.6.1.2143 - standard forth word
EXTENSIONS
DF!
( .. )(
)
;
as:"df-store";
ordinary primitive DF!
an executable word (no special usage info)
or wrapper call around p4_nofp_f_store
dpANS 12.6.2.1203 - standard forth word
EXTENSIONS
DF@
( .. )(
)
;
as:"df-fetch";
ordinary primitive DF@
an executable word (no special usage info)
or wrapper call around p4_nofp_f_fetch
dpANS 12.6.2.1204 - standard forth word
EXTENSIONS
DFALIGN
( .. )(
)
;
as:"dfalign";
ordinary primitive DFALIGN
an executable word (no special usage info)
or wrapper call around p4_nofp_d_f_align
dpANS 12.6.2.1205 - standard forth word
EXTENSIONS
DFALIGNED
( .. )(
)
;
as:"dfaligned";
ordinary primitive DFALIGNED
an executable word (no special usage info)
or wrapper call around p4_nofp_d_f_aligned
dpANS 12.6.2.1207 - standard forth word
EXTENSIONS
DFLOAT+
( .. )(
)
;
as:"dfloat-plus";
ordinary primitive DFLOAT+
an executable word (no special usage info)
or wrapper call around p4_nofp_d_float_plus
dpANS 12.6.2.1208 - standard forth word
EXTENSIONS
DFLOATS
( .. )(
)
;
as:"dfloats";
ordinary primitive DFLOATS
an executable word (no special usage info)
or wrapper call around p4_nofp_d_floats
dpANS 12.6.2.1209 - standard forth word
EXTENSIONS
F**
( .. )(
)
;
as:"f-star-star";
ordinary primitive F**
an executable word (no special usage info)
or wrapper call around p4_nofp_f_star_star
dpANS 12.6.2.1415 - standard forth word
EXTENSIONS
F.
( .. )(
)
;
as:"f-dot";
ordinary primitive F.
an executable word (no special usage info)
or wrapper call around p4_nofp_f_dot
dpANS 12.6.2.1427 - standard forth word
EXTENSIONS
FABS
( .. )(
)
;
as:"fabs";
ordinary primitive FABS
an executable word (no special usage info)
or wrapper call around p4_nofp_f_abs
dpANS 12.6.2.1474 - standard forth word
EXTENSIONS
FACOS
( .. )(
)
;
as:"facos";
ordinary primitive FACOS
an executable word (no special usage info)
or wrapper call around p4_nofp_f_acos
dpANS 12.6.2.1476 - standard forth word
EXTENSIONS
FACOSH
( .. )(
)
;
as:"facosh";
ordinary primitive FACOSH
an executable word (no special usage info)
or wrapper call around p4_nofp_f_acosh
dpANS 12.6.2.1477 - standard forth word
EXTENSIONS
FALOG
( .. )(
)
;
as:"falog";
ordinary primitive FALOG
an executable word (no special usage info)
or wrapper call around p4_nofp_f_alog
dpANS 12.6.2.1484 - standard forth word
EXTENSIONS
FASIN
( .. )(
)
;
as:"fasin";
ordinary primitive FASIN
an executable word (no special usage info)
or wrapper call around p4_nofp_f_asin
dpANS 12.6.2.1486 - standard forth word
EXTENSIONS
FASINH
( .. )(
)
;
as:"fasinh";
ordinary primitive FASINH
an executable word (no special usage info)
or wrapper call around p4_nofp_f_asinh
dpANS 12.6.2.1487 - standard forth word
EXTENSIONS
FATAN
( .. )(
)
;
as:"fatan";
ordinary primitive FATAN
an executable word (no special usage info)
or wrapper call around p4_nofp_f_atan
dpANS 12.6.2.1488 - standard forth word
EXTENSIONS
FATAN2
( .. )(
)
;
as:"fatan-two";
ordinary primitive FATAN2
an executable word (no special usage info)
or wrapper call around p4_nofp_f_atan2
dpANS 12.6.2.1489 - standard forth word
EXTENSIONS
FATANH
( .. )(
)
;
as:"fatanh";
ordinary primitive FATANH
an executable word (no special usage info)
or wrapper call around p4_nofp_f_atanh
dpANS 12.6.2.1491 - standard forth word
EXTENSIONS
FCOS
( .. )(
)
;
as:"fcos";
ordinary primitive FCOS
an executable word (no special usage info)
or wrapper call around p4_nofp_f_cos
dpANS 12.6.2.1493 - standard forth word
EXTENSIONS
FCOSH
( .. )(
)
;
as:"fcosh";
ordinary primitive FCOSH
an executable word (no special usage info)
or wrapper call around p4_nofp_f_cosh
dpANS 12.6.2.1494 - standard forth word
EXTENSIONS
FE.
( .. )(
)
;
as:"fe-dot";
ordinary primitive FE.
an executable word (no special usage info)
or wrapper call around p4_nofp_f_e_dot
dpANS 12.6.2.1513 - standard forth word
EXTENSIONS
FEXP
( .. )(
)
;
as:"fexp";
ordinary primitive FEXP
an executable word (no special usage info)
or wrapper call around p4_nofp_f_exp
dpANS 12.6.2.1515 - standard forth word
EXTENSIONS
FEXPM1
( .. )(
)
;
as:"fexpm-one";
ordinary primitive FEXPM1
an executable word (no special usage info)
or wrapper call around p4_nofp_f_expm1
dpANS 12.6.2.1516 - standard forth word
EXTENSIONS
FLN
( .. )(
)
;
as:"fln";
ordinary primitive FLN
an executable word (no special usage info)
or wrapper call around p4_nofp_f_ln
dpANS 12.6.2.1553 - standard forth word
EXTENSIONS
FLNP1
( .. )(
)
;
as:"flnp-one";
ordinary primitive FLNP1
an executable word (no special usage info)
or wrapper call around p4_nofp_f_lnp1
dpANS 12.6.2.1554 - standard forth word
EXTENSIONS
FLOG
( .. )(
)
;
as:"flog";
ordinary primitive FLOG
an executable word (no special usage info)
or wrapper call around p4_nofp_f_log
dpANS 12.6.2.1557 - standard forth word
EXTENSIONS
FS.
( .. )(
)
;
as:"fs-dot";
ordinary primitive FS.
an executable word (no special usage info)
or wrapper call around p4_nofp_f_s_dot
dpANS 12.6.2.1613 - standard forth word
EXTENSIONS
FSIN
( .. )(
)
;
as:"fsin";
ordinary primitive FSIN
an executable word (no special usage info)
or wrapper call around p4_nofp_f_sin
dpANS 12.6.2.1614 - standard forth word
EXTENSIONS
FSINCOS
( .. )(
)
;
as:"fsincos";
ordinary primitive FSINCOS
an executable word (no special usage info)
or wrapper call around p4_nofp_f_sincos
dpANS 12.6.2.1616 - standard forth word
EXTENSIONS
FSINH
( .. )(
)
;
as:"fsinh";
ordinary primitive FSINH
an executable word (no special usage info)
or wrapper call around p4_nofp_f_sinh
dpANS 12.6.2.1617 - standard forth word
EXTENSIONS
FSQRT
( .. )(
)
;
as:"fsqrt";
ordinary primitive FSQRT
an executable word (no special usage info)
or wrapper call around p4_nofp_f_sqrt
dpANS 12.6.2.1618 - standard forth word
EXTENSIONS
FTAN
( .. )(
)
;
as:"ftan";
ordinary primitive FTAN
an executable word (no special usage info)
or wrapper call around p4_nofp_f_tan
dpANS 12.6.2.1625 - standard forth word
EXTENSIONS
FTANH
( .. )(
)
;
as:"ftanh";
ordinary primitive FTANH
an executable word (no special usage info)
or wrapper call around p4_nofp_f_tanh
dpANS 12.6.2.1626 - standard forth word
EXTENSIONS
F~
( .. )(
)
;
as:"f-like";
ordinary primitive F~
an executable word (no special usage info)
or wrapper call around p4_nofp_f_proximate
dpANS 12.6.2.1640 - standard forth word
EXTENSIONS
PRECISION
( .. )(
)
;
as:"precision";
- loader type P4_DVaL PRECISION
precision (no special usage info)
dpANS 12.6.2.2035 - standard forth word
EXTENSIONS
SET-PRECISION
( .. )( | ) ; |
; |
ordinary primitive SET-PRECISION
an executable word (no special usage info)
or wrapper call around p4_nofp_set_precision
dpANS 12.6.2.2200 - standard forth word
EXTENSIONS
SF!
( .. )(
)
;
as:"sf-store";
ordinary primitive SF!
an executable word (no special usage info)
or wrapper call around p4_nofp_s_f_store
dpANS 12.6.2.2202 - standard forth word
EXTENSIONS
SF@
( .. )(
)
;
as:"sf-fetch";
ordinary primitive SF@
an executable word (no special usage info)
or wrapper call around p4_nofp_s_f_fetch
dpANS 12.6.2.2203 - standard forth word
EXTENSIONS
SFALIGN
( .. )(
)
;
as:"sfalign";
ordinary primitive SFALIGN
an executable word (no special usage info)
or wrapper call around p4_align
dpANS 12.6.2.2204 - standard forth word
EXTENSIONS
SFALIGNED
( .. )(
)
;
as:"sfaligned";
ordinary primitive SFALIGNED
an executable word (no special usage info)
or wrapper call around p4_aligned
dpANS 12.6.2.2206 - standard forth word
EXTENSIONS
SFLOAT+
( .. )(
)
;
as:"sfloat-plus";
ordinary primitive SFLOAT+
an executable word (no special usage info)
or wrapper call around p4_nofp_s_float_plus
dpANS 12.6.2.2207 - standard forth word
EXTENSIONS
SFLOATS
( .. )(
)
;
as:"sfloats";
ordinary primitive SFLOATS
an executable word (no special usage info)
or wrapper call around p4_nofp_s_floats
dpANS 12.6.2.2208 - standard forth word
EXTENSIONS
S>F
( n -- f: x )(
)
;
p4:"s-to-f";
it's inverse is F>S - convert a cell parameter to floating-point.
EXTENSIONS
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.
EXTENSIONS
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 ;
EXTENSIONS
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.
EXTENSIONS
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)
EXTENSIONS
-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
EXTENSIONS
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.
EXTENSIONS
FNIP
(f: x1 x2 -- x2 )(
)
;
p4:"f-nip";
F-stack equivalent of NIP
EXTENSIONS
FTUCK
(f: x1 x2 -- x2 x1 x2 )( | ) ; |
; |
F-stack equivalent of TUCK
EXTENSIONS
1/F
(f: x -- 1/x )(
)
;
p4:"one-over-f";
EXTENSIONS
F^2
(f: x -- x^2 )(
)
;
p4:"f-square";
EXTENSIONS
F^N
( u f: x -- x^u )(
)
;
p4:"f-power-n";
For large exponents, use F** instead. Of course u=-1 is large.
EXTENSIONS
F2/
(f: x -- x/2 )(
)
;
p4:"f-two-slash";
EXTENSIONS
F2*
(f: x -- x*2 )(
)
;
p4:"f-two-star";
EXTENSIONS
F0>
(f: x -- s: flag )( | ) ; |
; |
EXTENSIONS
F0<>
(f: x -- s: flag )( | ) ; |
; |
ENVIRONMENT
FLOATING
( .. )(
)
;
as:"floating";
( 1994 ) constant FLOATING
an ordinary constant (no special usage info)
ENVIRONMENT
FPNOSTACK-EXT
( .. )( | ) ; |
; |
( 1994 ) constant FPNOSTACK-EXT
an ordinary constant (no special usage info)
ENVIRONMENT
MAX-FLOAT
( .. )(
)
;
as:"max-minus-float";
ordinary primitive MAX-FLOAT
an executable word (no special usage info)
or wrapper call around p__nofp_max_float
ENVIRONMENT
FPNOSTACK-LOADED
( .. )( | ) ; |
; |
constructor primitive FPNOSTACK-LOADED
an executable word (no special usage info)
or wrapper call around fpnostack_init
ENVIRONMENT
CELL-FALIGNED
( .. )( | ) ; |
; |
( 2003 ) constant CELL-FALIGNED
an ordinary constant (no special usage info)