Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #59587
| From | anton@mips.complang.tuwien.ac.at (Anton Ertl) |
|---|---|
| Newsgroups | comp.lang.forth |
| Subject | Re: FP-Number Ambiguities |
| Date | 2017-05-20 10:56 +0000 |
| Organization | Institut fuer Computersprachen, Technische Universitaet Wien |
| Message-ID | <2017May20.125641@mips.complang.tuwien.ac.at> (permalink) |
| References | <5fa5c564-0e26-4a1b-8236-3d240449b29d@googlegroups.com> |
minforth@arcor.de writes:
>I know it is a nearly dead horse in Forth, but IMO it should be streamlined the sooner the better:
>
>1. references for fp-number input and output formats when the double number wordset is loaded and when it is not
What do you want to say?
>2. truncation of trailing mantissa zeroes yes or no? how can it be controlled?
The specification of F. FS. and FE. does not specify much, so the
systems are pretty free in what they do. If you want it more tightly
specified, make a proposal. Existing practice: Gforth has F.RDP which
allows you to specify the format relatively precisely.
>3. buffer length for REPRESENT differs from PRECISION: what happens then?
PRECISION and SET-PRECISION are only relevant for F. FE. FS., and they
don't influence REPRESENT at all.
>
>Only one example:
>Gforth 0.7.0, Copyright (C) 1995-2008 Free Software Foundation, Inc.
>Gforth comes with ABSOLUTELY NO WARRANTY; for details type `license'
>Type `bye' to exit
>0.0 ok <-- is treated as double number, not as per standard
The standard does not specify what 0.0 means. In a standard program,
if you want an FP number, you have to write, e.g., "0e", while for a
double number, you have to write, e.g., "0.".
>1e ok
>f. 1. ok <-- why not 1E ?
F. is specified to produce a number in the format
[-] <digits>.<digits0>
i.e., no "e" allowed. If you mean that you would expect F. to output
numbers in a way that you can input in the text interpreter, and it
will produce approximately the same number, then yes, I think this
would be nice. Unfortunately, the Forth-94 committee decided on
something else, and the issue was not grave enough that anyone made a
proposal to fix it in the Forth-200x process (not for Forth-2012, and
not since then).
>1e ok
>fe. 1.00000000000000E0 ok <-- why not 1.E0 ?
Maybe thanks to PRECISION? There are people who advocate having
trailing zeroes in engineering contexts in order to indicate the
precision. So this might be appropriate for FE. and FS.
>1 set-precision ok
>1e fs. 1.E0 ok
>0 set-precision ok <-- test if this trims
>1e fs. . <-- gforth hangs
Thank you for this bug report. Unfortunately, I cannot reproduce
this. In both 0.7.2 and in the current development version, I get
0 set-precision ok
1e fs. ok
>How do you solve this "under-specification" in the standard?
If you want to solve it in the standard, the way to go is to make a
proposal for tightening the specification.
- anton
--
M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
New standard: http://www.forth200x.org/forth200x.html
EuroForth 2017: http://www.euroforth.org/ef17/
Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
FP-Number Ambiguities minforth@arcor.de - 2017-05-19 14:06 -0700
Re: FP-Number Ambiguities anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-05-20 10:56 +0000
Re: FP-Number Ambiguities minforth@arcor.de - 2017-05-20 11:50 -0700
Re: FP-Number Ambiguities anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-05-21 14:59 +0000
Re: FP-Number Ambiguities minforth@arcor.de - 2017-05-21 12:08 -0700
Re: FP-Number Ambiguities mhx@iae.nl - 2017-05-21 12:50 -0700
Re: FP-Number Ambiguities minforth@arcor.de - 2017-05-21 15:04 -0700
Re: FP-Number Ambiguities anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-05-22 11:43 +0000
Re: FP-Number Ambiguities minforth@arcor.de - 2017-05-22 06:40 -0700
Re: FP-Number Ambiguities albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2017-05-22 16:33 +0200
Re: FP-Number Ambiguities minforth@arcor.de - 2017-05-22 08:34 -0700
Double numbers and floats in the text interpreter (was: FP-Number...) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-05-22 16:17 +0000
Re: FP-Number Ambiguities pahihu <pahihu@gmail.com> - 2017-05-24 10:19 -0700
Re: FP-Number Ambiguities minforth@arcor.de - 2017-05-24 11:21 -0700
Re: FP-Number Ambiguities pahihu <pahihu@gmail.com> - 2017-05-24 12:13 -0700
Re: FP-Number Ambiguities minforth@arcor.de - 2017-05-24 13:12 -0700
Re: FP-Number Ambiguities (answer imported from future) Jan Coombs <jenfhaomndgfwutc@murmic.plus.com> - 2017-05-20 22:54 +0100
Re: FP-Number Ambiguities "HAA" <someone@microsoft.com> - 2017-05-24 17:21 +1000
Re: FP-Number Ambiguities minforth@arcor.de - 2017-05-24 01:11 -0700
Re: FP-Number Ambiguities "HAA" <someone@microsoft.com> - 2017-05-25 12:28 +1000
Re: FP-Number Ambiguities minforth@arcor.de - 2017-05-25 00:36 -0700
csiph-web