On Mar 29, 2:01 pm, Krishna Myneni <krishnamyn...@[EMAIL PROTECTED]
>
wrote:
> The specification of >FLOAT in DPANS94 suggests that it treat a string
> of blanks as a representation of zero (below). Common practice among
> Forth systems (pfe, gforth, bigforth) appears to extend this suggested
> behavior to null strings as well, e.g.
>
> s" " >FLOAT
>
> returns a true flag on the stack, and fp zero on the floating point
> stack. Is there a strong argument for considering a null string to be a
> valid representation of fp zero. I would have implemented the conversion
> to return a false flag. Also, I don't much like the idea of treating a
> string of blanks as a valid representation for 0E either, but perhaps
> there was some valid reason for suggesting this behavior.
>
> Krishna
> --
>
> 12.6.1.0558 >FLOAT
> to-float FLOATING
>
> ( c-addr u -- true | false ) ( F: -- r | )
> or ( c-addr u -- r true | false)
>
> An attempt is made to convert the string specified by c-addr and u to
> internal floating-point representation. 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.
>
> A string of blanks should be treated as a special case representing
zero.
>
> The syntax of a convertible string := <significand>[<exponent>]
>
> <significand> := [<sign>]{<digits>[.<digits0>] |
> .<digits> }
> <exponent> := <marker><digits0>
> <marker> := {<e-form> | <sign-form>}
> <e-form> := <e-char>[<sign-form>]
> <sign-form> := { + | - }
> <e-char> := { D | d | E | e }
>
> See: A.12.6.1.0558 >FLOAT
I wouldn't want 0 for an empty cell, I'd want to keep track of it as
an N/A. For example, if in working with elasticities I do in fact want
to impute a dummy value for an N/A, it would only be 0 if working in
lognormal form and with no proxy ready at hand ... in explicit
elasticities with no other available proxy the dummy value would be 1.
Unless an explicit N/A or -0 is guaranteed to be available, I'd want a
false flag and then go and see why.
And N/A will quite often come out of a normal csv file of public data
as simply an empty cell. Its more convenient for the creator of the
data to just add a row or column of new information, put an
explanatory note reference in the descriptive label, and start adding
the new data at the point that it is available.


|