Re: Floating point numbers and 'precision'

Anton Ertl <anton-8NJIiSa5LzB3ZGU3T6kWFyEcasqEdqbRs2V0tQ3P5b8@public.gmane.org>
Newsgroups gmane.comp.lang.forth.gforth
Message-ID <[email protected]>
On Wed, Sep 25, 2019 at 09:24:31AM -0400, J. David Boyd wrote:
> 
> What was the rationale for "precision" being used in fe., fs., and fp., but
> _not_ in f.s?

I don't remember it exactly.  Factors that probably played a role:

0) Probably originally there was the idea to use the ability of f.rdp
to show FP numbers in fixed-point or exponential notation, but that
idea was later dropped in favour of output that is interpreted as FP
number when copied and pasted into the text interpreter.

1) With the default precision, the output of fs. is at least 18 chars long.

2) The output of fs. may differ in length.  f.rdp always produces the
same length, which makes it easier to compare the outputs of
successive f.s output lines.

It's not cast in stone.  Instead of "16 5 11 f.rdp", f.s could also
use "precision 7 max dup 0 f.rdp" or somesuch.

- anton
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.