Help with ... "NUMBER?" 
Author Message
 Help with ... "NUMBER?"

          Can anyone help, the standard EFORTH word-set includes the word
NUMBER? which converts a number string entered interactivly by the user.
Although it accepts hex numbers e.g $4000, it does not conform to the
usual FORTH and allow you to enter a double number e.g 123.45

Can anyone help by providing a modification of the EFORTH source for the
word. Follows below .......

  Alternatively....
  Provide a seperate word to allow you to enter a double number on the
  stack.

  Thanks in advance.

/ --------------------- Source starts here -----------------------------

: NUMBER? ( a -- n T, a F )


  IF HEX SWAP BYTE+ SWAP 1 - THEN ( a 0 b' n')


  IF 1 - ( a 0 b n)



      ELSE R> R> ( b index) 2DROP ( digit number) 2DROP 0
      THEN DUP
  THEN R> ( n ?sign) 2DROP R> BASE ! ;

  --------------------------------------------------------------------------
        Bernie Mentink   ( Christchurch N.Z. )

              .... Some things have to be seen to be believed,
                   Most things have to be believed to be seen ....
        -----------------------------------------------------------------



Sat, 10 Jun 1995 03:06:39 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Help wanted finding "golden" numbers

2. string.join(["Tk 4.2p2", "Python 1.4", "Win32", "free"], "for")

3. BEGIN{want[]={"s1o", "s2o", "s2q", "s3q"}

4. Parsing ""D""?

5. "Fifth", "Forth", zai nar?

6. Ruby "finalize", "__del__"

7. beginners "let"/"random" question

8. ANNOUNCE: new "plus"- and "dash"-patches available for Tcl7.5a2/Tk4.1a2

9. Looking for "stdin", "stdout"

10. "running" numbers

11. (string->number "#e1.43#")

12. maximum number of "always" statement

 

 
Powered by phpBB® Forum Software