I see this:
PForth V27-LE/64, built Aug 24 2010 22:21:34 (static)
0.0 f.
0.0 f. 0.0000000 ok
Stack<10>
I think that it isn't nice that it goes against traditional
interpretation that this should return double integer.
Here's a fix.
> I think that it isn't nice that it goes against traditional
> interpretation that this should return double integer.
In the Forth compilers and Forth applications that I have sold we
generally used floating point much more than double precision. So we
interpreted 0.0 as a float. ANSI standard Forth came later and
specified that floats need to contain an 'E' exponent.
We recognize that some people prefer that behavior so we added a switch.
Just do this:
true fp-require-e !
and you will get the interpretation that you were expecting.
BTW, I looked at your patch. The new word has a different stack diagram
than the old word.
Old
: (FP.NUMBER?) ( $addr -- 0 | n 1 | d 2 | r 3 )
New:
: (FP.NUMBER?) ( ptr len -- 0 | n 1 | d 2 | r 3 )
I haven't tried it but if the stack diagram is correct then it would
break words that are calling it.
Also we do not want to change the behavior of existing words unless we
are fixing a bug.
If we changed the behavior of the number interpreter then lots of
existing code would break. It is more important to not break old code
than it is to conform to new standards.
Thank you,
Phil Burk
---------------------------------------
SoftSynth, Audio Research and Development
http://www.softsynth.com/
75 Pleasant Lane, San Rafael, CA, 94901 USA
Office/Fax: +1-415-453-4320
Mobile: +1-415-846-4370
---------------------------------------
> We recognize that some people prefer that behavior so we added a
> switch. Just do this:
>
> true fp-require-e !
>
> and you will get the interpretation that you were expecting.
Ah, I'll try it.
> BTW, I looked at your patch. The new word has a different stack
> diagram than the old word.
>
> Old
> : (FP.NUMBER?) ( $addr -- 0 | n 1 | d 2 | r 3 )
>
> New:
> : (FP.NUMBER?) ( ptr len -- 0 | n 1 | d 2 | r 3 )
>
> I haven't tried it but if the stack diagram is correct then it
> would break words that are calling it.
Yes, wrong branch. Sorry.
--
HE CE3OH...