Revised 2017-01-10
Available output modes:
Compact Formatted String
------- --------- ------
F. F.R (F.) Floating
FS. FS.R (FS.) Scientific
FE. FE.R (FE.) Engineering
G. G.R (G.) General
In compact (floating-point) mode non-essential zeros and signs are
removed and the number of significant digits output is limited to a
maximum of PRECISION digits.
In formatted (fixed-point) mode the number of places output after the
decimal point is specified by the user and PRECISION has no effect.
When the precision required to display the number exceeds MAX-PRECISION
zeros are used to pad the relevant fields.
Output words that specify the number of places after the decimal point
may use the value -1 to force compact mode. F. FS. FE. G. always use
compact mode.
The character string returned by (F.) (FS.) (FE.) (G.) resides in the
pictured-numeric output area.
An ambiguous condition exists if BASE is not decimal or the character
string exceeds the pictured-numeric output area.
FPOUT is suitable for systems with combined or separate floating-point
data stacks.
Glossary
FDP ( -- a-addr )
A variable controlling decimal point display. If the contents
are zero then trailing decimal points are not shown. If non-zero
(default) the decimal point is displayed.
FECHAR ( -- c-addr )
A character variable containing the output character used to
indicate the exponent. Default is 'E'.
FEDIGITS ( -- a-addr )
A variable containing the minimum number of exponent digits to
display in formatted output mode. Default value is 2, minimum
is 1. Does not affect compact output mode.
MAX-PRECISION ( -- n )
A constant returning the implementation-defined maximum precision.
Equivalent to the value returned by the environment-query string
MAX-FLOAT-DIGITS.
SIGNED-ZERO ( -- a-addr )
A variable controlling signed-zero display. If the contents are
zero then floating-point negative-zero is displayed without the
negative sign. If the contents are non-zero then the negative
sign is displayed.
Note: SIGNED-ZERO is only available on systems which support it.
(F.) ( F: r -- ) ( n -- c-addr u ) or ( r n -- c-addr u )
Convert real number r to string c-addr u in fixed-point notation
with n places to the right of the decimal point. If n = -1, non-
essential zeros and signs are removed.
(FE.) ( F: r -- ) ( n -- c-addr u ) or ( r n -- c-addr u )
Convert real number r to string c-addr u in engineering notation
with n places right of the decimal point. If n = -1, non-essential
zeros and signs are removed.
(FS.) ( F: r -- ) ( n -- c-addr u ) or ( r n -- c-addr u )
Convert real number r to string c-addr u in scientific notation
with n places right of the decimal point. If n = -1, non-
essential zeros and signs are removed.
(G.) ( F: r -- ) ( n -- c-addr u ) or ( r n -- c-addr u )
Convert real number r to string c-addr u with n places right of
the decimal point. Fixed-point notation is used if the exponent is
in the range -4 to 5 otherwise use scientific notation. If n = -1,
non-essential zeros and signs are removed.
F. ( F: r -- ) or ( r -- )
Display r in floating-point notation followed by a space.
Non-essential zeros and signs are removed.
F.R ( F: r -- ) ( n u -- ) or ( r n u -- )
Display r in fixed-point notation right-justified in a field
width u with n places right of the decimal point. If n = -1,
non-essential zeros and signs are removed.
FE. ( F: r -- ) or ( r -- )
Display r in engineering notation followed by a space. Non-
essential zeros and signs are removed.
FE.R ( F: r -- ) ( n u -- ) or ( r n u -- )
Display r in engineering notation right-justified in a field width
u with n places to the right of the decimal point. If n = -1,
non-essential zeros and signs are removed.
FS. ( F: r -- ) or ( r -- )
Display r in scientific notation followed by a space. Non-
essential zeros and signs are removed.
FS.R ( F: r -- ) ( n u -- ) or ( r n u -- )
Display r in scientific notation right-justified in a field width
u with n places to the right of the decimal point. If n = -1,
non-essential zeros and signs are removed.
G. ( F: r -- ) or ( r -- )
Display real number r in floating-point notation followed by a
space. If the exponent is outside the range -4 to 5 then
scientific notation is used. Non-essential zeros and signs are
removed.
G.R ( F: r -- ) ( n u -- ) or ( r n u -- )
Display real number r right-justified in a field width u with n
places right of the decimal point. Fixed-point notation is used
if the exponent is in the range -4 to 5 otherwise use scientific
notation. If n = -1, non-essential zeros and signs are removed.
PRECISION ( -- u )
Return the maximum number of significant digits currently used by
F. FE. FS. G. and in compact output mode F.R FS.R FE.R G.R (F.)
(FE.) (FS.) (G.) .
SET-PRECISION ( u -- )
Set the maximum number of significant digits used by F. FS. FE.
G. and in compact output mode F.R FS.R FE.R G.R (F.) (FS.) (FE.)
(G.) . u is limited to MAX-PRECISION.
Top Home Forth
![]()
Page updated: 10 Jan 2017