Re: inconsistent behavior of >FLOAT
- From: Elizabeth D Rather <erather@xxxxxxxxx>
- Date: Wed, 13 May 2009 08:12:56 -1000
Anton Ertl wrote:
"Ed" <nospam@xxxxxxxxxxx> writes:Since we're on the subject of inconsistent behaviour of >FLOAT , I'll
throw in another. 12.6.1.0558 >FLOAT says:
"... If the string represents a valid floating-point number in the syntax
below, its value r and true are returned. If the string does not represent
a valid floating-point number only false is returned. ..."
I interpret that as: if the string does not match the syntax given then false
must be returned.
Given that at least the part about the string of blanks is optional,
it seems to me that the intention was that systems should at least
recognize the specified syntax as FP numbers, but that it may (and
sometimes "should") also accept other syntax (such as a string of
blanks) as FP numbers. Note that it does not say
|If the string does not represent a valid floating-point number _in
|the syntax below_ only false is returned.
Please note the introductory info in A.12.6.1.0558 >FLOAT:
">FLOAT enables programs to read floating-point data in legible ASCII format. It accepts a *much broader syntax* than does the text interpreter since the latter defines rules for composing source programs whereas >FLOAT defines rules for accepting data. >FLOAT is defined as broadly as is feasible to permit input of data from ANS Forth systems *as well as* other widely used standard programming environments"
(emphasis added) As I noted in another post in this thread last night, >FLOAT is not intended as a primitive or underlying component of the text interpreter, but rather a more liberal input mechanism intended to convert data from all kinds of sources that the Forth programmer may not have any control over. This is why its specification is loose. If you tighten it up a lot more, it may lose some of its usefulness.
That said, the issue of what to do with all blanks deals with the expectations of the Forth program, and it's reasonable to clarify that now. 15 years ago there wasn't enough "common practice" with FP to do that.
The issue of an *empty string* however, is something else. IMO that is an error, and should be treated as an "ambiguous condition".
Cheers,
Elizabeth
--
==================================================
Elizabeth D. Rather (US & Canada) 800-55-FORTH
FORTH Inc. +1 310.999.6784
5959 West Century Blvd. Suite 700
Los Angeles, CA 90045
http://www.forth.com
"Forth-based products and Services for real-time
applications since 1973."
==================================================
.
- Follow-Ups:
- Re: inconsistent behavior of >FLOAT
- From: Ed
- Re: inconsistent behavior of >FLOAT
- References:
- inconsistent behavior of >FLOAT
- From: Krishna Myneni
- Re: inconsistent behavior of >FLOAT
- From: Stephen Pelc
- Re: inconsistent behavior of >FLOAT
- From: Anton Ertl
- Re: inconsistent behavior of >FLOAT
- From: Krishna Myneni
- Re: inconsistent behavior of >FLOAT
- From: Ed
- Re: inconsistent behavior of >FLOAT
- From: Krishna Myneni
- Re: inconsistent behavior of >FLOAT
- From: Ed
- Re: inconsistent behavior of >FLOAT
- From: Anton Ertl
- inconsistent behavior of >FLOAT
- Prev by Date: Re: Trying to understand wordlists
- Next by Date: Re: Trying to understand wordlists
- Previous by thread: Re: inconsistent behavior of >FLOAT
- Next by thread: Re: inconsistent behavior of >FLOAT
- Index(es):
Relevant Pages
|